1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32IF %s
5 define i32 @fcvt_w_s(float %a) nounwind {
6 ; RV32IF-LABEL: fcvt_w_s:
8 ; RV32IF-NEXT: fmv.w.x ft0, a0
9 ; RV32IF-NEXT: fcvt.w.s a0, ft0, rtz
11 %1 = fptosi float %a to i32
15 define i32 @fcvt_wu_s(float %a) nounwind {
16 ; RV32IF-LABEL: fcvt_wu_s:
18 ; RV32IF-NEXT: fmv.w.x ft0, a0
19 ; RV32IF-NEXT: fcvt.wu.s a0, ft0, rtz
21 %1 = fptoui float %a to i32
25 define i32 @fmv_x_w(float %a, float %b) nounwind {
26 ; RV32IF-LABEL: fmv_x_w:
28 ; RV32IF-NEXT: fmv.w.x ft0, a1
29 ; RV32IF-NEXT: fmv.w.x ft1, a0
30 ; RV32IF-NEXT: fadd.s ft0, ft1, ft0
31 ; RV32IF-NEXT: fmv.x.w a0, ft0
33 ; Ensure fmv.x.w is generated even for a soft float calling convention
34 %1 = fadd float %a, %b
35 %2 = bitcast float %1 to i32
39 define float @fcvt_s_w(i32 %a) nounwind {
40 ; RV32IF-LABEL: fcvt_s_w:
42 ; RV32IF-NEXT: fcvt.s.w ft0, a0
43 ; RV32IF-NEXT: fmv.x.w a0, ft0
45 %1 = sitofp i32 %a to float
49 define float @fcvt_s_wu(i32 %a) nounwind {
50 ; RV32IF-LABEL: fcvt_s_wu:
52 ; RV32IF-NEXT: fcvt.s.wu ft0, a0
53 ; RV32IF-NEXT: fmv.x.w a0, ft0
55 %1 = uitofp i32 %a to float
59 define float @fmv_w_x(i32 %a, i32 %b) nounwind {
60 ; RV32IF-LABEL: fmv_w_x:
62 ; RV32IF-NEXT: fmv.w.x ft0, a1
63 ; RV32IF-NEXT: fmv.w.x ft1, a0
64 ; RV32IF-NEXT: fadd.s ft0, ft1, ft0
65 ; RV32IF-NEXT: fmv.x.w a0, ft0
67 ; Ensure fmv.w.x is generated even for a soft float calling convention
68 %1 = bitcast i32 %a to float
69 %2 = bitcast i32 %b to float
70 %3 = fadd float %1, %2