summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2014-01-20 07:44:53 +0000
committerOwen Anderson <resistor@mac.com>2014-01-20 07:44:53 +0000
commit1e1446bf84a6a36366c40f995e68ca6a460c9839 (patch)
tree04a5b76e0a4e4588d038231e423826e0210c13ce /test/Transforms
parentf55ec9ac184e654ff8052b02c4f88fc27710f4da (diff)
downloadllvm-1e1446bf84a6a36366c40f995e68ca6a460c9839.tar.gz
llvm-1e1446bf84a6a36366c40f995e68ca6a460c9839.tar.bz2
llvm-1e1446bf84a6a36366c40f995e68ca6a460c9839.tar.xz
Fix all the remaining lost-fast-math-flags bugs I've been able to find. The most important of these are cases in the generic logic for combining BinaryOperators.
This logic hadn't been updated to handle FastMathFlags, and it took me a while to detect it because it doesn't show up in a simple search for CreateFAdd. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/fdiv.ll18
-rw-r--r--test/Transforms/InstCombine/fmul.ll10
-rw-r--r--test/Transforms/InstCombine/select-2.ll10
3 files changed, 38 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fdiv.ll b/test/Transforms/InstCombine/fdiv.ll
index c3aabd7866..af6a2401a8 100644
--- a/test/Transforms/InstCombine/fdiv.ll
+++ b/test/Transforms/InstCombine/fdiv.ll
@@ -31,3 +31,21 @@ define float @test4(float %x) nounwind readnone ssp {
; CHECK-LABEL: @test4(
; CHECK-NEXT: fmul fast float %x, 1.250000e-01
}
+
+define float @test5(float %x, float %y, float %z) nounwind readnone ssp {
+ %div1 = fdiv fast float %x, %y
+ %div2 = fdiv fast float %div1, %z
+ ret float %div2
+; CHECK-LABEL: @test5(
+; CHECK-NEXT: fmul fast
+; CHECK-NEXT: fdiv fast
+}
+
+define float @test6(float %x, float %y, float %z) nounwind readnone ssp {
+ %div1 = fdiv fast float %x, %y
+ %div2 = fdiv fast float %z, %div1
+ ret float %div2
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: fmul fast
+; CHECK-NEXT: fdiv fast
+}
diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll
index fdfc8df0a2..18cbf9da53 100644
--- a/test/Transforms/InstCombine/fmul.ll
+++ b/test/Transforms/InstCombine/fmul.ll
@@ -113,3 +113,13 @@ define <4 x float> @test10(<4 x float> %x) {
; CHECK-NOT: fmul
; CHECK: fsub
}
+
+define float @test11(float %x, float %y) {
+ %a = fadd fast float %x, 1.0
+ %b = fadd fast float %y, 2.0
+ %c = fadd fast float %a, %b
+ ret float %c
+; CHECK-LABEL: @test11(
+; CHECK-NOT: fadd float
+; CHECK: fadd fast float
+}
diff --git a/test/Transforms/InstCombine/select-2.ll b/test/Transforms/InstCombine/select-2.ll
index 5b9deb4515..832d958c5f 100644
--- a/test/Transforms/InstCombine/select-2.ll
+++ b/test/Transforms/InstCombine/select-2.ll
@@ -19,3 +19,13 @@ define i32 @t2(i32 %c, i32 %x) nounwind {
%t3 = select i1 %t1, i32 %t2, i32 %x
ret i32 %t3
}
+
+define float @t3(float %x, float %y) nounwind {
+ %t1 = fcmp ogt float %x, %y
+ %t2 = select i1 %t1, float %x, float 1.0
+ %t3 = fadd fast float %t2, 1.0
+ ret float %t3
+; CHECK-LABEL: @t3(
+; CHECK: fadd fast
+; CHECK: select
+}