You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: llvm/test/CodeGen/RISCV/rvv/vl-opt.ll
+40-4Lines changed: 40 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,8 @@ define <vscale x 4 x i32> @different_vl_with_ta(<vscale x 4 x i32> %a, <vscale x
107
107
ret <vscale x 4 x i32> %w
108
108
}
109
109
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).
111
112
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) {
112
113
; CHECK-LABEL: different_vl_with_tu:
113
114
; CHECK: # %bb.0:
@@ -118,11 +119,12 @@ define <vscale x 4 x i32> @different_vl_with_tu(<vscale x 4 x i32> %passthru, <v
118
119
; CHECK-NEXT: vadd.vv v8, v14, v10
119
120
; CHECK-NEXT: ret
120
121
%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)
122
123
ret <vscale x 4 x i32> %w
123
124
}
124
125
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).
126
128
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) {
127
129
; CHECK-LABEL: different_imm_vl_with_tu:
128
130
; CHECK: # %bb.0:
@@ -133,7 +135,41 @@ define <vscale x 4 x i32> @different_imm_vl_with_tu(<vscale x 4 x i32> %passthru
133
135
; CHECK-NEXT: vadd.vv v8, v14, v10
134
136
; CHECK-NEXT: ret
135
137
%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)
0 commit comments