[llvm] c2a5a87 - [X86] Add some test coverage for Issue #55271

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 12:06:30 PDT 2022


Author: Simon Pilgrim
Date: 2022-05-05T20:06:23+01:00
New Revision: c2a5a87500d92c7c2e76c595f1b0f439b98b0aff

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

LOG: [X86] Add some test coverage for Issue #55271

We needed something that would delay the creation of the undef until after the rem-by-constant expansion, so I used a SSE shift of undef by zero which will expand to undef.

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/combine-srem.ll
    llvm/test/CodeGen/X86/combine-urem.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/combine-srem.ll b/llvm/test/CodeGen/X86/combine-srem.ll
index 575f37117f2d..254f2a698f93 100644
--- a/llvm/test/CodeGen/X86/combine-srem.ll
+++ b/llvm/test/CodeGen/X86/combine-srem.ll
@@ -371,6 +371,18 @@ define <4 x i32> @combine_vec_srem_by_pow2b_neg(<4 x i32> %x) {
   ret <4 x i32> %1
 }
 
+; FIXME: PR55271 - srem(undef, 3) != undef
+; Use PSLLI intrinsic to postpone the undef creation until after urem-by-constant expansion
+define <4 x i32> @combine_vec_srem_undef_by_3(<4 x i32> %in) {
+; CHECK-LABEL: combine_vec_srem_undef_by_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    retq
+  %x = call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> undef, i32 0)
+  %y = srem <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
+  ret <4 x i32> %y
+}
+declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32)
+
 ; OSS-Fuzz #6883
 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6883
 define i32 @ossfuzz6883() {

diff  --git a/llvm/test/CodeGen/X86/combine-urem.ll b/llvm/test/CodeGen/X86/combine-urem.ll
index e0faa355f791..27c209aa6728 100644
--- a/llvm/test/CodeGen/X86/combine-urem.ll
+++ b/llvm/test/CodeGen/X86/combine-urem.ll
@@ -336,6 +336,18 @@ define <4 x i32> @combine_vec_urem_by_shl_pow2b(<4 x i32> %x, <4 x i32> %y) {
   ret <4 x i32> %2
 }
 
+; FIXME: PR55271 - urem(undef, 3) != undef
+; Use PSLLI intrinsic to postpone the undef creation until after urem-by-constant expansion
+define <4 x i32> @combine_vec_urem_undef_by_3(<4 x i32> %in) {
+; CHECK-LABEL: combine_vec_urem_undef_by_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    retq
+  %x = call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> undef, i32 0)
+  %y = urem <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
+  ret <4 x i32> %y
+}
+declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32)
+
 define i1 @bool_urem(i1 %x, i1 %y) {
 ; CHECK-LABEL: bool_urem:
 ; CHECK:       # %bb.0:


        


More information about the llvm-commits mailing list