summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstCombine')
-rw-r--r--llvm/test/Transforms/InstCombine/fast-math.ll7
-rw-r--r--llvm/test/Transforms/InstCombine/fdiv.ll13
2 files changed, 16 insertions, 4 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll
index 4a0244561e0..1843a784ab8 100644
--- a/llvm/test/Transforms/InstCombine/fast-math.ll
+++ b/llvm/test/Transforms/InstCombine/fast-math.ll
@@ -229,6 +229,9 @@ define float @fmul_distribute1(float %f1) {
}
; (X/C1 + C2) * C3 => X/(C1/C3) + C2*C3
+; TODO: We don't convert the fast fdiv to fmul because that would be multiplication
+; by a denormal, but we could do better when we know that denormals are not a problem.
+
define double @fmul_distribute2(double %f1, double %f2) {
; CHECK-LABEL: @fmul_distribute2(
; CHECK-NEXT: [[TMP1:%.*]] = fdiv fast double [[F1:%.*]], 0x7FE8000000000000
@@ -345,7 +348,9 @@ define float @fmul4(float %f1, float %f2) {
; X / C1 * C2 => X / (C2/C1) if C1/C2 is either a special value of a denormal,
; and C2/C1 is a normal value.
-;
+; TODO: We don't convert the fast fdiv to fmul because that would be multiplication
+; by a denormal, but we could do better when we know that denormals are not a problem.
+
define float @fmul5(float %f1, float %f2) {
; CHECK-LABEL: @fmul5(
; CHECK-NEXT: [[TMP1:%.*]] = fdiv fast float [[F1:%.*]], 0x47E8000000000000
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll
index 90fea3baf1e..3a2c62c5071 100644
--- a/llvm/test/Transforms/InstCombine/fdiv.ll
+++ b/llvm/test/Transforms/InstCombine/fdiv.ll
@@ -86,11 +86,9 @@ define <2 x float> @not_exact_but_allow_recip_splat(<2 x float> %x) {
ret <2 x float> %div
}
-; FIXME: Vector neglect.
-
define <2 x float> @exact_inverse_vec(<2 x float> %x) {
; CHECK-LABEL: @exact_inverse_vec(
-; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], <float 4.000000e+00, float 8.000000e+00>
+; CHECK-NEXT: [[DIV:%.*]] = fmul <2 x float> [[X:%.*]], <float 2.500000e-01, float 1.250000e-01>
; CHECK-NEXT: ret <2 x float> [[DIV]]
;
%div = fdiv <2 x float> %x, <float 4.0, float 8.0>
@@ -115,6 +113,15 @@ define <2 x float> @not_exact_inverse_vec(<2 x float> %x) {
ret <2 x float> %div
}
+define <2 x float> @not_exact_inverse_vec_arcp(<2 x float> %x) {
+; CHECK-LABEL: @not_exact_inverse_vec_arcp(
+; CHECK-NEXT: [[DIV:%.*]] = fmul arcp <2 x float> [[X:%.*]], <float 2.500000e-01, float 0x3FD5555560000000>
+; CHECK-NEXT: ret <2 x float> [[DIV]]
+;
+ %div = fdiv arcp <2 x float> %x, <float 4.0, float 3.0>
+ ret <2 x float> %div
+}
+
; (X / Y) / Z --> X / (Y * Z)
define float @div_with_div_numerator(float %x, float %y, float %z) {
OpenPOWER on IntegriCloud