From: Matt Arsenault Date: Mon, 17 Oct 2022 19:20:02 +0000 (-0700) Subject: InstCombine: Add baseline checks for fdiv X-Git-Tag: upstream/17.0.6~28321 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=058f727a98579c97130b8483cdf50a13ffa9692d;p=platform%2Fupstream%2Fllvm.git InstCombine: Add baseline checks for fdiv --- diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index d0c0b66..38557c3 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> , %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 +}