mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-05 17:30:02 +00:00
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
|
||
|
}
|