[llvm] Scalarizer: add negative test for lrint, llrint (PR #70203)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 05:41:26 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

With the recent change 98c90a13 (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.

---
Full diff: https://github.com/llvm/llvm-project/pull/70203.diff


1 Files Affected:

- (modified) llvm/test/Transforms/Scalarizer/intrinsics.ll (+23) 


``````````diff
diff --git a/llvm/test/Transforms/Scalarizer/intrinsics.ll b/llvm/test/Transforms/Scalarizer/intrinsics.ll
index f58e50e40df2f70..f5e5be1f5998e00 100644
--- a/llvm/test/Transforms/Scalarizer/intrinsics.ll
+++ b/llvm/test/Transforms/Scalarizer/intrinsics.ll
@@ -25,9 +25,14 @@ declare <2 x float> @llvm.powi.v2f32.i32(<2 x float>, i32)
 declare <2 x i32> @llvm.smul.fix.sat.v2i32(<2 x i32>, <2 x i32>, i32)
 declare <2 x i32> @llvm.umul.fix.sat.v2i32(<2 x i32>, <2 x i32>, i32)
 
+; Unary fp operand, int return type
 declare <2 x i32> @llvm.fptosi.sat.v2i32.v2f32(<2 x float>)
 declare <2 x i32> @llvm.fptoui.sat.v2i32.v2f32(<2 x float>)
 
+; Unary fp operand, int return type
+declare <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float>)
+declare <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float>)
+
 ; Bool return type, overloaded on fp operand type
 declare <2 x i1> @llvm.is.fpclass(<2 x float>, i32)
 
@@ -210,6 +215,24 @@ define <2 x i32> @scalarize_fptoui_sat(<2 x float> %x) #0 {
   ret <2 x i32> %sat
 }
 
+define <2 x i32> @scalarize_lrint(<2 x float> %x) #0 {
+; CHECK-LABEL: @scalarize_lrint(
+; CHECK-NEXT:    [[RND:%.*]] = call <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float> [[X:%.*]])
+; CHECK-NEXT:    ret <2 x i32> [[RND]]
+;
+  %rnd = call <2 x i32> @llvm.lrint.v2i32.v2f32(<2 x float> %x)
+  ret <2 x i32> %rnd
+}
+
+define <2 x i32> @scalarize_llrint(<2 x float> %x) #0 {
+; CHECK-LABEL: @scalarize_llrint(
+; CHECK-NEXT:    [[RND:%.*]] = call <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float> [[X:%.*]])
+; CHECK-NEXT:    ret <2 x i32> [[RND]]
+;
+  %rnd = call <2 x i32> @llvm.llrint.v2i32.v2f32(<2 x float> %x)
+  ret <2 x i32> %rnd
+}
+
 define <2 x i1> @scalarize_is_fpclass(<2 x float> %x) #0 {
 ; CHECK-LABEL: @scalarize_is_fpclass(
 ; CHECK-NEXT:    [[X_I0:%.*]] = extractelement <2 x float> [[X:%.*]], i64 0

``````````

</details>


https://github.com/llvm/llvm-project/pull/70203


More information about the llvm-commits mailing list