From 5b464f2aa514903cad2f2160dd613b74b0cee3da Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 28 Oct 2020 10:22:43 -0700 Subject: [PATCH] [WebAssembly] Fix incorrectly named target builtin Rename __builtin_wasm_q15mulr_saturate_s_i8x16 to __builtin_wasm_q15mulr_saturate_s_i16x8, fixing the implied lane interpretation of the result. --- clang/include/clang/Basic/BuiltinsWebAssembly.def | 2 +- clang/lib/CodeGen/CGBuiltin.cpp | 2 +- clang/test/CodeGen/builtins-wasm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def b/clang/include/clang/Basic/BuiltinsWebAssembly.def index 1ee9781..e86346d 100644 --- a/clang/include/clang/Basic/BuiltinsWebAssembly.def +++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -116,7 +116,7 @@ TARGET_BUILTIN(__builtin_wasm_avgr_u_i16x8, "V8UsV8UsV8Us", "nc", "simd128") TARGET_BUILTIN(__builtin_wasm_popcnt_i8x16, "V16ScV16Sc", "nc", "simd128") -TARGET_BUILTIN(__builtin_wasm_q15mulr_saturate_s_i8x16, "V8sV8sV8s", "nc", "simd128") +TARGET_BUILTIN(__builtin_wasm_q15mulr_saturate_s_i16x8, "V8sV8sV8s", "nc", "simd128") TARGET_BUILTIN(__builtin_wasm_extmul_low_i8x16_s_i16x8, "V8sV16ScV16Sc", "nc", "simd128") TARGET_BUILTIN(__builtin_wasm_extmul_high_i8x16_s_i16x8, "V8sV16ScV16Sc", "nc", "simd128") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index fbfd56f..6f7505b 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -16593,7 +16593,7 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, ConvertType(E->getType())); return Builder.CreateCall(Callee, {LHS, RHS}); } - case WebAssembly::BI__builtin_wasm_q15mulr_saturate_s_i8x16: { + case WebAssembly::BI__builtin_wasm_q15mulr_saturate_s_i16x8: { Value *LHS = EmitScalarExpr(E->getArg(0)); Value *RHS = EmitScalarExpr(E->getArg(1)); Function *Callee = diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index be61e9e4..ee63531 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -519,7 +519,7 @@ u16x8 avgr_u_i16x8(u16x8 x, u16x8 y) { } i16x8 q15mulr_saturate_s_i16x8(i16x8 x, i16x8 y) { - return __builtin_wasm_q15mulr_saturate_s_i8x16(x, y); + return __builtin_wasm_q15mulr_saturate_s_i16x8(x, y); // WEBASSEMBLY: call <8 x i16> @llvm.wasm.q15mulr.saturate.signed( // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y) // WEBASSEMBLY-NEXT: ret -- 2.7.4