Skip to content

Commit c2a5a87

Browse files
committed
[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.
1 parent dcb9067 commit c2a5a87

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

llvm/test/CodeGen/X86/combine-srem.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,18 @@ define <4 x i32> @combine_vec_srem_by_pow2b_neg(<4 x i32> %x) {
371371
ret <4 x i32> %1
372372
}
373373

374+
; FIXME: PR55271 - srem(undef, 3) != undef
375+
; Use PSLLI intrinsic to postpone the undef creation until after urem-by-constant expansion
376+
define <4 x i32> @combine_vec_srem_undef_by_3(<4 x i32> %in) {
377+
; CHECK-LABEL: combine_vec_srem_undef_by_3:
378+
; CHECK: # %bb.0:
379+
; CHECK-NEXT: retq
380+
%x = call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> undef, i32 0)
381+
%y = srem <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
382+
ret <4 x i32> %y
383+
}
384+
declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32)
385+
374386
; OSS-Fuzz #6883
375387
; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6883
376388
define i32 @ossfuzz6883() {

llvm/test/CodeGen/X86/combine-urem.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,18 @@ define <4 x i32> @combine_vec_urem_by_shl_pow2b(<4 x i32> %x, <4 x i32> %y) {
336336
ret <4 x i32> %2
337337
}
338338

339+
; FIXME: PR55271 - urem(undef, 3) != undef
340+
; Use PSLLI intrinsic to postpone the undef creation until after urem-by-constant expansion
341+
define <4 x i32> @combine_vec_urem_undef_by_3(<4 x i32> %in) {
342+
; CHECK-LABEL: combine_vec_urem_undef_by_3:
343+
; CHECK: # %bb.0:
344+
; CHECK-NEXT: retq
345+
%x = call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> undef, i32 0)
346+
%y = urem <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3>
347+
ret <4 x i32> %y
348+
}
349+
declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32)
350+
339351
define i1 @bool_urem(i1 %x, i1 %y) {
340352
; CHECK-LABEL: bool_urem:
341353
; CHECK: # %bb.0:

0 commit comments

Comments
 (0)