[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)
commit03a0611061448f1133229c37e18d2ffa629ace7a
treefd693e81c26a9ce50c59310b787beb9b7b0a0835
parent04ee8aa1fc35009836dc24a0c9c56b1fd5a32378
[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.

llvm-svn: 219934
llvm/lib/Target/AArch64/AArch64FastISel.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/sdivpow2.ll