@@ -2690,6 +2690,110 @@ entry:
2690
2690
ret double %abs
2691
2691
}
2692
2692
2693
+ define float @bitcast_to_float_sign_0 (i32 %arg ) {
2694
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2695
+ ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @bitcast_to_float_sign_0
2696
+ ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR3]] {
2697
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[ARG]], 1
2698
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[TMP1]] to float
2699
+ ; CHECK-NEXT: ret float [[TMP2]]
2700
+ ;
2701
+ %1 = lshr i32 %arg , 1
2702
+ %2 = bitcast i32 %1 to float
2703
+ ret float %2
2704
+ }
2705
+
2706
+ define float @bitcast_to_float_nnan (i32 %arg ) {
2707
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2708
+ ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @bitcast_to_float_nnan
2709
+ ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR3]] {
2710
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[ARG]], 2
2711
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[TMP1]] to float
2712
+ ; CHECK-NEXT: ret float [[TMP2]]
2713
+ ;
2714
+ %1 = lshr i32 %arg , 2
2715
+ %2 = bitcast i32 %1 to float
2716
+ ret float %2
2717
+ }
2718
+
2719
+ define float @bitcast_to_float_sign_1 (i32 %arg ) {
2720
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2721
+ ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @bitcast_to_float_sign_1
2722
+ ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR3]] {
2723
+ ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARG]], -2147483648
2724
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[TMP1]] to float
2725
+ ; CHECK-NEXT: ret float [[TMP2]]
2726
+ ;
2727
+ %1 = or i32 %arg , -2147483648
2728
+ %2 = bitcast i32 %1 to float
2729
+ ret float %2
2730
+ }
2731
+
2732
+ define float @bitcast_to_float_nan (i32 %arg ) {
2733
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2734
+ ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @bitcast_to_float_nan
2735
+ ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR3]] {
2736
+ ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[ARG]], 2139095041
2737
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[TMP1]] to float
2738
+ ; CHECK-NEXT: ret float [[TMP2]]
2739
+ ;
2740
+ %1 = or i32 %arg , 2139095041
2741
+ %2 = bitcast i32 %1 to float
2742
+ ret float %2
2743
+ }
2744
+
2745
+ define double @bitcast_to_double_sign_0 (i64 %arg ) {
2746
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2747
+ ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) double @bitcast_to_double_sign_0
2748
+ ; CHECK-SAME: (i64 [[ARG:%.*]]) #[[ATTR3]] {
2749
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr i64 [[ARG]], 1
2750
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64 [[TMP1]] to double
2751
+ ; CHECK-NEXT: ret double [[TMP2]]
2752
+ ;
2753
+ %1 = lshr i64 %arg , 1
2754
+ %2 = bitcast i64 %1 to double
2755
+ ret double %2
2756
+ }
2757
+
2758
+ define double @bitcast_to_double_nnan (i64 %arg ) {
2759
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2760
+ ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) double @bitcast_to_double_nnan
2761
+ ; CHECK-SAME: (i64 [[ARG:%.*]]) #[[ATTR3]] {
2762
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr i64 [[ARG]], 2
2763
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64 [[TMP1]] to double
2764
+ ; CHECK-NEXT: ret double [[TMP2]]
2765
+ ;
2766
+ %1 = lshr i64 %arg , 2
2767
+ %2 = bitcast i64 %1 to double
2768
+ ret double %2
2769
+ }
2770
+
2771
+ define double @bitcast_to_double_sign_1 (i64 %arg ) {
2772
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2773
+ ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) double @bitcast_to_double_sign_1
2774
+ ; CHECK-SAME: (i64 [[ARG:%.*]]) #[[ATTR3]] {
2775
+ ; CHECK-NEXT: [[TMP1:%.*]] = or i64 [[ARG]], -9223372036854775808
2776
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64 [[TMP1]] to double
2777
+ ; CHECK-NEXT: ret double [[TMP2]]
2778
+ ;
2779
+ %1 = or i64 %arg , -9223372036854775808
2780
+ %2 = bitcast i64 %1 to double
2781
+ ret double %2
2782
+ }
2783
+
2784
+ define double @bitcast_to_double_nan (i64 %arg ) {
2785
+ ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2786
+ ; CHECK-LABEL: define nofpclass(inf zero sub norm) double @bitcast_to_double_nan
2787
+ ; CHECK-SAME: (i64 [[ARG:%.*]]) #[[ATTR3]] {
2788
+ ; CHECK-NEXT: [[TMP1:%.*]] = or i64 [[ARG]], -4503599627370495
2789
+ ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64 [[TMP1]] to double
2790
+ ; CHECK-NEXT: ret double [[TMP2]]
2791
+ ;
2792
+ %1 = or i64 %arg , -4503599627370495
2793
+ %2 = bitcast i64 %1 to double
2794
+ ret double %2
2795
+ }
2796
+
2693
2797
declare i64 @_Z13get_global_idj (i32 noundef)
2694
2798
2695
2799
attributes #0 = { "denormal-fp-math" ="preserve-sign,preserve-sign" }
0 commit comments