https://bugs.llvm.org/show_bug.cgi?id=52481
Bug ID: 52481
Summary: Instconsistent sdiv and srem by pow2 codegen under Oz
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: craig.top...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, pengfei.w...@intel.com,
spatel+l...@rotateright.com
There seems to be an ordering issue in our handling of sdiv/srem by constant
handling under -Oz.
These two test cases produce different code just from reordering the div and
rem
int foo(int x, int *rem) {
*rem = x % 256;
return x / 256;
}
int bar(int x, int *div) {
*div = x / 256;
return x % 256;
}
foo: # @foo
mov ecx, 256
mov eax, edi
cdq
idiv ecx
mov ecx, eax
shl ecx, 8
sub edi, ecx
mov dword ptr [rsi], edi
ret
bar: # @bar
mov eax, edi
mov ecx, 256
cdq
idiv ecx
mov dword ptr [rsi], eax
mov eax, edx
ret
bar is using the remainder from the idiv, while foo is using the quotient to
compute the remainder.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs