From 05366870eed154c7eb48c7cc3873ea5188f54cc9 Mon Sep 17 00:00:00 2001 From: Andrew Wei Date: Tue, 14 Jan 2020 00:16:23 +0800 Subject: [LegalizeTypes] Add SoftenFloatResult support for STRICT_SINT_TO_FP/STRICT_UINT_TO_FP Some target like arm/riscv with soft-float will have compiling crash when using -fno-unsafe-math-optimization option. This patch will add the missing strict FP support to SoftenFloatRes_XINT_TO_FP. Differential Revision: https://reviews.llvm.org/D72277 --- llvm/test/CodeGen/ARM/fp-intrinsics.ll | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'llvm/test/CodeGen/ARM') diff --git a/llvm/test/CodeGen/ARM/fp-intrinsics.ll b/llvm/test/CodeGen/ARM/fp-intrinsics.ll index 5eb20166483..9a15a626e28 100644 --- a/llvm/test/CodeGen/ARM/fp-intrinsics.ll +++ b/llvm/test/CodeGen/ARM/fp-intrinsics.ll @@ -488,6 +488,22 @@ define double @fpext_f32(float %x) #0 { ret double %val } +; CHECK-LABEL: sitofp_f32_i32: +; CHECK-NOSP: bl __aeabi_i2f +; CHECK-SP: vcvt.f32.s32 +define float @sitofp_f32_i32(i32 %x) #0 { + %val = call float @llvm.experimental.constrained.sitofp.f32.i32(i32 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0 + ret float %val +} + +; CHECK-LABEL: sitofp_f64_i32: +; CHECK-NODP: bl __aeabi_i2d +; CHECK-DP: vcvt.f64.s32 +define double @sitofp_f64_i32(i32 %x) #0 { + %val = call double @llvm.experimental.constrained.sitofp.f64.i32(i32 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0 + ret double %val +} + attributes #0 = { strictfp } @@ -555,3 +571,5 @@ declare double @llvm.experimental.constrained.trunc.f64(double, metadata) declare float @llvm.experimental.constrained.fptrunc.f32.f64(double, metadata, metadata) declare double @llvm.experimental.constrained.fpext.f64.f32(float, metadata) +declare float @llvm.experimental.constrained.sitofp.f32.i32(i32, metadata, metadata) +declare double @llvm.experimental.constrained.sitofp.f64.i32(i32, metadata, metadata) -- cgit v1.2.3