Open asl opened 5 years ago
Date: 2019-10-27 07:45:09 -0700 From: David Bolvansky <david.bolvansky@gmail.com>
bool test1(U64 val) { return ((U32)(val & 0x120)) == 0x20; } define dso_local zeroext i1 @test1(i64 %0) local_unnamed_addr #0 { %2 = and i64 %0, 288 %3 = icmp eq i64 %2, 32 ret i1 %3 } test1: and edi, 288 cmp rdi, 32 sete al ret (-O0's trunc LLVM IR instruction is eliminated) but codegen could use "cmp edi" instead of "cmp rdi": test1: and edi, 288 cmp edi, 32 sete al ret GCC does this code size optimization (eliminate REX prefix), Clang does not. Another opportunity for "cmp edi": bool test2(U64 val) { return (val & 0x120) == 0x20; } test2: and edi, 288 cmp rdi, 32 sete al ret Both GCC and Clang fails to use rdi for "test2" case. https://godbolt.org/z/A0hjTg Another case: bool test3(U64 val) { return ((short)(val & 0x120)) == 0x20; } Clang test3: # @test3 and edi, 288 cmp rdi, 32 sete al ret GCC test3: and di, 288 cmp di, 32 sete al ret
This issue was created automatically with bugzilla2github
Bugzilla Bug 5
Date: 2019-10-27T07:45:09+07:00 From: David Bolvansky <david.bolvansky@gmail.com> To: Unassigned LLVM Bugs <unassignedbugs@nondot.org> CC: @asl, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, @rotateright
Last updated: 2019-10-27T07:45:09+07:00