diff options
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/maxnum.ll | 17 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/minnum.ll | 17 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll | 57 |
3 files changed, 57 insertions, 34 deletions
diff --git a/llvm/test/Transforms/InstCombine/maxnum.ll b/llvm/test/Transforms/InstCombine/maxnum.ll index 7f94a722a03..e3630ba3ea5 100644 --- a/llvm/test/Transforms/InstCombine/maxnum.ll +++ b/llvm/test/Transforms/InstCombine/maxnum.ll @@ -158,23 +158,6 @@ define float @maxnum4(float %x, float %y, float %z, float %w) { ret float %c } -define float @fold_maxnum_f32_inf_val(float %x) { -; CHECK-LABEL: @fold_maxnum_f32_inf_val( -; CHECK-NEXT: ret float 0x7FF0000000000000 -; - %val = call float @llvm.maxnum.f32(float 0x7FF0000000000000, float %x) - ret float %val -} - -define float @fold_maxnum_f32_neginf_val(float %x) { -; CHECK-LABEL: @fold_maxnum_f32_neginf_val( -; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 0xFFF0000000000000) -; CHECK-NEXT: ret float [[VAL]] -; - %val = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float %x) - ret float %val -} - ; PR37404 - https://bugs.llvm.org/show_bug.cgi?id=37404 define <2 x float> @neg_neg(<2 x float> %x, <2 x float> %y) { diff --git a/llvm/test/Transforms/InstCombine/minnum.ll b/llvm/test/Transforms/InstCombine/minnum.ll index 94c8b5518b2..a5236d2e50f 100644 --- a/llvm/test/Transforms/InstCombine/minnum.ll +++ b/llvm/test/Transforms/InstCombine/minnum.ll @@ -182,23 +182,6 @@ define float @maxnum_x_minnum_x_y(float %x, float %y) { ret float %b } -define float @fold_minnum_f32_inf_val(float %x) { -; CHECK-LABEL: @fold_minnum_f32_inf_val( -; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 0x7FF0000000000000) -; CHECK-NEXT: ret float [[VAL]] -; - %val = call float @llvm.minnum.f32(float 0x7FF0000000000000, float %x) - ret float %val -} - -define float @fold_minnum_f32_minf_val(float %x) { -; CHECK-LABEL: @fold_minnum_f32_minf_val( -; CHECK-NEXT: ret float 0xFFF0000000000000 -; - %val = call float @llvm.minnum.f32(float 0xFFF0000000000000, float %x) - ret float %val -} - ; PR37405 - https://bugs.llvm.org/show_bug.cgi?id=37405 define double @neg_neg(double %x, double %y) { diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll index 305e508480f..6b6ae48f516 100644 --- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll +++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll @@ -667,6 +667,34 @@ define float @minnum_x_y_minnum_z(float %x, float %y, float %z) { ret float %b } +; minnum(X, -INF) --> -INF + +define float @minnum_neginf(float %x) { +; CHECK-LABEL: @minnum_neginf( +; CHECK-NEXT: ret float 0xFFF0000000000000 +; + %val = call float @llvm.minnum.f32(float %x, float 0xFFF0000000000000) + ret float %val +} + +define <2 x double> @minnum_neginf_commute_vec(<2 x double> %x) { +; CHECK-LABEL: @minnum_neginf_commute_vec( +; CHECK-NEXT: ret <2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000> +; + %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> %x) + ret <2 x double> %r +} + +; negative test + +define float @minnum_inf(float %x) { +; CHECK-LABEL: @minnum_inf( +; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.minnum.f32(float 0x7FF0000000000000, float [[X:%.*]]) +; CHECK-NEXT: ret float [[VAL]] +; + %val = call float @llvm.minnum.f32(float 0x7FF0000000000000, float %x) + ret float %val +} define float @maxnum_x_maxnum_x_y(float %x, float %y) { ; CHECK-LABEL: @maxnum_x_maxnum_x_y( ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]]) @@ -733,6 +761,35 @@ define float @maxnum_x_y_maxnum_z(float %x, float %y, float %z) { ret float %b } +; maxnum(X, INF) --> INF + +define <2 x double> @maxnum_inf(<2 x double> %x) { +; CHECK-LABEL: @maxnum_inf( +; CHECK-NEXT: ret <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000> +; + %val = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %x, <2 x double><double 0x7FF0000000000000, double 0x7FF0000000000000>) + ret <2 x double> %val +} + +define float @maxnum_inf_commute(float %x) { +; CHECK-LABEL: @maxnum_inf_commute( +; CHECK-NEXT: ret float 0x7FF0000000000000 +; + %val = call float @llvm.maxnum.f32(float 0x7FF0000000000000, float %x) + ret float %val +} + +; negative test + +define float @maxnum_neginf(float %x) { +; CHECK-LABEL: @maxnum_neginf( +; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float [[X:%.*]]) +; CHECK-NEXT: ret float [[VAL]] +; + %val = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float %x) + ret float %val +} + ; Y - (Y - X) --> X define float @fsub_fsub_common_op(float %x, float %y) { |

