@@ -660,73 +660,109 @@ define <8 x half> @fdiv_pow2_8xhalf(<8 x i16> %i) {
660
660
ret <8 x half > %r
661
661
}
662
662
663
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
664
+ ; in the original IR.
663
665
define double @fmul_pow_shl_cnt (i64 %cnt ) nounwind {
664
666
; CHECK-SSE-LABEL: fmul_pow_shl_cnt:
665
667
; CHECK-SSE: # %bb.0:
666
- ; CHECK-SSE-NEXT: shlq $52, %rdi
667
- ; CHECK-SSE-NEXT: movabsq $4621256167635550208, %rax # imm = 0x4022000000000000
668
- ; CHECK-SSE-NEXT: addq %rdi, %rax
669
- ; CHECK-SSE-NEXT: movq %rax, %xmm0
668
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
669
+ ; CHECK-SSE-NEXT: shlq $52, %rax
670
+ ; CHECK-SSE-NEXT: movabsq $4621256167635550208, %rcx # imm = 0x4022000000000000
671
+ ; CHECK-SSE-NEXT: addq %rax, %rcx
672
+ ; CHECK-SSE-NEXT: movq %rcx, %xmm0
670
673
; CHECK-SSE-NEXT: retq
671
674
;
672
675
; CHECK-AVX-LABEL: fmul_pow_shl_cnt:
673
676
; CHECK-AVX: # %bb.0:
674
- ; CHECK-AVX-NEXT: shlq $52, %rdi
675
- ; CHECK-AVX-NEXT: movabsq $4621256167635550208, %rax # imm = 0x4022000000000000
676
- ; CHECK-AVX-NEXT: addq %rdi, %rax
677
- ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
677
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
678
+ ; CHECK-AVX-NEXT: shlq $52, %rax
679
+ ; CHECK-AVX-NEXT: movabsq $4621256167635550208, %rcx # imm = 0x4022000000000000
680
+ ; CHECK-AVX-NEXT: addq %rax, %rcx
681
+ ; CHECK-AVX-NEXT: vmovq %rcx, %xmm0
678
682
; CHECK-AVX-NEXT: retq
679
683
%shl = shl nuw i64 1 , %cnt
680
684
%conv = uitofp i64 %shl to double
681
685
%mul = fmul double 9 .000000e+00 , %conv
682
686
ret double %mul
683
687
}
684
688
689
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
690
+ ; in the original IR.
685
691
define double @fmul_pow_shl_cnt2 (i64 %cnt ) nounwind {
686
692
; CHECK-SSE-LABEL: fmul_pow_shl_cnt2:
687
693
; CHECK-SSE: # %bb.0:
688
- ; CHECK-SSE-NEXT: incl %edi
689
- ; CHECK-SSE-NEXT: shlq $52, %rdi
690
- ; CHECK-SSE-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
691
- ; CHECK-SSE-NEXT: addq %rdi, %rax
692
- ; CHECK-SSE-NEXT: movq %rax, %xmm0
694
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
695
+ ; CHECK-SSE-NEXT: incl %eax
696
+ ; CHECK-SSE-NEXT: shlq $52, %rax
697
+ ; CHECK-SSE-NEXT: movabsq $-4602115869219225600, %rcx # imm = 0xC022000000000000
698
+ ; CHECK-SSE-NEXT: addq %rax, %rcx
699
+ ; CHECK-SSE-NEXT: movq %rcx, %xmm0
693
700
; CHECK-SSE-NEXT: retq
694
701
;
695
702
; CHECK-AVX-LABEL: fmul_pow_shl_cnt2:
696
703
; CHECK-AVX: # %bb.0:
697
- ; CHECK-AVX-NEXT: incl %edi
698
- ; CHECK-AVX-NEXT: shlq $52, %rdi
699
- ; CHECK-AVX-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
700
- ; CHECK-AVX-NEXT: addq %rdi, %rax
701
- ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
704
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
705
+ ; CHECK-AVX-NEXT: incl %eax
706
+ ; CHECK-AVX-NEXT: shlq $52, %rax
707
+ ; CHECK-AVX-NEXT: movabsq $-4602115869219225600, %rcx # imm = 0xC022000000000000
708
+ ; CHECK-AVX-NEXT: addq %rax, %rcx
709
+ ; CHECK-AVX-NEXT: vmovq %rcx, %xmm0
702
710
; CHECK-AVX-NEXT: retq
703
711
%shl = shl nuw i64 2 , %cnt
704
712
%conv = uitofp i64 %shl to double
705
713
%mul = fmul double -9 .000000e+00 , %conv
706
714
ret double %mul
707
715
}
708
716
717
+ ; Make sure we do a movzbl of the input register.
718
+ define double @fmul_pow_shl_cnt3 (i8 %cnt ) nounwind {
719
+ ; CHECK-SSE-LABEL: fmul_pow_shl_cnt3:
720
+ ; CHECK-SSE: # %bb.0:
721
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
722
+ ; CHECK-SSE-NEXT: shlq $52, %rax
723
+ ; CHECK-SSE-NEXT: movabsq $-4602115869219225600, %rcx # imm = 0xC022000000000000
724
+ ; CHECK-SSE-NEXT: addq %rax, %rcx
725
+ ; CHECK-SSE-NEXT: movq %rcx, %xmm0
726
+ ; CHECK-SSE-NEXT: retq
727
+ ;
728
+ ; CHECK-AVX-LABEL: fmul_pow_shl_cnt3:
729
+ ; CHECK-AVX: # %bb.0:
730
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
731
+ ; CHECK-AVX-NEXT: shlq $52, %rax
732
+ ; CHECK-AVX-NEXT: movabsq $-4602115869219225600, %rcx # imm = 0xC022000000000000
733
+ ; CHECK-AVX-NEXT: addq %rax, %rcx
734
+ ; CHECK-AVX-NEXT: vmovq %rcx, %xmm0
735
+ ; CHECK-AVX-NEXT: retq
736
+ %zext_cnt = zext i8 %cnt to i64
737
+ %shl = shl nuw i64 1 , %zext_cnt
738
+ %conv = uitofp i64 %shl to double
739
+ %mul = fmul double -9 .000000e+00 , %conv
740
+ ret double %mul
741
+ }
742
+
743
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
744
+ ; in the original IR.
709
745
define float @fmul_pow_select (i32 %cnt , i1 %c ) nounwind {
710
746
; CHECK-SSE-LABEL: fmul_pow_select:
711
747
; CHECK-SSE: # %bb.0:
712
- ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
713
- ; CHECK-SSE-NEXT: leal 1(%rdi ), %eax
748
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
749
+ ; CHECK-SSE-NEXT: leal 1(%rax ), %ecx
714
750
; CHECK-SSE-NEXT: testb $1, %sil
715
- ; CHECK-SSE-NEXT: cmovnel %edi , %eax
716
- ; CHECK-SSE-NEXT: shll $23, %eax
717
- ; CHECK-SSE-NEXT: addl $1091567616, %eax # imm = 0x41100000
718
- ; CHECK-SSE-NEXT: movd %eax , %xmm0
751
+ ; CHECK-SSE-NEXT: cmovnel %eax , %ecx
752
+ ; CHECK-SSE-NEXT: shll $23, %ecx
753
+ ; CHECK-SSE-NEXT: addl $1091567616, %ecx # imm = 0x41100000
754
+ ; CHECK-SSE-NEXT: movd %ecx , %xmm0
719
755
; CHECK-SSE-NEXT: retq
720
756
;
721
757
; CHECK-AVX-LABEL: fmul_pow_select:
722
758
; CHECK-AVX: # %bb.0:
723
- ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
724
- ; CHECK-AVX-NEXT: leal 1(%rdi ), %eax
759
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
760
+ ; CHECK-AVX-NEXT: leal 1(%rax ), %ecx
725
761
; CHECK-AVX-NEXT: testb $1, %sil
726
- ; CHECK-AVX-NEXT: cmovnel %edi , %eax
727
- ; CHECK-AVX-NEXT: shll $23, %eax
728
- ; CHECK-AVX-NEXT: addl $1091567616, %eax # imm = 0x41100000
729
- ; CHECK-AVX-NEXT: vmovd %eax , %xmm0
762
+ ; CHECK-AVX-NEXT: cmovnel %eax , %ecx
763
+ ; CHECK-AVX-NEXT: shll $23, %ecx
764
+ ; CHECK-AVX-NEXT: addl $1091567616, %ecx # imm = 0x41100000
765
+ ; CHECK-AVX-NEXT: vmovd %ecx , %xmm0
730
766
; CHECK-AVX-NEXT: retq
731
767
%shl2 = shl nuw i32 2 , %cnt
732
768
%shl1 = shl nuw i32 1 , %cnt
@@ -736,27 +772,31 @@ define float @fmul_pow_select(i32 %cnt, i1 %c) nounwind {
736
772
ret float %mul
737
773
}
738
774
775
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
776
+ ; in the original IR.
739
777
define float @fmul_fly_pow_mul_min_pow2 (i64 %cnt ) nounwind {
740
778
; CHECK-SSE-LABEL: fmul_fly_pow_mul_min_pow2:
741
779
; CHECK-SSE: # %bb.0:
742
- ; CHECK-SSE-NEXT: addl $3, %edi
743
- ; CHECK-SSE-NEXT: cmpl $13, %edi
744
- ; CHECK-SSE-NEXT: movl $13, %eax
745
- ; CHECK-SSE-NEXT: cmovbl %edi, %eax
746
- ; CHECK-SSE-NEXT: shll $23, %eax
747
- ; CHECK-SSE-NEXT: addl $1091567616, %eax # imm = 0x41100000
748
- ; CHECK-SSE-NEXT: movd %eax, %xmm0
780
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
781
+ ; CHECK-SSE-NEXT: addl $3, %eax
782
+ ; CHECK-SSE-NEXT: cmpl $13, %eax
783
+ ; CHECK-SSE-NEXT: movl $13, %ecx
784
+ ; CHECK-SSE-NEXT: cmovbl %eax, %ecx
785
+ ; CHECK-SSE-NEXT: shll $23, %ecx
786
+ ; CHECK-SSE-NEXT: addl $1091567616, %ecx # imm = 0x41100000
787
+ ; CHECK-SSE-NEXT: movd %ecx, %xmm0
749
788
; CHECK-SSE-NEXT: retq
750
789
;
751
790
; CHECK-AVX-LABEL: fmul_fly_pow_mul_min_pow2:
752
791
; CHECK-AVX: # %bb.0:
753
- ; CHECK-AVX-NEXT: addl $3, %edi
754
- ; CHECK-AVX-NEXT: cmpl $13, %edi
755
- ; CHECK-AVX-NEXT: movl $13, %eax
756
- ; CHECK-AVX-NEXT: cmovbl %edi, %eax
757
- ; CHECK-AVX-NEXT: shll $23, %eax
758
- ; CHECK-AVX-NEXT: addl $1091567616, %eax # imm = 0x41100000
759
- ; CHECK-AVX-NEXT: vmovd %eax, %xmm0
792
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
793
+ ; CHECK-AVX-NEXT: addl $3, %eax
794
+ ; CHECK-AVX-NEXT: cmpl $13, %eax
795
+ ; CHECK-AVX-NEXT: movl $13, %ecx
796
+ ; CHECK-AVX-NEXT: cmovbl %eax, %ecx
797
+ ; CHECK-AVX-NEXT: shll $23, %ecx
798
+ ; CHECK-AVX-NEXT: addl $1091567616, %ecx # imm = 0x41100000
799
+ ; CHECK-AVX-NEXT: vmovd %ecx, %xmm0
760
800
; CHECK-AVX-NEXT: retq
761
801
%shl8 = shl nuw i64 8 , %cnt
762
802
%shl = call i64 @llvm.umin.i64 (i64 %shl8 , i64 8192 )
@@ -765,28 +805,30 @@ define float @fmul_fly_pow_mul_min_pow2(i64 %cnt) nounwind {
765
805
ret float %mul
766
806
}
767
807
808
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
809
+ ; in the original IR.
768
810
define double @fmul_pow_mul_max_pow2 (i16 %cnt ) nounwind {
769
811
; CHECK-SSE-LABEL: fmul_pow_mul_max_pow2:
770
812
; CHECK-SSE: # %bb.0:
771
- ; CHECK-SSE-NEXT: movl %edi , %eax
813
+ ; CHECK-SSE-NEXT: movzbl %dil , %eax
772
814
; CHECK-SSE-NEXT: leaq 1(%rax), %rcx
773
815
; CHECK-SSE-NEXT: cmpq %rcx, %rax
774
816
; CHECK-SSE-NEXT: cmovaq %rax, %rcx
775
817
; CHECK-SSE-NEXT: shlq $52, %rcx
776
818
; CHECK-SSE-NEXT: movabsq $4613937818241073152, %rax # imm = 0x4008000000000000
777
- ; CHECK-SSE-NEXT: addq %rcx, %rax
819
+ ; CHECK-SSE-NEXT: orq %rcx, %rax
778
820
; CHECK-SSE-NEXT: movq %rax, %xmm0
779
821
; CHECK-SSE-NEXT: retq
780
822
;
781
823
; CHECK-AVX-LABEL: fmul_pow_mul_max_pow2:
782
824
; CHECK-AVX: # %bb.0:
783
- ; CHECK-AVX-NEXT: movl %edi , %eax
825
+ ; CHECK-AVX-NEXT: movzbl %dil , %eax
784
826
; CHECK-AVX-NEXT: leaq 1(%rax), %rcx
785
827
; CHECK-AVX-NEXT: cmpq %rcx, %rax
786
828
; CHECK-AVX-NEXT: cmovaq %rax, %rcx
787
829
; CHECK-AVX-NEXT: shlq $52, %rcx
788
830
; CHECK-AVX-NEXT: movabsq $4613937818241073152, %rax # imm = 0x4008000000000000
789
- ; CHECK-AVX-NEXT: addq %rcx, %rax
831
+ ; CHECK-AVX-NEXT: orq %rcx, %rax
790
832
; CHECK-AVX-NEXT: vmovq %rax, %xmm0
791
833
; CHECK-AVX-NEXT: retq
792
834
%shl2 = shl nuw i16 2 , %cnt
@@ -1161,23 +1203,25 @@ define double @fmul_pow_shl_cnt_fail_maybe_bad_exp(i64 %cnt) nounwind {
1161
1203
ret double %mul
1162
1204
}
1163
1205
1206
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
1207
+ ; in the original IR.
1164
1208
define double @fmul_pow_shl_cnt_safe (i16 %cnt ) nounwind {
1165
1209
; CHECK-SSE-LABEL: fmul_pow_shl_cnt_safe:
1166
1210
; CHECK-SSE: # %bb.0:
1167
- ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
1168
- ; CHECK-SSE-NEXT: shlq $52, %rdi
1169
- ; CHECK-SSE-NEXT: movabsq $8930638061065157010, %rax # imm = 0x7BEFFFFFFF5F3992
1170
- ; CHECK-SSE-NEXT: addq %rdi , %rax
1171
- ; CHECK-SSE-NEXT: movq %rax , %xmm0
1211
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
1212
+ ; CHECK-SSE-NEXT: shlq $52, %rax
1213
+ ; CHECK-SSE-NEXT: movabsq $8930638061065157010, %rcx # imm = 0x7BEFFFFFFF5F3992
1214
+ ; CHECK-SSE-NEXT: addq %rax , %rcx
1215
+ ; CHECK-SSE-NEXT: movq %rcx , %xmm0
1172
1216
; CHECK-SSE-NEXT: retq
1173
1217
;
1174
1218
; CHECK-AVX-LABEL: fmul_pow_shl_cnt_safe:
1175
1219
; CHECK-AVX: # %bb.0:
1176
- ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
1177
- ; CHECK-AVX-NEXT: shlq $52, %rdi
1178
- ; CHECK-AVX-NEXT: movabsq $8930638061065157010, %rax # imm = 0x7BEFFFFFFF5F3992
1179
- ; CHECK-AVX-NEXT: addq %rdi , %rax
1180
- ; CHECK-AVX-NEXT: vmovq %rax , %xmm0
1220
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
1221
+ ; CHECK-AVX-NEXT: shlq $52, %rax
1222
+ ; CHECK-AVX-NEXT: movabsq $8930638061065157010, %rcx # imm = 0x7BEFFFFFFF5F3992
1223
+ ; CHECK-AVX-NEXT: addq %rax , %rcx
1224
+ ; CHECK-AVX-NEXT: vmovq %rcx , %xmm0
1181
1225
; CHECK-AVX-NEXT: retq
1182
1226
%shl = shl nuw i16 1 , %cnt
1183
1227
%conv = uitofp i16 %shl to double
@@ -1236,15 +1280,15 @@ define float @fdiv_pow_shl_cnt_fail_maybe_z(i64 %cnt) nounwind {
1236
1280
; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
1237
1281
; CHECK-SSE-NEXT: shlq %cl, %rax
1238
1282
; CHECK-SSE-NEXT: testq %rax, %rax
1239
- ; CHECK-SSE-NEXT: js .LBB22_1
1283
+ ; CHECK-SSE-NEXT: js .LBB23_1
1240
1284
; CHECK-SSE-NEXT: # %bb.2:
1241
1285
; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1242
- ; CHECK-SSE-NEXT: jmp .LBB22_3
1243
- ; CHECK-SSE-NEXT: .LBB22_1 :
1286
+ ; CHECK-SSE-NEXT: jmp .LBB23_3
1287
+ ; CHECK-SSE-NEXT: .LBB23_1 :
1244
1288
; CHECK-SSE-NEXT: shrq %rax
1245
1289
; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1246
1290
; CHECK-SSE-NEXT: addss %xmm1, %xmm1
1247
- ; CHECK-SSE-NEXT: .LBB22_3 :
1291
+ ; CHECK-SSE-NEXT: .LBB23_3 :
1248
1292
; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = [-9.0E+0,0.0E+0,0.0E+0,0.0E+0]
1249
1293
; CHECK-SSE-NEXT: divss %xmm1, %xmm0
1250
1294
; CHECK-SSE-NEXT: retq
@@ -1256,15 +1300,15 @@ define float @fdiv_pow_shl_cnt_fail_maybe_z(i64 %cnt) nounwind {
1256
1300
; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
1257
1301
; CHECK-AVX2-NEXT: shlq %cl, %rax
1258
1302
; CHECK-AVX2-NEXT: testq %rax, %rax
1259
- ; CHECK-AVX2-NEXT: js .LBB22_1
1303
+ ; CHECK-AVX2-NEXT: js .LBB23_1
1260
1304
; CHECK-AVX2-NEXT: # %bb.2:
1261
1305
; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1262
- ; CHECK-AVX2-NEXT: jmp .LBB22_3
1263
- ; CHECK-AVX2-NEXT: .LBB22_1 :
1306
+ ; CHECK-AVX2-NEXT: jmp .LBB23_3
1307
+ ; CHECK-AVX2-NEXT: .LBB23_1 :
1264
1308
; CHECK-AVX2-NEXT: shrq %rax
1265
1309
; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1266
1310
; CHECK-AVX2-NEXT: vaddss %xmm0, %xmm0, %xmm0
1267
- ; CHECK-AVX2-NEXT: .LBB22_3 :
1311
+ ; CHECK-AVX2-NEXT: .LBB23_3 :
1268
1312
; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = [-9.0E+0,0.0E+0,0.0E+0,0.0E+0]
1269
1313
; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1270
1314
; CHECK-AVX2-NEXT: retq
@@ -1545,23 +1589,25 @@ define half @fdiv_pow_shl_cnt_fail_out_of_bound2(i16 %cnt) nounwind {
1545
1589
ret half %mul
1546
1590
}
1547
1591
1592
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
1593
+ ; in the original IR.
1548
1594
define double @fdiv_pow_shl_cnt32_to_dbl_okay (i32 %cnt ) nounwind {
1549
1595
; CHECK-SSE-LABEL: fdiv_pow_shl_cnt32_to_dbl_okay:
1550
1596
; CHECK-SSE: # %bb.0:
1551
- ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
1552
- ; CHECK-SSE-NEXT: shlq $52, %rdi
1553
- ; CHECK-SSE-NEXT: movabsq $3936146074321813504, %rax # imm = 0x36A0000000000000
1554
- ; CHECK-SSE-NEXT: subq %rdi , %rax
1555
- ; CHECK-SSE-NEXT: movq %rax , %xmm0
1597
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
1598
+ ; CHECK-SSE-NEXT: shlq $52, %rax
1599
+ ; CHECK-SSE-NEXT: movabsq $3936146074321813504, %rcx # imm = 0x36A0000000000000
1600
+ ; CHECK-SSE-NEXT: subq %rax , %rcx
1601
+ ; CHECK-SSE-NEXT: movq %rcx , %xmm0
1556
1602
; CHECK-SSE-NEXT: retq
1557
1603
;
1558
1604
; CHECK-AVX-LABEL: fdiv_pow_shl_cnt32_to_dbl_okay:
1559
1605
; CHECK-AVX: # %bb.0:
1560
- ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
1561
- ; CHECK-AVX-NEXT: shlq $52, %rdi
1562
- ; CHECK-AVX-NEXT: movabsq $3936146074321813504, %rax # imm = 0x36A0000000000000
1563
- ; CHECK-AVX-NEXT: subq %rdi , %rax
1564
- ; CHECK-AVX-NEXT: vmovq %rax , %xmm0
1606
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
1607
+ ; CHECK-AVX-NEXT: shlq $52, %rax
1608
+ ; CHECK-AVX-NEXT: movabsq $3936146074321813504, %rcx # imm = 0x36A0000000000000
1609
+ ; CHECK-AVX-NEXT: subq %rax , %rcx
1610
+ ; CHECK-AVX-NEXT: vmovq %rcx , %xmm0
1565
1611
; CHECK-AVX-NEXT: retq
1566
1612
%shl = shl nuw i32 1 , %cnt
1567
1613
%conv = uitofp i32 %shl to double
@@ -1617,21 +1663,25 @@ define float @fdiv_pow_shl_cnt32_out_of_bounds2(i32 %cnt) nounwind {
1617
1663
ret float %mul
1618
1664
}
1619
1665
1666
+ ; FIXME: The movzbl is unnecessary. It would be UB for the upper bits to be set
1667
+ ; in the original IR.
1620
1668
define float @fdiv_pow_shl_cnt32_okay (i32 %cnt ) nounwind {
1621
1669
; CHECK-SSE-LABEL: fdiv_pow_shl_cnt32_okay:
1622
1670
; CHECK-SSE: # %bb.0:
1623
- ; CHECK-SSE-NEXT: shll $23, %edi
1624
- ; CHECK-SSE-NEXT: movl $285212672, %eax # imm = 0x11000000
1625
- ; CHECK-SSE-NEXT: subl %edi, %eax
1626
- ; CHECK-SSE-NEXT: movd %eax, %xmm0
1671
+ ; CHECK-SSE-NEXT: movzbl %dil, %eax
1672
+ ; CHECK-SSE-NEXT: shll $23, %eax
1673
+ ; CHECK-SSE-NEXT: movl $285212672, %ecx # imm = 0x11000000
1674
+ ; CHECK-SSE-NEXT: subl %eax, %ecx
1675
+ ; CHECK-SSE-NEXT: movd %ecx, %xmm0
1627
1676
; CHECK-SSE-NEXT: retq
1628
1677
;
1629
1678
; CHECK-AVX-LABEL: fdiv_pow_shl_cnt32_okay:
1630
1679
; CHECK-AVX: # %bb.0:
1631
- ; CHECK-AVX-NEXT: shll $23, %edi
1632
- ; CHECK-AVX-NEXT: movl $285212672, %eax # imm = 0x11000000
1633
- ; CHECK-AVX-NEXT: subl %edi, %eax
1634
- ; CHECK-AVX-NEXT: vmovd %eax, %xmm0
1680
+ ; CHECK-AVX-NEXT: movzbl %dil, %eax
1681
+ ; CHECK-AVX-NEXT: shll $23, %eax
1682
+ ; CHECK-AVX-NEXT: movl $285212672, %ecx # imm = 0x11000000
1683
+ ; CHECK-AVX-NEXT: subl %eax, %ecx
1684
+ ; CHECK-AVX-NEXT: vmovd %ecx, %xmm0
1635
1685
; CHECK-AVX-NEXT: retq
1636
1686
%shl = shl nuw i32 1 , %cnt
1637
1687
%conv = uitofp i32 %shl to float
0 commit comments