[llvm] 4d513f2 - [AArch] add tests for vselect; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 5 12:02:22 PDT 2021
Author: Sanjay Patel
Date: 2021-11-05T15:02:12-04:00
New Revision: 4d513f2527ffe1cc279012bbc8008671194429c1
URL: https://github.com/llvm/llvm-project/commit/4d513f2527ffe1cc279012bbc8008671194429c1
DIFF: https://github.com/llvm/llvm-project/commit/4d513f2527ffe1cc279012bbc8008671194429c1.diff
LOG: [AArch] add tests for vselect; NFC
These are copy/pasted from the related test patterns in D113212.
Added:
Modified:
llvm/test/CodeGen/AArch64/vselect-constants.ll
llvm/test/CodeGen/Thumb2/mve-vselect-constants.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/vselect-constants.ll b/llvm/test/CodeGen/AArch64/vselect-constants.ll
index 130385d1bf18..f655a0dca23c 100644
--- a/llvm/test/CodeGen/AArch64/vselect-constants.ll
+++ b/llvm/test/CodeGen/AArch64/vselect-constants.ll
@@ -236,3 +236,47 @@ define <2 x i64> @signbit_mask_v2i64(<2 x i64> %a, <2 x i64> %b) {
%r = select <2 x i1> %cond, <2 x i64> %b, <2 x i64> zeroinitializer
ret <2 x i64> %r
}
+
+define <16 x i8> @signbit_setmask_v16i8(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: signbit_setmask_v16i8:
+; CHECK: // %bb.0:
+; CHECK-NEXT: cmlt v0.16b, v0.16b, #0
+; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
+; CHECK-NEXT: ret
+ %cond = icmp slt <16 x i8> %a, zeroinitializer
+ %r = select <16 x i1> %cond, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8> %b
+ ret <16 x i8> %r
+}
+
+define <8 x i16> @signbit_setmask_v8i16(<8 x i16> %a, <8 x i16> %b) {
+; CHECK-LABEL: signbit_setmask_v8i16:
+; CHECK: // %bb.0:
+; CHECK-NEXT: cmlt v0.8h, v0.8h, #0
+; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
+; CHECK-NEXT: ret
+ %cond = icmp slt <8 x i16> %a, zeroinitializer
+ %r = select <8 x i1> %cond, <8 x i16> <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>, <8 x i16> %b
+ ret <8 x i16> %r
+}
+
+define <4 x i32> @signbit_setmask_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: signbit_setmask_v4i32:
+; CHECK: // %bb.0:
+; CHECK-NEXT: cmlt v0.4s, v0.4s, #0
+; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
+; CHECK-NEXT: ret
+ %cond = icmp slt <4 x i32> %a, zeroinitializer
+ %r = select <4 x i1> %cond, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32> %b
+ ret <4 x i32> %r
+}
+
+define <2 x i64> @signbit_setmask_v2i64(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: signbit_setmask_v2i64:
+; CHECK: // %bb.0:
+; CHECK-NEXT: cmlt v0.2d, v0.2d, #0
+; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
+; CHECK-NEXT: ret
+ %cond = icmp slt <2 x i64> %a, zeroinitializer
+ %r = select <2 x i1> %cond, <2 x i64> <i64 -1, i64 -1>, <2 x i64> %b
+ ret <2 x i64> %r
+}
diff --git a/llvm/test/CodeGen/Thumb2/mve-vselect-constants.ll b/llvm/test/CodeGen/Thumb2/mve-vselect-constants.ll
index 4f2acda375fe..1c89c55173db 100644
--- a/llvm/test/CodeGen/Thumb2/mve-vselect-constants.ll
+++ b/llvm/test/CodeGen/Thumb2/mve-vselect-constants.ll
@@ -183,3 +183,55 @@ define arm_aapcs_vfpcc <2 x i64> @signbit_mask_v2i64(<2 x i64> %a, <2 x i64> %b)
ret <2 x i64> %r
}
+define arm_aapcs_vfpcc <16 x i8> @signbit_setmask_v16i8(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: signbit_setmask_v16i8:
+; CHECK: @ %bb.0:
+; CHECK-NEXT: vmov.i8 q2, #0xff
+; CHECK-NEXT: vcmp.s8 lt, q0, zr
+; CHECK-NEXT: vpsel q0, q2, q1
+; CHECK-NEXT: bx lr
+ %cond = icmp slt <16 x i8> %a, zeroinitializer
+ %r = select <16 x i1> %cond, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8> %b
+ ret <16 x i8> %r
+}
+
+define arm_aapcs_vfpcc <8 x i16> @signbit_setmask_v8i16(<8 x i16> %a, <8 x i16> %b) {
+; CHECK-LABEL: signbit_setmask_v8i16:
+; CHECK: @ %bb.0:
+; CHECK-NEXT: vmov.i8 q2, #0xff
+; CHECK-NEXT: vcmp.s16 lt, q0, zr
+; CHECK-NEXT: vpsel q0, q2, q1
+; CHECK-NEXT: bx lr
+ %cond = icmp slt <8 x i16> %a, zeroinitializer
+ %r = select <8 x i1> %cond, <8 x i16> <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>, <8 x i16> %b
+ ret <8 x i16> %r
+}
+
+define arm_aapcs_vfpcc <4 x i32> @signbit_setmask_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: signbit_setmask_v4i32:
+; CHECK: @ %bb.0:
+; CHECK-NEXT: vmov.i8 q2, #0xff
+; CHECK-NEXT: vcmp.s32 lt, q0, zr
+; CHECK-NEXT: vpsel q0, q2, q1
+; CHECK-NEXT: bx lr
+ %cond = icmp slt <4 x i32> %a, zeroinitializer
+ %r = select <4 x i1> %cond, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32> %b
+ ret <4 x i32> %r
+}
+
+define arm_aapcs_vfpcc <2 x i64> @signbit_setmask_v2i64(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: signbit_setmask_v2i64:
+; CHECK: @ %bb.0:
+; CHECK-NEXT: vmov r0, s3
+; CHECK-NEXT: vmov r1, s1
+; CHECK-NEXT: asrs r0, r0, #31
+; CHECK-NEXT: asrs r1, r1, #31
+; CHECK-NEXT: vmov q0[2], q0[0], r1, r0
+; CHECK-NEXT: vmov q0[3], q0[1], r1, r0
+; CHECK-NEXT: vorr q0, q1, q0
+; CHECK-NEXT: bx lr
+ %cond = icmp slt <2 x i64> %a, zeroinitializer
+ %r = select <2 x i1> %cond, <2 x i64> <i64 -1, i64 -1>, <2 x i64> %b
+ ret <2 x i64> %r
+}
+
More information about the llvm-commits
mailing list