diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 39add2272cf..6c148d7973f 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -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 ; :0 [#uses=1] + %retval = zext i1 %0 to 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 +