[AArch64] Fix miscompile of sdiv-by-power-of-2.
authorJuergen Ributzka <juergen@apple.com>
Thu, 16 Oct 2014 16:41:15 +0000 (16:41 +0000)
committerJuergen Ributzka <juergen@apple.com>
Thu, 16 Oct 2014 16:41:15 +0000 (16:41 +0000)
commitc40dab20691fd33f49715104ea7182d3ce14d2b2
treec43bccaa2502d0a8ba37c2892f3158d9023823b9
parent3b72ec5083457366ae4b1c230ed1172f1e428dbe
[AArch64] Fix miscompile of sdiv-by-power-of-2.

When the constant divisor was larger than 32bits, then the optimized code
generated for the AArch64 backend would emit the wrong code, because the shift
was defined as a shift of a 32bit constant '(1<<Lg2(divisor))' and we would
loose the upper 32bits.

This fixes rdar://problem/18678801.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219934 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64FastISel.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp
test/CodeGen/AArch64/sdivpow2.ll