From 4056ee4884d264602f7794bcbedce3bb553872cb Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Thu, 4 Nov 2021 17:36:35 -0400 Subject: [PATCH 1/2] add condition to use emulated fma --- base/floatfuncs.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base/floatfuncs.jl b/base/floatfuncs.jl index 4c2f03d304f81..f2f0f0655046a 100644 --- a/base/floatfuncs.jl +++ b/base/floatfuncs.jl @@ -413,9 +413,11 @@ fma_llvm(x::Float64, y::Float64, z::Float64) = fma_float(x, y, z) # If fma_llvm() clobbers the rounding mode, the result of 0.1 + 0.2 will be 0.3 # instead of the properly-rounded 0.30000000000000004; check after calling fma # TODO actually detect fma in hardware and switch on that. -if (Sys.ARCH !== :i686 && fma_llvm(1.0000305f0, 1.0000305f0, -1.0f0) == 6.103609f-5 && - (fma_llvm(1.0000000009313226, 1.0000000009313226, -1.0) == - 1.8626451500983188e-9) && 0.1 + 0.2 == 0.30000000000000004) +if (Sys.ARCH !== :i686 && + fma_llvm(1.0000305f0, 1.0000305f0, -1.0f0) == 6.103609f-5 && + fma_llvm(-0.05339717f0, -2.6319417f-26, -1.8926976f-33) == 1.4053805f-27 + (fma_llvm(1.0000000009313226, 1.0000000009313226, -1.0) == 1.8626451500983188e-9) && + 0.1 + 0.2 == 0.30000000000000004) fma(x::Float32, y::Float32, z::Float32) = fma_llvm(x,y,z) fma(x::Float64, y::Float64, z::Float64) = fma_llvm(x,y,z) else From 578b9df85a1440e382f73ecfaa64f8c71019bb90 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Thu, 4 Nov 2021 17:49:32 -0400 Subject: [PATCH 2/2] Update floatfuncs.jl --- base/floatfuncs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/floatfuncs.jl b/base/floatfuncs.jl index f2f0f0655046a..c49f5ceb74a5d 100644 --- a/base/floatfuncs.jl +++ b/base/floatfuncs.jl @@ -415,7 +415,7 @@ fma_llvm(x::Float64, y::Float64, z::Float64) = fma_float(x, y, z) # TODO actually detect fma in hardware and switch on that. if (Sys.ARCH !== :i686 && fma_llvm(1.0000305f0, 1.0000305f0, -1.0f0) == 6.103609f-5 && - fma_llvm(-0.05339717f0, -2.6319417f-26, -1.8926976f-33) == 1.4053805f-27 + fma_llvm(-0.05339717f0, -2.6319417f-26, -1.8926976f-33) == 1.4053805f-27 && (fma_llvm(1.0000000009313226, 1.0000000009313226, -1.0) == 1.8626451500983188e-9) && 0.1 + 0.2 == 0.30000000000000004) fma(x::Float32, y::Float32, z::Float32) = fma_llvm(x,y,z)