mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-25 22:12:57 +02:00
cd52f3d447
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. llvm-svn: 154265
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
|
|
}
|