mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-10 06:54:54 +00:00
961d666be4
reciprocal if converting to the reciprocal is exact. Do it even if inexact if -ffast-math. This substantially speeds up ac.f90 from the polyhedron benchmarks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154265 91177308-0d34-0410-b5e6-96231b3b80d8
33 lines
792 B
LLVM
33 lines
792 B
LLVM
; RUN: llc < %s -march=x86-64 | FileCheck %s
|
|
; RUN: llc < %s -march=x86-64 -enable-unsafe-fp-math | FileCheck -check-prefix=UNSAFE %s
|
|
|
|
define double @exact(double %x) {
|
|
; Exact division by a constant always converted to multiplication.
|
|
; CHECK: @exact
|
|
; CHECK: mulsd
|
|
; UNSAFE: @exact
|
|
; UNSAFE: mulsd
|
|
%div = fdiv double %x, 2.0
|
|
ret double %div
|
|
}
|
|
|
|
define double @inexact(double %x) {
|
|
; Inexact division by a constant converted to multiplication if unsafe-math.
|
|
; CHECK: @inexact
|
|
; CHECK: divsd
|
|
; UNSAFE: @inexact
|
|
; UNSAFE: mulsd
|
|
%div = fdiv double %x, 0x41DFFFFFFFC00000
|
|
ret double %div
|
|
}
|
|
|
|
define double @funky(double %x) {
|
|
; No conversion to multiplication if too funky.
|
|
; CHECK: @funky
|
|
; CHECK: divsd
|
|
; UNSAFE: @funky
|
|
; UNSAFE: divsd
|
|
%div = fdiv double %x, 0.0
|
|
ret double %div
|
|
}
|