[PATCH] D101803: [WebAssembly] Mark abs of v2i64 as legal
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 4 13:25:56 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG14ca2e5e22e7: [WebAssembly] Mark abs of v2i64 as legal (authored by tlively).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101803/new/
https://reviews.llvm.org/D101803
Files:
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/test/CodeGen/WebAssembly/simd-arith.ll
Index: llvm/test/CodeGen/WebAssembly/simd-arith.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/simd-arith.ll
+++ llvm/test/CodeGen/WebAssembly/simd-arith.ll
@@ -968,6 +968,18 @@
ret <2 x i64> %a
}
+; CHECK-LABEL: abs_v2i64:
+; NO-SIMD128-NOT: i64x2:
+; SIMD128-NEXT: .functype abs_v2i64 (v128) -> (v128){{$}}
+; SIMD128-NEXT: i64x2.abs $push[[R:[0-9]+]]=, $0{{$}}
+; SIMD128-NEXT: return $pop[[R]]{{$}}
+define <2 x i64> @abs_v2i64(<2 x i64> %x) {
+ %a = sub <2 x i64> zeroinitializer, %x
+ %b = icmp slt <2 x i64> %x, zeroinitializer
+ %c = select <2 x i1> %b, <2 x i64> %a, <2 x i64> %x
+ ret <2 x i64> %c
+}
+
; CHECK-LABEL: neg_v2i64:
; NO-SIMD128-NOT: i64x2
; SIMD128-NEXT: .functype neg_v2i64 (v128) -> (v128){{$}}
Index: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -149,7 +149,7 @@
setOperationAction(Op, T, Legal);
// Support integer abs
- for (auto T : {MVT::v16i8, MVT::v8i16, MVT::v4i32})
+ for (auto T : {MVT::v16i8, MVT::v8i16, MVT::v4i32, MVT::v2i64})
setOperationAction(ISD::ABS, T, Legal);
// Custom lower BUILD_VECTORs to minimize number of replace_lanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101803.342849.patch
Type: text/x-patch
Size: 1382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210504/b79840e5/attachment.bin>
More information about the llvm-commits
mailing list