mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-20 02:34:48 +00:00
new micro optzn
llvm-svn: 35867
This commit is contained in:
parent
8d7aaa4843
commit
60f3ece40f
@ -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…
x
Reference in New Issue
Block a user