summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-05-14 02:15:47 +0000
committerDan Gohman <dan433584@gmail.com>2016-05-14 02:15:47 +0000
commita01e8bde579eaff8160688b6ca07d6e356dcec65 (patch)
tree49d25a4e44f9b8e736880507ad8ad5302cd0cd92 /llvm/lib/Target
parent9385d704c115891e0beae99f46cc1df2de8bc5f6 (diff)
downloadbcm5719-llvm-a01e8bde579eaff8160688b6ca07d6e356dcec65.tar.gz
bcm5719-llvm-a01e8bde579eaff8160688b6ca07d6e356dcec65.zip
[WebAssembly] Fix legalization of i128 shifts.
compiler-rt/libgcc shift routines expect the shift count to be an i32, so use i32 as the shift count for shifts that are legalized to libcalls. This also reverts r268991, now that the signatures are correct. llvm-svn: 269531
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 3292dc485d8..d43bf1ab8ec 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -135,13 +135,6 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
// Trap lowers to wasm unreachable
setOperationAction(ISD::TRAP, MVT::Other, Legal);
-
- // Disable 128-bit shift libcalls. Currently the signature of the functions
- // i128(i128, i32) aka void(i32, i64, i64, i32) doesn't match the signature
- // of the call emitted by the default lowering, void(i32, i64, i64).
- setLibcallName(RTLIB::SRL_I128, nullptr);
- setLibcallName(RTLIB::SRA_I128, nullptr);
- setLibcallName(RTLIB::SHL_I128, nullptr);
}
FastISel *WebAssemblyTargetLowering::createFastISel(
@@ -161,9 +154,11 @@ MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout & /*DL*/,
if (BitWidth > 1 && BitWidth < 8) BitWidth = 8;
if (BitWidth > 64) {
- BitWidth = 64;
+ // The shift will be lowered to a libcall, and compiler-rt libcalls expect
+ // the count to be an i32.
+ BitWidth = 32;
assert(BitWidth >= Log2_32_Ceil(VT.getSizeInBits()) &&
- "64-bit shift counts ought to be enough for anyone");
+ "32-bit shift counts ought to be enough for anyone");
}
MVT Result = MVT::getIntegerVT(BitWidth);
OpenPOWER on IntegriCloud