[llvm] fa3783c - [RISCV] Test coverage for missing commute of vsadd(u)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 09:11:51 PDT 2022
Author: Philip Reames
Date: 2022-07-07T09:11:44-07:00
New Revision: fa3783c907358b8ffbfd81e3967831b634a0a10c
URL: https://github.com/llvm/llvm-project/commit/fa3783c907358b8ffbfd81e3967831b634a0a10c
DIFF: https://github.com/llvm/llvm-project/commit/fa3783c907358b8ffbfd81e3967831b634a0a10c.diff
LOG: [RISCV] Test coverage for missing commute of vsadd(u)
For some reason, this appears to only happen with fixed length vectors. Scalable ones commute just fine in all the cases I've seen.
Added:
Modified:
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsadd.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsaddu.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsadd.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsadd.ll
index d6aeb0be202d..a2d636f66538 100644
--- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsadd.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsadd.ll
@@ -316,6 +316,19 @@ define <2 x i32> @sadd_v2i32_vx(<2 x i32> %va, i32 %b) {
ret <2 x i32> %v
}
+define <2 x i32> @sadd_v2i32_vx_commute(<2 x i32> %va, i32 %b) {
+; CHECK-LABEL: sadd_v2i32_vx_commute:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, mu
+; CHECK-NEXT: vmv.v.x v9, a0
+; CHECK-NEXT: vsadd.vv v8, v9, v8
+; CHECK-NEXT: ret
+ %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
+ %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
+ %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %vb, <2 x i32> %va)
+ ret <2 x i32> %v
+}
+
define <2 x i32> @sadd_v2i32_vi(<2 x i32> %va) {
; CHECK-LABEL: sadd_v2i32_vi:
; CHECK: # %bb.0:
diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsaddu.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsaddu.ll
index a701f83ed3eb..a224bb5192a5 100644
--- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsaddu.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsaddu.ll
@@ -316,6 +316,19 @@ define <2 x i32> @uadd_v2i32_vx(<2 x i32> %va, i32 %b) {
ret <2 x i32> %v
}
+define <2 x i32> @uadd_v2i32_vx_commute(<2 x i32> %va, i32 %b) {
+; CHECK-LABEL: uadd_v2i32_vx_commute:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, mu
+; CHECK-NEXT: vmv.v.x v9, a0
+; CHECK-NEXT: vsaddu.vv v8, v9, v8
+; CHECK-NEXT: ret
+ %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
+ %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
+ %v = call <2 x i32> @llvm.uadd.sat.v2i32(<2 x i32> %vb, <2 x i32> %va)
+ ret <2 x i32> %v
+}
+
define <2 x i32> @uadd_v2i32_vi(<2 x i32> %va) {
; CHECK-LABEL: uadd_v2i32_vi:
; CHECK: # %bb.0:
More information about the llvm-commits
mailing list