[PATCH] D90514: [WebAssembly] Prototype i64x2.bitmask
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 16:39:35 PDT 2020
tlively created this revision.
tlively added a reviewer: aheejin.
Herald added subscribers: llvm-commits, cfe-commits, wingo, ecnelises, sunfish, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added projects: clang, LLVM.
tlively requested review of this revision.
As proposed in https://github.com/WebAssembly/simd/pull/368.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D90514
Files:
clang/include/clang/Basic/BuiltinsWebAssembly.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/builtins-wasm.c
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
llvm/test/MC/WebAssembly/simd-encodings.s
Index: llvm/test/MC/WebAssembly/simd-encodings.s
===================================================================
--- llvm/test/MC/WebAssembly/simd-encodings.s
+++ llvm/test/MC/WebAssembly/simd-encodings.s
@@ -523,6 +523,9 @@
# CHECK: i64x2.all_true # encoding: [0xfd,0xc3,0x01]
i64x2.all_true
+ # CHECK: i64x2.bitmask # encoding: [0xfd,0xc4,0x01]
+ i64x2.bitmask
+
# CHECK: i64x2.widen_low_i32x4_s # encoding: [0xfd,0xc7,0x01]
i64x2.widen_low_i32x4_s
Index: llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
+++ llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
@@ -646,6 +646,16 @@
ret i32 %a
}
+; CHECK-LABEL: bitmask_v2i64:
+; SIMD128-NEXT: .functype bitmask_v2i64 (v128) -> (i32){{$}}
+; SIMD128-NEXT: i64x2.bitmask $push[[R:[0-9]+]]=, $0{{$}}
+; SIMD128-NEXT: return $pop[[R]]{{$}}
+declare i32 @llvm.wasm.bitmask.v2i64(<2 x i64>)
+define i32 @bitmask_v2i64(<2 x i64> %x) {
+ %a = call i32 @llvm.wasm.bitmask.v2i64(<2 x i64> %x)
+ ret i32 %a
+}
+
; CHECK-LABEL: bitselect_v2i64:
; SIMD128-NEXT: .functype bitselect_v2i64 (v128, v128, v128) -> (v128){{$}}
; SIMD128-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $0, $1, $2{{$}}
Index: llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
+++ llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
@@ -848,6 +848,7 @@
defm BITMASK : SIMDBitmask<v16i8, "i8x16", 100>;
defm BITMASK : SIMDBitmask<v8i16, "i16x8", 132>;
defm BITMASK : SIMDBitmask<v4i32, "i32x4", 164>;
+defm BITMASK : SIMDBitmask<v2i64, "i64x2", 196>;
//===----------------------------------------------------------------------===//
// Bit shifts
Index: clang/test/CodeGen/builtins-wasm.c
===================================================================
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -728,6 +728,12 @@
// WEBASSEMBLY: ret
}
+int bitmask_i64x2(i64x2 x) {
+ return __builtin_wasm_bitmask_i64x2(x);
+ // WEBASSEMBLY: call i32 @llvm.wasm.bitmask.v2i64(<2 x i64> %x)
+ // WEBASSEMBLY: ret
+}
+
f32x4 abs_f32x4(f32x4 x) {
return __builtin_wasm_abs_f32x4(x);
// WEBASSEMBLY: call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -16734,7 +16734,8 @@
}
case WebAssembly::BI__builtin_wasm_bitmask_i8x16:
case WebAssembly::BI__builtin_wasm_bitmask_i16x8:
- case WebAssembly::BI__builtin_wasm_bitmask_i32x4: {
+ case WebAssembly::BI__builtin_wasm_bitmask_i32x4:
+ case WebAssembly::BI__builtin_wasm_bitmask_i64x2: {
Value *Vec = EmitScalarExpr(E->getArg(0));
Function *Callee =
CGM.getIntrinsic(Intrinsic::wasm_bitmask, Vec->getType());
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===================================================================
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -154,6 +154,7 @@
TARGET_BUILTIN(__builtin_wasm_bitmask_i8x16, "iV16Sc", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_bitmask_i16x8, "iV8s", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_bitmask_i32x4, "iV4i", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_bitmask_i64x2, "iV2LLi", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_abs_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_abs_f64x2, "V2dV2d", "nc", "simd128")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90514.302041.patch
Type: text/x-patch
Size: 3688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201030/206ab5c5/attachment.bin>
More information about the llvm-commits
mailing list