mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
new micro optzn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35867 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7545422f08
commit
bae3bd7c19
@ -1047,3 +1047,33 @@ int decode_byte (const decode_t* decode) {
|
||||
}
|
||||
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
Consider:
|
||||
|
||||
int isnegative(unsigned int X) {
|
||||
return !(X < 2147483648U);
|
||||
}
|
||||
|
||||
We current compile this to:
|
||||
|
||||
define i32 @isnegative(i32 %X) {
|
||||
icmp slt i32 %X, 0 ; <i1>:0 [#uses=1]
|
||||
%retval = zext i1 %0 to i32 ; <i32> [#uses=1]
|
||||
ret i32 %retval
|
||||
}
|
||||
|
||||
and:
|
||||
|
||||
_isnegative:
|
||||
cmpl $0, 4(%esp)
|
||||
sets %al
|
||||
movzbl %al, %eax
|
||||
ret
|
||||
|
||||
We should produce:
|
||||
|
||||
movl 4(%esp), %eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user