blob: 82b9190b9a5bf63bb4ac362ca4be24ca43a8e7bc [file] [log] [blame]
Duncan Sands3ef3fcf2012-04-08 18:08:12 +00001; RUN: llc < %s -march=x86-64 -enable-unsafe-fp-math | FileCheck %s
Duncan Sands961d6662012-04-07 20:04:00 +00002
3define double @exact(double %x) {
Duncan Sands3ef3fcf2012-04-08 18:08:12 +00004; Exact division by a constant converted to multiplication.
Duncan Sands961d6662012-04-07 20:04:00 +00005; CHECK: @exact
6; CHECK: mulsd
Duncan Sands961d6662012-04-07 20:04:00 +00007 %div = fdiv double %x, 2.0
8 ret double %div
9}
10
11define double @inexact(double %x) {
Duncan Sands3ef3fcf2012-04-08 18:08:12 +000012; Inexact division by a constant converted to multiplication.
Duncan Sands961d6662012-04-07 20:04:00 +000013; CHECK: @inexact
Duncan Sands3ef3fcf2012-04-08 18:08:12 +000014; CHECK: mulsd
Duncan Sands961d6662012-04-07 20:04:00 +000015 %div = fdiv double %x, 0x41DFFFFFFFC00000
16 ret double %div
17}
18
19define double @funky(double %x) {
20; No conversion to multiplication if too funky.
21; CHECK: @funky
22; CHECK: divsd
Duncan Sands961d6662012-04-07 20:04:00 +000023 %div = fdiv double %x, 0.0
24 ret double %div
25}