Skip to content

Commit 7dad7ab

Browse files
authored
Scalarizer: add negative test for lrint, llrint (#70203)
With the recent change 98c90a1 (ISel: introduce vector ISD::LRINT, ISD::LLRINT; custom RISCV lowering), it is now possible to scalarize llvm.lrint and llvm.llrint with a trivial change to VectorUtils. In preparation for this change, and the corresponding test update, add a negative test for lrint and llrint.
1 parent aa30018 commit 7dad7ab

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Transforms/Scalarizer/intrinsics.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ declare <2 x float> @llvm.powi.v2f32.i32(<2 x float>, i32)
2525
declare <2 x i32> @llvm.smul.fix.sat.v2i32(<2 x i32>, <2 x i32>, i32)
2626
declare <2 x i32> @llvm.umul.fix.sat.v2i32(<2 x i32>, <2 x i32>, i32)
2727

28+
; Unary fp operand, int return type
2829
declare <2 x i32> @llvm.fptosi.sat.v2i32.v2f32(<2 x float>)
2930
declare <2 x i32> @llvm.fptoui.sat.v2i32.v2f32(<2 x float>)
3031

32+
; Unary fp operand, int return type
33+
declare <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float>)
34+
declare <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float>)
35+
3136
; Bool return type, overloaded on fp operand type
3237
declare <2 x i1> @llvm.is.fpclass(<2 x float>, i32)
3338

@@ -210,6 +215,24 @@ define <2 x i32> @scalarize_fptoui_sat(<2 x float> %x) #0 {
210215
ret <2 x i32> %sat
211216
}
212217

218+
define <2 x i32> @scalarize_lrint(<2 x float> %x) #0 {
219+
; CHECK-LABEL: @scalarize_lrint(
220+
; CHECK-NEXT: [[RND:%.*]] = call <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float> [[X:%.*]])
221+
; CHECK-NEXT: ret <2 x i32> [[RND]]
222+
;
223+
%rnd = call <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float> %x)
224+
ret <2 x i32> %rnd
225+
}
226+
227+
define <2 x i32> @scalarize_llrint(<2 x float> %x) #0 {
228+
; CHECK-LABEL: @scalarize_llrint(
229+
; CHECK-NEXT: [[RND:%.*]] = call <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float> [[X:%.*]])
230+
; CHECK-NEXT: ret <2 x i32> [[RND]]
231+
;
232+
%rnd = call <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float> %x)
233+
ret <2 x i32> %rnd
234+
}
235+
213236
define <2 x i1> @scalarize_is_fpclass(<2 x float> %x) #0 {
214237
; CHECK-LABEL: @scalarize_is_fpclass(
215238
; CHECK-NEXT: [[X_I0:%.*]] = extractelement <2 x float> [[X:%.*]], i64 0

0 commit comments

Comments
 (0)