[llvm] 990b11c - [SVE] Precommit multiuse predicated compare tests.
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 16:56:18 PST 2023
Author: Paul Walker
Date: 2023-03-10T00:55:11Z
New Revision: 990b11c5070e3258e067060c7aff8e02c6dbbcab
URL: https://github.com/llvm/llvm-project/commit/990b11c5070e3258e067060c7aff8e02c6dbbcab
DIFF: https://github.com/llvm/llvm-project/commit/990b11c5070e3258e067060c7aff8e02c6dbbcab.diff
LOG: [SVE] Precommit multiuse predicated compare tests.
Added:
Modified:
llvm/test/CodeGen/AArch64/sve-fcmp.ll
llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/sve-fcmp.ll b/llvm/test/CodeGen/AArch64/sve-fcmp.ll
index f4b38cf771f01..5cb44b1ee2e79 100644
--- a/llvm/test/CodeGen/AArch64/sve-fcmp.ll
+++ b/llvm/test/CodeGen/AArch64/sve-fcmp.ll
@@ -486,3 +486,61 @@ define <vscale x 2 x i1> @une_zero_pred(<vscale x 2 x i1> %pg, <vscale x 2 x dou
%z = and <vscale x 2 x i1> %pg, %y
ret <vscale x 2 x i1> %z
}
+
+%svboolx2 = type { <vscale x 4 x i1>, <vscale x 4 x i1> }
+
+define %svboolx2 @and_of_multiuse_fcmp_ogt(<vscale x 4 x i1> %pg, <vscale x 4 x float> %x, <vscale x 4 x float> %y) {
+; CHECK-LABEL: and_of_multiuse_fcmp_ogt:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: fcmgt p0.s, p0/z, z0.s, z1.s
+; CHECK-NEXT: fcmgt p1.s, p1/z, z0.s, z1.s
+; CHECK-NEXT: ret
+ %cmp = fcmp ogt <vscale x 4 x float> %x, %y
+ %and = and <vscale x 4 x i1> %pg, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_fcmp_ogt_zero(<vscale x 4 x i1> %pg, <vscale x 4 x float> %x) {
+; CHECK-LABEL: and_of_multiuse_fcmp_ogt_zero:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: fcmgt p0.s, p0/z, z0.s, #0.0
+; CHECK-NEXT: fcmgt p1.s, p1/z, z0.s, #0.0
+; CHECK-NEXT: ret
+ %cmp = fcmp ogt <vscale x 4 x float> %x, zeroinitializer
+ %and = and <vscale x 4 x i1> %pg, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_fcmp_olt(<vscale x 4 x i1> %pg, <vscale x 4 x float> %x, <vscale x 4 x float> %y) {
+; CHECK-LABEL: and_of_multiuse_fcmp_olt:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: fcmgt p0.s, p0/z, z1.s, z0.s
+; CHECK-NEXT: fcmgt p1.s, p1/z, z1.s, z0.s
+; CHECK-NEXT: ret
+ %cmp = fcmp olt <vscale x 4 x float> %x, %y
+ %and = and <vscale x 4 x i1> %pg, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_fcmp_olt_zero(<vscale x 4 x i1> %pg, <vscale x 4 x float> %x) {
+; CHECK-LABEL: and_of_multiuse_fcmp_olt_zero:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: fcmlt p0.s, p0/z, z0.s, #0.0
+; CHECK-NEXT: fcmlt p1.s, p1/z, z0.s, #0.0
+; CHECK-NEXT: ret
+ %cmp = fcmp olt <vscale x 4 x float> %x, zeroinitializer
+ %and = and <vscale x 4 x i1> %pg, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
diff --git a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll
index be1eecee8507e..ee5969e854376 100644
--- a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll
+++ b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll
@@ -1037,10 +1037,11 @@ define <vscale x 2 x i1> @cmpne_ir_d(<vscale x 2 x i64> %a, <vscale x 2 x i64> %
define <vscale x 1 x i1> @cmpne_ir_q(<vscale x 1 x i64> %a, <vscale x 1 x i64> %b) {
; CHECK-LABEL: cmpne_ir_q:
-; CHECK: ptrue p0.d
-; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, z1.d
-; CHECK-NEXT: punpklo p0.h, p0.b
-; CHECK-NEXT: ret
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p0.d
+; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, z1.d
+; CHECK-NEXT: punpklo p0.h, p0.b
+; CHECK-NEXT: ret
%out = icmp ne <vscale x 1 x i64> %a, %b
ret <vscale x 1 x i1> %out
}
@@ -1216,6 +1217,66 @@ define <vscale x 8 x i1> @predicated_icmp_ult_imm(<vscale x 8 x i1> %a, <vscale
ret <vscale x 8 x i1> %and
}
+%svboolx2 = type { <vscale x 4 x i1>, <vscale x 4 x i1> }
+
+define %svboolx2 @and_of_multiuse_icmp_sle(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c) {
+; CHECK-LABEL: and_of_multiuse_icmp_sle:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: cmpge p0.s, p0/z, z1.s, z0.s
+; CHECK-NEXT: cmpge p1.s, p1/z, z1.s, z0.s
+; CHECK-NEXT: ret
+ %cmp = icmp sle <vscale x 4 x i32> %b, %c
+ %and = and <vscale x 4 x i1> %a, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_icmp_sle_imm(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b) {
+; CHECK-LABEL: and_of_multiuse_icmp_sle_imm:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: cmple p0.s, p0/z, z0.s, #1
+; CHECK-NEXT: cmple p1.s, p1/z, z0.s, #1
+; CHECK-NEXT: ret
+ %imm = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i64 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
+ %cmp = icmp sle <vscale x 4 x i32> %b, %imm
+ %and = and <vscale x 4 x i1> %a, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_icmp_ugt(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c) {
+; CHECK-LABEL: and_of_multiuse_icmp_ugt:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: cmphi p0.s, p0/z, z0.s, z1.s
+; CHECK-NEXT: cmphi p1.s, p1/z, z0.s, z1.s
+; CHECK-NEXT: ret
+ %cmp = icmp ugt <vscale x 4 x i32> %b, %c
+ %and = and <vscale x 4 x i1> %a, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
+define %svboolx2 @and_of_multiuse_icmp_ugt_imm(<vscale x 4 x i1> %a, <vscale x 4 x i32> %b) {
+; CHECK-LABEL: and_of_multiuse_icmp_ugt_imm:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p1.s
+; CHECK-NEXT: cmphi p0.s, p0/z, z0.s, #1
+; CHECK-NEXT: cmphi p1.s, p1/z, z0.s, #1
+; CHECK-NEXT: ret
+ %imm = shufflevector <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i64 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
+ %cmp = icmp ugt <vscale x 4 x i32> %b, %imm
+ %and = and <vscale x 4 x i1> %a, %cmp
+ %ins.1 = insertvalue %svboolx2 poison, <vscale x 4 x i1> %and, 0
+ %ins.2 = insertvalue %svboolx2 %ins.1, <vscale x 4 x i1> %cmp, 1
+ ret %svboolx2 %ins.2
+}
+
declare <vscale x 16 x i1> @llvm.aarch64.sve.cmpeq.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>)
declare <vscale x 8 x i1> @llvm.aarch64.sve.cmpeq.nxv8i16(<vscale x 8 x i1>, <vscale x 8 x i16>, <vscale x 8 x i16>)
declare <vscale x 4 x i1> @llvm.aarch64.sve.cmpeq.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, <vscale x 4 x i32>)
More information about the llvm-commits
mailing list