Skip to content

Commit a755bba

Browse files
committed
Precommit tests
1 parent b2647ff commit a755bba

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

llvm/test/CodeGen/RISCV/rvv/vl-opt.ll

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ define <vscale x 4 x i32> @different_vl_with_ta(<vscale x 4 x i32> %a, <vscale x
107107
ret <vscale x 4 x i32> %w
108108
}
109109

110-
; Test case to make sure VL won't propgate if using tail-undisturbed policy.
110+
; We can propagate VL to a tail-undisturbed policy, provided none of its users
111+
; are passthrus (i.e. read past VL).
111112
define <vscale x 4 x i32> @different_vl_with_tu(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1, iXLen %vl2) {
112113
; CHECK-LABEL: different_vl_with_tu:
113114
; CHECK: # %bb.0:
@@ -118,11 +119,12 @@ define <vscale x 4 x i32> @different_vl_with_tu(<vscale x 4 x i32> %passthru, <v
118119
; CHECK-NEXT: vadd.vv v8, v14, v10
119120
; CHECK-NEXT: ret
120121
%v = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1)
121-
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %v, <vscale x 4 x i32> %a,iXLen %vl2)
122+
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %v, <vscale x 4 x i32> %a, iXLen %vl2)
122123
ret <vscale x 4 x i32> %w
123124
}
124125

125-
; Test case to make sure VL won't propgate if using tail-undisturbed policy.
126+
; We can propagate VL to a tail-undisturbed policy, provided none of its users
127+
; are passthrus (i.e. read past VL).
126128
define <vscale x 4 x i32> @different_imm_vl_with_tu(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1, iXLen %vl2) {
127129
; CHECK-LABEL: different_imm_vl_with_tu:
128130
; CHECK: # %bb.0:
@@ -133,7 +135,41 @@ define <vscale x 4 x i32> @different_imm_vl_with_tu(<vscale x 4 x i32> %passthru
133135
; CHECK-NEXT: vadd.vv v8, v14, v10
134136
; CHECK-NEXT: ret
135137
%v = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen 5)
136-
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %v, <vscale x 4 x i32> %a,iXLen 4)
138+
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %v, <vscale x 4 x i32> %a, iXLen 4)
139+
ret <vscale x 4 x i32> %w
140+
}
141+
142+
; We can't reduce the VL as %v is used as a passthru, i.e. the elements past VL
143+
; are demanded.
144+
define <vscale x 4 x i32> @different_vl_as_passthru(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1, iXLen %vl2) {
145+
; CHECK-LABEL: different_vl_as_passthru:
146+
; CHECK: # %bb.0:
147+
; CHECK-NEXT: vsetvli zero, a0, e32, m2, tu, ma
148+
; CHECK-NEXT: vmv2r.v v12, v8
149+
; CHECK-NEXT: vadd.vv v12, v8, v10
150+
; CHECK-NEXT: vsetvli zero, a1, e32, m2, tu, ma
151+
; CHECK-NEXT: vadd.vv v12, v8, v10
152+
; CHECK-NEXT: vmv2r.v v8, v12
153+
; CHECK-NEXT: ret
154+
%v = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1)
155+
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %v, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl2)
156+
ret <vscale x 4 x i32> %w
157+
}
158+
159+
; We can't reduce the VL as %v is used as a passthru, i.e. the elements past VL
160+
; are demanded.
161+
define <vscale x 4 x i32> @different_imm_vl_as_passthru(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1, iXLen %vl2) {
162+
; CHECK-LABEL: different_imm_vl_as_passthru:
163+
; CHECK: # %bb.0:
164+
; CHECK-NEXT: vsetivli zero, 5, e32, m2, tu, ma
165+
; CHECK-NEXT: vmv2r.v v12, v8
166+
; CHECK-NEXT: vadd.vv v12, v8, v10
167+
; CHECK-NEXT: vsetivli zero, 4, e32, m2, tu, ma
168+
; CHECK-NEXT: vadd.vv v12, v8, v10
169+
; CHECK-NEXT: vmv2r.v v8, v12
170+
; CHECK-NEXT: ret
171+
%v = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen 5)
172+
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %v, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen 4)
137173
ret <vscale x 4 x i32> %w
138174
}
139175

0 commit comments

Comments
 (0)