https://llvm.org/bugs/show_bug.cgi?id=31275
Bug ID: 31275 Summary: Binary rotation is not detected after multiplication Product: clang Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: funny.fal...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified I found that clang produces bad code for rotation after multiplication. Although it generates good code, if multiplication is not last operation: // Type your code here, or load an example. #define rotl(x,n) (((x)<<(n))|((x)>>(32-(n)))) unsigned mult_rotl(unsigned num, unsigned mun) { return rotl(num*9, 7); } unsigned mult_add_rotl(unsigned num, unsigned mun) { return rotl(num*9+1, 7); } mult_rotl: leal (%rdi,%rdi,8), %eax shll $7, %edi leal (%rdi,%rdi,8), %ecx shrl $25, %eax orl %ecx, %eax retq mult_add_rotl: leal 1(%rdi,%rdi,8), %eax roll $7, %eax retq (probably, it is llvm-optimizer's issue) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs