r345300 - [WebAssembly] Lower to target-independent saturating add
Thomas Lively via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 25 12:06:15 PDT 2018
Author: tlively
Date: Thu Oct 25 12:06:15 2018
New Revision: 345300
URL: http://llvm.org/viewvc/llvm-project?rev=345300&view=rev
Log:
[WebAssembly] Lower to target-independent saturating add
Summary: Goes along with D53721.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits
Differential Revision: https://reviews.llvm.org/D53722
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins-wasm.c
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=345300&r1=345299&r2=345300&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 25 12:06:15 2018
@@ -12614,11 +12614,11 @@ Value *CodeGenFunction::EmitWebAssemblyB
switch (BuiltinID) {
case WebAssembly::BI__builtin_wasm_add_saturate_s_i8x16:
case WebAssembly::BI__builtin_wasm_add_saturate_s_i16x8:
- IntNo = Intrinsic::wasm_add_saturate_signed;
+ IntNo = Intrinsic::sadd_sat;
break;
case WebAssembly::BI__builtin_wasm_add_saturate_u_i8x16:
case WebAssembly::BI__builtin_wasm_add_saturate_u_i16x8:
- IntNo = Intrinsic::wasm_add_saturate_unsigned;
+ IntNo = Intrinsic::uadd_sat;
break;
case WebAssembly::BI__builtin_wasm_sub_saturate_s_i8x16:
case WebAssembly::BI__builtin_wasm_sub_saturate_s_i16x8:
Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=345300&r1=345299&r2=345300&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Thu Oct 25 12:06:15 2018
@@ -223,28 +223,28 @@ f64x2 replace_lane_f64x2(f64x2 v, double
i8x16 add_saturate_s_i8x16(i8x16 x, i8x16 y) {
return __builtin_wasm_add_saturate_s_i8x16(x, y);
- // WEBASSEMBLY: call <16 x i8> @llvm.wasm.add.saturate.signed.v16i8(
+ // WEBASSEMBLY: call <16 x i8> @llvm.sadd.sat.v16i8(
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
// WEBASSEMBLY-NEXT: ret
}
i8x16 add_saturate_u_i8x16(i8x16 x, i8x16 y) {
return __builtin_wasm_add_saturate_u_i8x16(x, y);
- // WEBASSEMBLY: call <16 x i8> @llvm.wasm.add.saturate.unsigned.v16i8(
+ // WEBASSEMBLY: call <16 x i8> @llvm.uadd.sat.v16i8(
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
// WEBASSEMBLY-NEXT: ret
}
i16x8 add_saturate_s_i16x8(i16x8 x, i16x8 y) {
return __builtin_wasm_add_saturate_s_i16x8(x, y);
- // WEBASSEMBLY: call <8 x i16> @llvm.wasm.add.saturate.signed.v8i16(
+ // WEBASSEMBLY: call <8 x i16> @llvm.sadd.sat.v8i16(
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
// WEBASSEMBLY-NEXT: ret
}
i16x8 add_saturate_u_i16x8(i16x8 x, i16x8 y) {
return __builtin_wasm_add_saturate_u_i16x8(x, y);
- // WEBASSEMBLY: call <8 x i16> @llvm.wasm.add.saturate.unsigned.v8i16(
+ // WEBASSEMBLY: call <8 x i16> @llvm.uadd.sat.v8i16(
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
// WEBASSEMBLY-NEXT: ret
}
More information about the cfe-commits
mailing list