[llvm] 0778b5d - [InstCombine] Add test for computeConstantRange() with non-splat poison (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 06:19:34 PDT 2024


Author: Nikita Popov
Date: 2024-07-03T15:19:26+02:00
New Revision: 0778b5d0d296edaca2ac52f2c8d2c806d492355a

URL: https://github.com/llvm/llvm-project/commit/0778b5d0d296edaca2ac52f2c8d2c806d492355a
DIFF: https://github.com/llvm/llvm-project/commit/0778b5d0d296edaca2ac52f2c8d2c806d492355a.diff

LOG: [InstCombine] Add test for computeConstantRange() with non-splat poison (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/saturating-add-sub.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/saturating-add-sub.ll b/llvm/test/Transforms/InstCombine/saturating-add-sub.ll
index 57977a72cd08f..5a29ee7f66e35 100644
--- a/llvm/test/Transforms/InstCombine/saturating-add-sub.ll
+++ b/llvm/test/Transforms/InstCombine/saturating-add-sub.ll
@@ -1062,6 +1062,17 @@ define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1(<2 x i8> %a) {
   ret <2 x i8> %r
 }
 
+define <3 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1_poison(<3 x i8> %a) {
+; CHECK-LABEL: @test_vector_usub_add_nuw_no_ov_nonsplat1_poison(
+; CHECK-NEXT:    [[B:%.*]] = add nuw <3 x i8> [[A:%.*]], <i8 10, i8 10, i8 10>
+; CHECK-NEXT:    [[R:%.*]] = call <3 x i8> @llvm.usub.sat.v3i8(<3 x i8> [[B]], <3 x i8> <i8 10, i8 9, i8 poison>)
+; CHECK-NEXT:    ret <3 x i8> [[R]]
+;
+  %b = add nuw <3 x i8> %a, <i8 10, i8 10, i8 10>
+  %r = call <3 x i8> @llvm.usub.sat.v3i8(<3 x i8> %b, <3 x i8> <i8 10, i8 9, i8 poison>)
+  ret <3 x i8> %r
+}
+
 ; Can be optimized if the add nuw RHS constant range handles non-splat vectors.
 define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat2(<2 x i8> %a) {
 ; CHECK-LABEL: @test_vector_usub_add_nuw_no_ov_nonsplat2(


        


More information about the llvm-commits mailing list