@@ -174,7 +174,7 @@ define i32 @fcvt_w_s(float %a) nounwind {
174
174
; RV64I: # %bb.0:
175
175
; RV64I-NEXT: addi sp, sp, -16
176
176
; RV64I-NEXT: sd ra, 8(sp)
177
- ; RV64I-NEXT: call __fixsfdi
177
+ ; RV64I-NEXT: call __fixsfsi
178
178
; RV64I-NEXT: ld ra, 8(sp)
179
179
; RV64I-NEXT: addi sp, sp, 16
180
180
; RV64I-NEXT: ret
@@ -187,7 +187,7 @@ define i32 @fcvt_wu_s(float %a) nounwind {
187
187
; RV64I: # %bb.0:
188
188
; RV64I-NEXT: addi sp, sp, -16
189
189
; RV64I-NEXT: sd ra, 8(sp)
190
- ; RV64I-NEXT: call __fixunssfdi
190
+ ; RV64I-NEXT: call __fixunssfsi
191
191
; RV64I-NEXT: ld ra, 8(sp)
192
192
; RV64I-NEXT: addi sp, sp, 16
193
193
; RV64I-NEXT: ret
@@ -710,3 +710,123 @@ define float @fp_trunc(double %a) nounwind {
710
710
%conv = fptrunc double %a to float
711
711
ret float %conv
712
712
}
713
+
714
+ define i32 @fp32_to_ui32 (float %a ) nounwind {
715
+ ; RV64I-LABEL: fp32_to_ui32:
716
+ ; RV64I: # %bb.0: # %entry
717
+ ; RV64I-NEXT: addi sp, sp, -16
718
+ ; RV64I-NEXT: sd ra, 8(sp)
719
+ ; RV64I-NEXT: call __fixunssfsi
720
+ ; RV64I-NEXT: ld ra, 8(sp)
721
+ ; RV64I-NEXT: addi sp, sp, 16
722
+ ; RV64I-NEXT: ret
723
+ entry:
724
+ %conv = fptoui float %a to i32
725
+ ret i32 %conv
726
+ }
727
+
728
+ define i32 @fp32_to_si32 (float %a ) nounwind {
729
+ ; RV64I-LABEL: fp32_to_si32:
730
+ ; RV64I: # %bb.0: # %entry
731
+ ; RV64I-NEXT: addi sp, sp, -16
732
+ ; RV64I-NEXT: sd ra, 8(sp)
733
+ ; RV64I-NEXT: call __fixsfsi
734
+ ; RV64I-NEXT: ld ra, 8(sp)
735
+ ; RV64I-NEXT: addi sp, sp, 16
736
+ ; RV64I-NEXT: ret
737
+ entry:
738
+ %conv = fptosi float %a to i32
739
+ ret i32 %conv
740
+ }
741
+
742
+ define i32 @fp64_to_ui32 (double %a ) nounwind {
743
+ ; RV64I-LABEL: fp64_to_ui32:
744
+ ; RV64I: # %bb.0: # %entry
745
+ ; RV64I-NEXT: addi sp, sp, -16
746
+ ; RV64I-NEXT: sd ra, 8(sp)
747
+ ; RV64I-NEXT: call __fixunsdfsi
748
+ ; RV64I-NEXT: ld ra, 8(sp)
749
+ ; RV64I-NEXT: addi sp, sp, 16
750
+ ; RV64I-NEXT: ret
751
+ entry:
752
+ %conv = fptoui double %a to i32
753
+ ret i32 %conv
754
+ }
755
+
756
+ define i32 @fp64_to_si32 (double %a ) nounwind {
757
+ ; RV64I-LABEL: fp64_to_si32:
758
+ ; RV64I: # %bb.0: # %entry
759
+ ; RV64I-NEXT: addi sp, sp, -16
760
+ ; RV64I-NEXT: sd ra, 8(sp)
761
+ ; RV64I-NEXT: call __fixdfsi
762
+ ; RV64I-NEXT: ld ra, 8(sp)
763
+ ; RV64I-NEXT: addi sp, sp, 16
764
+ ; RV64I-NEXT: ret
765
+ entry:
766
+ %conv = fptosi double %a to i32
767
+ ret i32 %conv
768
+ }
769
+
770
+
771
+
772
+ declare i32 @llvm.experimental.constrained.fptoui.i32.f32 (float , metadata )
773
+ declare i32 @llvm.experimental.constrained.fptosi.i32.f32 (float , metadata )
774
+ declare i32 @llvm.experimental.constrained.fptosi.i32.f64 (double , metadata )
775
+ declare i32 @llvm.experimental.constrained.fptoui.i32.f64 (double , metadata )
776
+
777
+ define i32 @strict_fp32_to_ui32 (float %a ) nounwind strictfp {
778
+ ; RV64I-LABEL: strict_fp32_to_ui32:
779
+ ; RV64I: # %bb.0: # %entry
780
+ ; RV64I-NEXT: addi sp, sp, -16
781
+ ; RV64I-NEXT: sd ra, 8(sp)
782
+ ; RV64I-NEXT: call __fixunssfsi
783
+ ; RV64I-NEXT: ld ra, 8(sp)
784
+ ; RV64I-NEXT: addi sp, sp, 16
785
+ ; RV64I-NEXT: ret
786
+ entry:
787
+ %conv = tail call i32 @llvm.experimental.constrained.fptoui.i32.f32 (float %a , metadata !"fpexcept.strict" )
788
+ ret i32 %conv
789
+ }
790
+
791
+ define i32 @strict_fp32_to_si32 (float %a ) nounwind strictfp {
792
+ ; RV64I-LABEL: strict_fp32_to_si32:
793
+ ; RV64I: # %bb.0: # %entry
794
+ ; RV64I-NEXT: addi sp, sp, -16
795
+ ; RV64I-NEXT: sd ra, 8(sp)
796
+ ; RV64I-NEXT: call __fixsfsi
797
+ ; RV64I-NEXT: ld ra, 8(sp)
798
+ ; RV64I-NEXT: addi sp, sp, 16
799
+ ; RV64I-NEXT: ret
800
+ entry:
801
+ %conv = tail call i32 @llvm.experimental.constrained.fptosi.i32.f32 (float %a , metadata !"fpexcept.strict" )
802
+ ret i32 %conv
803
+ }
804
+
805
+ define i32 @strict_fp64_to_ui32 (double %a ) nounwind strictfp {
806
+ ; RV64I-LABEL: strict_fp64_to_ui32:
807
+ ; RV64I: # %bb.0: # %entry
808
+ ; RV64I-NEXT: addi sp, sp, -16
809
+ ; RV64I-NEXT: sd ra, 8(sp)
810
+ ; RV64I-NEXT: call __fixunsdfsi
811
+ ; RV64I-NEXT: ld ra, 8(sp)
812
+ ; RV64I-NEXT: addi sp, sp, 16
813
+ ; RV64I-NEXT: ret
814
+ entry:
815
+ %conv = tail call i32 @llvm.experimental.constrained.fptoui.i32.f64 (double %a , metadata !"fpexcept.strict" )
816
+ ret i32 %conv
817
+ }
818
+
819
+ define i32 @struct_fp64_to_si32 (double %a ) nounwind strictfp {
820
+ ; RV64I-LABEL: struct_fp64_to_si32:
821
+ ; RV64I: # %bb.0: # %entry
822
+ ; RV64I-NEXT: addi sp, sp, -16
823
+ ; RV64I-NEXT: sd ra, 8(sp)
824
+ ; RV64I-NEXT: call __fixdfsi
825
+ ; RV64I-NEXT: ld ra, 8(sp)
826
+ ; RV64I-NEXT: addi sp, sp, 16
827
+ ; RV64I-NEXT: ret
828
+ entry:
829
+ %conv = tail call i32 @llvm.experimental.constrained.fptosi.i32.f64 (double %a , metadata !"fpexcept.strict" )
830
+ ret i32 %conv
831
+ }
832
+
0 commit comments