From 1ce5f93d03c24ad780f099eccc2dc768e9e9e30f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 16 Oct 2022 22:26:13 -0700 Subject: [PATCH] InstSimplify: Add new baseline tests for fdiv --- llvm/test/Transforms/InstSimplify/fdiv.ll | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/llvm/test/Transforms/InstSimplify/fdiv.ll b/llvm/test/Transforms/InstSimplify/fdiv.ll index 2b998b3..2b583a0 100644 --- a/llvm/test/Transforms/InstSimplify/fdiv.ll +++ b/llvm/test/Transforms/InstSimplify/fdiv.ll @@ -59,3 +59,102 @@ define <2 x i1> @pr6096() { %fcmp = fcmp ole <2 x float> %fdiv, zeroinitializer ret <2 x i1> %fcmp } + + +; https://alive2.llvm.org/ce/z/JxX5in +define float @fdiv_nnan_ninf_by_zero_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_zero_f32( +; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan ninf float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: ret float [[FDIV]] +; + %fdiv = fdiv nnan ninf float %x, 0.0 + ret float %fdiv +} + +define float @fdiv_nnan_ninf_by_negzero_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_negzero_f32( +; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan ninf float [[X:%.*]], -0.000000e+00 +; CHECK-NEXT: ret float [[FDIV]] +; + %fdiv = fdiv nnan ninf float %x, -0.0 + ret float %fdiv +} + +define float @fdiv_nnan_ninf_by_undef_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_undef_f32( +; CHECK-NEXT: ret float poison +; + %fdiv = fdiv nnan ninf float %x, undef + ret float %fdiv +} + +define float @fdiv_nnan_ninf_by_poison_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_poison_f32( +; CHECK-NEXT: ret float poison +; + %fdiv = fdiv nnan ninf float %x, poison + ret float %fdiv +} + +define <2 x float> @fdiv_nnan_ninf_by_zero_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_zero_v2f32( +; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan ninf <2 x float> [[X:%.*]], zeroinitializer +; CHECK-NEXT: ret <2 x float> [[FDIV]] +; + %fdiv = fdiv nnan ninf <2 x float> %x, zeroinitializer + ret <2 x float> %fdiv +} + +define <2 x float> @fdiv_nnan_ninf_by_undef_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_undef_v2f32( +; CHECK-NEXT: ret <2 x float> poison +; + %fdiv = fdiv nnan ninf <2 x float> %x, undef + ret <2 x float> %fdiv +} + +define <2 x float> @fdiv_nnan_ninf_by_zero_undef_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fdiv_nnan_ninf_by_zero_undef_v2f32( +; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan ninf <2 x float> [[X:%.*]], +; CHECK-NEXT: ret <2 x float> [[FDIV]] +; + %fdiv = fdiv nnan ninf <2 x float> %x, + ret <2 x float> %fdiv +} + +; https://alive2.llvm.org/ce/z/wRV28p +define float @fdiv_nnan_nsz_ninf_by_zero_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_nsz_ninf_by_zero_f32( +; 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 float @fdiv_nnan_nsz_ninf_by_negzero_f32(float %x) { +; CHECK-LABEL: @fdiv_nnan_nsz_ninf_by_negzero_f32( +; 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_nsz_ninf_by_zero_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fdiv_nnan_nsz_ninf_by_zero_v2f32( +; 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 <2 x float> @fdiv_nnan_nsz_ninf_by_negzero_v2f32(<2 x float> %x) { +; CHECK-LABEL: @fdiv_nnan_nsz_ninf_by_negzero_v2f32( +; CHECK-NEXT: [[FDIV:%.*]] = fdiv nnan nsz <2 x float> [[X:%.*]], +; CHECK-NEXT: ret <2 x float> [[FDIV]] +; + %fdiv = fdiv nnan nsz <2 x float> %x, + ret <2 x float> %fdiv +} -- 2.7.4