[llvm] 058f727 - InstCombine: Add baseline checks for fdiv
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 08:57:16 PST 2022
Author: Matt Arsenault
Date: 2022-11-07T08:57:10-08:00
New Revision: 058f727a98579c97130b8483cdf50a13ffa9692d
URL: https://github.com/llvm/llvm-project/commit/058f727a98579c97130b8483cdf50a13ffa9692d
DIFF: https://github.com/llvm/llvm-project/commit/058f727a98579c97130b8483cdf50a13ffa9692d.diff
LOG: InstCombine: Add baseline checks for fdiv
Added:
Modified:
llvm/test/Transforms/InstCombine/fdiv.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll
index d0c0b66b813a..38557c326d12 100644
--- a/llvm/test/Transforms/InstCombine/fdiv.ll
+++ b/llvm/test/Transforms/InstCombine/fdiv.ll
@@ -937,3 +937,58 @@ define <2 x half> @powi_recip(<2 x half> %x, i32 %y) {
%r = fdiv reassoc arcp nnan ninf <2 x half> <half 1.0, half 1.0>, %p
ret <2 x half> %r
}
+
+define float @fdiv_zero_f32(float %x) {
+; CHECK-LABEL: @fdiv_zero_f32(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: ret float [[FDIV]]
+;
+ %fdiv = fdiv float %x, 0.0
+ ret float %fdiv
+}
+
+; https://alive2.llvm.org/ce/z/gLBFKB
+define float @fdiv_nnan_zero_f32(float %x) {
+; CHECK-LABEL: @fdiv_nnan_zero_f32(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: ret float [[FDIV]]
+;
+ %fdiv = fdiv nnan float %x, 0.0
+ ret float %fdiv
+}
+
+define <2 x float> @fdiv_nnan_zero_v2f32(<2 x float> %x) {
+; CHECK-LABEL: @fdiv_nnan_zero_v2f32(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan <2 x float> [[X:%.*]], zeroinitializer
+; CHECK-NEXT: ret <2 x float> [[FDIV]]
+;
+ %fdiv = fdiv nnan <2 x float> %x, zeroinitializer
+ ret <2 x float> %fdiv
+}
+
+define float @fdiv_nnan_zero_f32_fmf(float %x) {
+; CHECK-LABEL: @fdiv_nnan_zero_f32_fmf(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan nsz float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: ret float [[FDIV]]
+;
+ %fdiv = fdiv nnan nsz float %x, 0.0
+ ret float %fdiv
+}
+
+define <2 x float> @fdiv_nnan_zero_v2f32_fmf(<2 x float> %x) {
+; CHECK-LABEL: @fdiv_nnan_zero_v2f32_fmf(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan nsz <2 x float> [[X:%.*]], zeroinitializer
+; CHECK-NEXT: ret <2 x float> [[FDIV]]
+;
+ %fdiv = fdiv nnan nsz <2 x float> %x, zeroinitializer
+ ret <2 x float> %fdiv
+}
+
+define float @fdiv_nnan_neg_zero_f32(float %x) {
+; CHECK-LABEL: @fdiv_nnan_neg_zero_f32(
+; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan float [[X:%.*]], -0.000000e+00
+; CHECK-NEXT: ret float [[FDIV]]
+;
+ %fdiv = fdiv nnan float %x, -0.0
+ ret float %fdiv
+}
More information about the llvm-commits
mailing list