From d3b0644e22a4ebe599d58d9d319d2403484fd88f Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 18 Sep 2020 10:36:24 -0400 Subject: [PATCH] [InstSimplify] add tests for constant folding fmin/fmax with undef op; NFC --- .../Transforms/InstSimplify/ConstProp/fp-undef.ll | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll index 9d90459..b77337a 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll @@ -1,6 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instsimplify -S | FileCheck %s +declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>) +declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>) +declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>) +declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>) + ; Constant folding - undef undef. define double @fadd_undef_undef(double %x) { @@ -533,3 +538,66 @@ define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) { ret <2 x double> %r } +define <2 x double> @maximum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) { +; CHECK-LABEL: @maximum_nan_op0_vec_partial_undef_op1_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> , <2 x double> undef) + ret <2 x double> %r +} + +define <2 x double> @maximum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) { +; CHECK-LABEL: @maximum_nan_op1_vec_partial_undef_op0_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> undef, <2 x double> ) + ret <2 x double> %r +} + +define <2 x double> @minimum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) { +; CHECK-LABEL: @minimum_nan_op0_vec_partial_undef_op1_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> , <2 x double> undef) + ret <2 x double> %r +} + +define <2 x double> @minimum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) { +; CHECK-LABEL: @minimum_nan_op1_vec_partial_undef_op0_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> undef, <2 x double> ) + ret <2 x double> %r +} + +define <2 x double> @maxnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) { +; CHECK-LABEL: @maxnum_nan_op0_vec_partial_undef_op1_undef( +; CHECK-NEXT: ret <2 x double> undef +; + %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> , <2 x double> undef) + ret <2 x double> %r +} + +define <2 x double> @maxnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) { +; CHECK-LABEL: @maxnum_nan_op1_vec_partial_undef_op0_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> undef, <2 x double> ) + ret <2 x double> %r +} + +define <2 x double> @minnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) { +; CHECK-LABEL: @minnum_nan_op0_vec_partial_undef_op1_undef( +; CHECK-NEXT: ret <2 x double> undef +; + %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> , <2 x double> undef) + ret <2 x double> %r +} + +define <2 x double> @minnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) { +; CHECK-LABEL: @minnum_nan_op1_vec_partial_undef_op0_undef( +; CHECK-NEXT: ret <2 x double> +; + %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> undef, <2 x double> ) + ret <2 x double> %r +} -- 2.7.4