1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv64 -mattr=+zfhmin -verify-machineinstrs \
; RUN: -target-abi lp64f -disable-strictnode-mutation < %s | \
; RUN: FileCheck %s -check-prefix=RV64IZFHMIN
; RUN: llc -mtriple=riscv64 -mattr=+zhinxmin -verify-machineinstrs \
; RUN: -target-abi lp64 -disable-strictnode-mutation < %s | \
; RUN: FileCheck %s -check-prefix=RV64IZHINXMIN
; This file exhaustively checks half<->i32 conversions.
define i32 @aext_fptosi(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: aext_fptosi:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: aext_fptosi:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
declare i32 @llvm.experimental.constrained.fptosi.i32.f16(half, metadata)
define signext i32 @sext_fptosi(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: sext_fptosi:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: sext_fptosi:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
define zeroext i32 @zext_fptosi(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: zext_fptosi:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: slli a0, a0, 32
; RV64IZFHMIN-NEXT: srli a0, a0, 32
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: zext_fptosi:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: slli a0, a0, 32
; RV64IZHINXMIN-NEXT: srli a0, a0, 32
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
define i32 @aext_fptoui(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: aext_fptoui:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: aext_fptoui:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
declare i32 @llvm.experimental.constrained.fptoui.i32.f16(half, metadata)
define signext i32 @sext_fptoui(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: sext_fptoui:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: sext_fptoui:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
define zeroext i32 @zext_fptoui(half %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: zext_fptoui:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
; RV64IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: zext_fptoui:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
; RV64IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
; RV64IZHINXMIN-NEXT: ret
%1 = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %a, metadata !"fpexcept.strict")
ret i32 %1
}
define half @uitofp_aext_i32_to_f16(i32 %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: uitofp_aext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: slli a0, a0, 32
; RV64IZFHMIN-NEXT: srli a0, a0, 32
; RV64IZFHMIN-NEXT: fcvt.s.lu fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: uitofp_aext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: slli a0, a0, 32
; RV64IZHINXMIN-NEXT: srli a0, a0, 32
; RV64IZHINXMIN-NEXT: fcvt.s.lu a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
declare half @llvm.experimental.constrained.uitofp.f16.i32(i32 %a, metadata, metadata)
define half @uitofp_sext_i32_to_f16(i32 signext %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: uitofp_sext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: slli a0, a0, 32
; RV64IZFHMIN-NEXT: srli a0, a0, 32
; RV64IZFHMIN-NEXT: fcvt.s.lu fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: uitofp_sext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: slli a0, a0, 32
; RV64IZHINXMIN-NEXT: srli a0, a0, 32
; RV64IZHINXMIN-NEXT: fcvt.s.lu a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
define half @uitofp_zext_i32_to_f16(i32 zeroext %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: uitofp_zext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.lu fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: uitofp_zext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.lu a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
define half @sitofp_aext_i32_to_f16(i32 %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: sitofp_aext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: sext.w a0, a0
; RV64IZFHMIN-NEXT: fcvt.s.l fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: sitofp_aext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: sext.w a0, a0
; RV64IZHINXMIN-NEXT: fcvt.s.l a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
declare half @llvm.experimental.constrained.sitofp.f16.i32(i32 %a, metadata, metadata)
define half @sitofp_sext_i32_to_f16(i32 signext %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: sitofp_sext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: fcvt.s.l fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: sitofp_sext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: fcvt.s.l a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
define half @sitofp_zext_i32_to_f16(i32 zeroext %a) nounwind strictfp {
; RV64IZFHMIN-LABEL: sitofp_zext_i32_to_f16:
; RV64IZFHMIN: # %bb.0:
; RV64IZFHMIN-NEXT: sext.w a0, a0
; RV64IZFHMIN-NEXT: fcvt.s.l fa5, a0
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
; RV64IZFHMIN-NEXT: ret
;
; RV64IZHINXMIN-LABEL: sitofp_zext_i32_to_f16:
; RV64IZHINXMIN: # %bb.0:
; RV64IZHINXMIN-NEXT: sext.w a0, a0
; RV64IZHINXMIN-NEXT: fcvt.s.l a0, a0
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
; RV64IZHINXMIN-NEXT: ret
%1 = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret half %1
}
|