1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \
3 ; RUN: -target-abi=lp64d | FileCheck %s -check-prefix=RV64ID
5 ; This file exhaustively checks double<->i32 conversions. In general,
6 ; fcvt.l[u].d can be selected instead of fcvt.w[u].d because poison is
7 ; generated for an fpto[s|u]i conversion if the result doesn't fit in the
10 define i32 @aext_fptosi(double %a) nounwind {
11 ; RV64ID-LABEL: aext_fptosi:
13 ; RV64ID-NEXT: fcvt.w.d a0, fa0, rtz
15 %1 = fptosi double %a to i32
19 define signext i32 @sext_fptosi(double %a) nounwind {
20 ; RV64ID-LABEL: sext_fptosi:
22 ; RV64ID-NEXT: fcvt.w.d a0, fa0, rtz
24 %1 = fptosi double %a to i32
28 define zeroext i32 @zext_fptosi(double %a) nounwind {
29 ; RV64ID-LABEL: zext_fptosi:
31 ; RV64ID-NEXT: fcvt.w.d a0, fa0, rtz
32 ; RV64ID-NEXT: slli a0, a0, 32
33 ; RV64ID-NEXT: srli a0, a0, 32
35 %1 = fptosi double %a to i32
39 define i32 @aext_fptoui(double %a) nounwind {
40 ; RV64ID-LABEL: aext_fptoui:
42 ; RV64ID-NEXT: fcvt.wu.d a0, fa0, rtz
44 %1 = fptoui double %a to i32
48 define signext i32 @sext_fptoui(double %a) nounwind {
49 ; RV64ID-LABEL: sext_fptoui:
51 ; RV64ID-NEXT: fcvt.wu.d a0, fa0, rtz
53 %1 = fptoui double %a to i32
57 define zeroext i32 @zext_fptoui(double %a) nounwind {
58 ; RV64ID-LABEL: zext_fptoui:
60 ; RV64ID-NEXT: fcvt.lu.d a0, fa0, rtz
62 %1 = fptoui double %a to i32
66 define double @uitofp_aext_i32_to_f64(i32 %a) nounwind {
67 ; RV64ID-LABEL: uitofp_aext_i32_to_f64:
69 ; RV64ID-NEXT: fcvt.d.wu fa0, a0
71 %1 = uitofp i32 %a to double
75 define double @uitofp_sext_i32_to_f64(i32 signext %a) nounwind {
76 ; RV64ID-LABEL: uitofp_sext_i32_to_f64:
78 ; RV64ID-NEXT: fcvt.d.wu fa0, a0
80 %1 = uitofp i32 %a to double
84 define double @uitofp_zext_i32_to_f64(i32 zeroext %a) nounwind {
85 ; RV64ID-LABEL: uitofp_zext_i32_to_f64:
87 ; RV64ID-NEXT: fcvt.d.wu fa0, a0
89 %1 = uitofp i32 %a to double
93 define double @sitofp_aext_i32_to_f64(i32 %a) nounwind {
94 ; RV64ID-LABEL: sitofp_aext_i32_to_f64:
96 ; RV64ID-NEXT: fcvt.d.w fa0, a0
98 %1 = sitofp i32 %a to double
102 define double @sitofp_sext_i32_to_f64(i32 signext %a) nounwind {
103 ; RV64ID-LABEL: sitofp_sext_i32_to_f64:
105 ; RV64ID-NEXT: fcvt.d.w fa0, a0
107 %1 = sitofp i32 %a to double
111 define double @sitofp_zext_i32_to_f64(i32 zeroext %a) nounwind {
112 ; RV64ID-LABEL: sitofp_zext_i32_to_f64:
114 ; RV64ID-NEXT: fcvt.d.w fa0, a0
116 %1 = sitofp i32 %a to double