Skip to content

Commit 82f7d58

Browse files
committed
[X86] Add test case for #126889. NFC
1 parent 23209eb commit 82f7d58

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

llvm/test/CodeGen/X86/fold-int-pow2-with-fmul-or-fdiv.ll

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,33 @@ define double @fmul_pow_shl_cnt2(i64 %cnt) nounwind {
706706
ret double %mul
707707
}
708708

709+
; FIXME: The zext of the input is being lost so the upper 4 bits of %rdi after
710+
; the shlq are garbage.
711+
define double @fmul_pow_shl_cnt3(i8 %cnt) nounwind {
712+
; CHECK-SSE-LABEL: fmul_pow_shl_cnt3:
713+
; CHECK-SSE: # %bb.0:
714+
; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
715+
; CHECK-SSE-NEXT: shlq $52, %rdi
716+
; CHECK-SSE-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
717+
; CHECK-SSE-NEXT: addq %rdi, %rax
718+
; CHECK-SSE-NEXT: movq %rax, %xmm0
719+
; CHECK-SSE-NEXT: retq
720+
;
721+
; CHECK-AVX-LABEL: fmul_pow_shl_cnt3:
722+
; CHECK-AVX: # %bb.0:
723+
; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
724+
; CHECK-AVX-NEXT: shlq $52, %rdi
725+
; CHECK-AVX-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
726+
; CHECK-AVX-NEXT: addq %rdi, %rax
727+
; CHECK-AVX-NEXT: vmovq %rax, %xmm0
728+
; CHECK-AVX-NEXT: retq
729+
%zext_cnt = zext i8 %cnt to i64
730+
%shl = shl nuw i64 1, %zext_cnt
731+
%conv = uitofp i64 %shl to double
732+
%mul = fmul double -9.000000e+00, %conv
733+
ret double %mul
734+
}
735+
709736
define float @fmul_pow_select(i32 %cnt, i1 %c) nounwind {
710737
; CHECK-SSE-LABEL: fmul_pow_select:
711738
; CHECK-SSE: # %bb.0:
@@ -1236,15 +1263,15 @@ define float @fdiv_pow_shl_cnt_fail_maybe_z(i64 %cnt) nounwind {
12361263
; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
12371264
; CHECK-SSE-NEXT: shlq %cl, %rax
12381265
; CHECK-SSE-NEXT: testq %rax, %rax
1239-
; CHECK-SSE-NEXT: js .LBB22_1
1266+
; CHECK-SSE-NEXT: js .LBB23_1
12401267
; CHECK-SSE-NEXT: # %bb.2:
12411268
; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1242-
; CHECK-SSE-NEXT: jmp .LBB22_3
1243-
; CHECK-SSE-NEXT: .LBB22_1:
1269+
; CHECK-SSE-NEXT: jmp .LBB23_3
1270+
; CHECK-SSE-NEXT: .LBB23_1:
12441271
; CHECK-SSE-NEXT: shrq %rax
12451272
; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
12461273
; CHECK-SSE-NEXT: addss %xmm1, %xmm1
1247-
; CHECK-SSE-NEXT: .LBB22_3:
1274+
; CHECK-SSE-NEXT: .LBB23_3:
12481275
; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = [-9.0E+0,0.0E+0,0.0E+0,0.0E+0]
12491276
; CHECK-SSE-NEXT: divss %xmm1, %xmm0
12501277
; CHECK-SSE-NEXT: retq
@@ -1256,15 +1283,15 @@ define float @fdiv_pow_shl_cnt_fail_maybe_z(i64 %cnt) nounwind {
12561283
; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
12571284
; CHECK-AVX2-NEXT: shlq %cl, %rax
12581285
; CHECK-AVX2-NEXT: testq %rax, %rax
1259-
; CHECK-AVX2-NEXT: js .LBB22_1
1286+
; CHECK-AVX2-NEXT: js .LBB23_1
12601287
; CHECK-AVX2-NEXT: # %bb.2:
12611288
; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1262-
; CHECK-AVX2-NEXT: jmp .LBB22_3
1263-
; CHECK-AVX2-NEXT: .LBB22_1:
1289+
; CHECK-AVX2-NEXT: jmp .LBB23_3
1290+
; CHECK-AVX2-NEXT: .LBB23_1:
12641291
; CHECK-AVX2-NEXT: shrq %rax
12651292
; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
12661293
; CHECK-AVX2-NEXT: vaddss %xmm0, %xmm0, %xmm0
1267-
; CHECK-AVX2-NEXT: .LBB22_3:
1294+
; CHECK-AVX2-NEXT: .LBB23_3:
12681295
; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = [-9.0E+0,0.0E+0,0.0E+0,0.0E+0]
12691296
; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
12701297
; CHECK-AVX2-NEXT: retq

0 commit comments

Comments
 (0)