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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 09:27:16 PDT 2023


Author: Ramkumar Ramachandra
Date: 2023-10-25T17:27:12+01:00
New Revision: 7dad7ab3c0d29fb9c6b0cf591889789a3cdbcc0a

URL: https://github.com/llvm/llvm-project/commit/7dad7ab3c0d29fb9c6b0cf591889789a3cdbcc0a
DIFF: https://github.com/llvm/llvm-project/commit/7dad7ab3c0d29fb9c6b0cf591889789a3cdbcc0a.diff

LOG: Scalarizer: add negative test for lrint, llrint (#70203)

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.

Added: 
    

Modified: 
    llvm/test/Transforms/Scalarizer/intrinsics.ll

Removed: 
    


################################################################################
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


        


More information about the llvm-commits mailing list