llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-transforms Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> Previously we only considered fcNan to fold to qnan for canonicalizing results, ignoring the simpler case where we know the nan is already quiet. --- Patch is 21.96 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/176123.diff 18 Files Affected: - (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (+2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll (+1-1) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-extractelement.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fadd.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fmul.ll (+2-4) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fpext.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc-round.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-frexp.ll (+3-4) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-insertelement.ll (+3-4) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximum.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimum.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-rounding-intrinsics.ll (+1-2) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-shufflevector.ll (+3-4) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-sqrt.ll (+3-9) - (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll (+1-1) ``````````diff diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 1fc298dfc52a2..9f32e4fef1c3d 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -2028,6 +2028,8 @@ static Constant *getFPClassConstant(Type *Ty, FPClassTest Mask, return ConstantFP::getInfinity(Ty); case fcNegInf: return ConstantFP::getInfinity(Ty, true); + case fcQNan: + return ConstantFP::getQNaN(Ty); default: return nullptr; } diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll index ef68699c73166..2a33ff195911e 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-exp.ll @@ -490,7 +490,7 @@ define nofpclass(nzero) float @source_is_known_snan(float nofpclass(inf norm sub define nofpclass(nzero) float @source_is_known_qnan(float nofpclass(inf norm sub zero snan) %must.be.qnan) { ; CHECK-LABEL: define nofpclass(nzero) float @source_is_known_qnan( ; CHECK-SAME: float nofpclass(snan inf zero sub norm) [[MUST_BE_QNAN:%.*]]) { -; CHECK-NEXT: ret float [[MUST_BE_QNAN]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %exp = call float @llvm.exp2.f32(float %must.be.qnan) ret float %exp diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-extractelement.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-extractelement.ll index e571774c72f2b..6cabee258d2b6 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-extractelement.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-extractelement.ll @@ -17,8 +17,7 @@ define nofpclass(inf norm sub zero) half @ret_only_nan__extractelement_unknown(< define nofpclass(snan inf norm sub zero) half @ret_only_qnan__extractelement_unknown(<4 x half> %vec, i32 %idx) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan__extractelement_unknown( ; CHECK-SAME: <4 x half> [[VEC:%.*]], i32 [[IDX:%.*]]) { -; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x half> [[VEC]], i32 [[IDX]] -; CHECK-NEXT: ret half [[EXT]] +; CHECK-NEXT: ret half 0xH7E00 ; %ext = extractelement <4 x half> %vec, i32 %idx ret half %ext diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fadd.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fadd.ll index 099624e912912..4386d22f82df4 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fadd.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fadd.ll @@ -43,8 +43,7 @@ define nofpclass(inf zero sub norm) half @ret_only_nan(half %x, half %y) { define nofpclass(snan inf zero sub norm) half @ret_only_qnan(half %x, half %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan( ; CHECK-SAME: half [[X:%.*]], half [[Y:%.*]]) { -; CHECK-NEXT: [[ADD:%.*]] = fadd half [[X]], [[Y]] -; CHECK-NEXT: ret half [[ADD]] +; CHECK-NEXT: ret half 0xH7E00 ; %add = fadd half %x, %y ret half %add diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fmul.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fmul.ll index 4ed2e781a30d5..b5ad0ad4cafe3 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fmul.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fmul.ll @@ -112,8 +112,7 @@ define nofpclass(inf norm sub zero) float @ret_only_nan_results_square(float nou define nofpclass(inf norm sub zero snan) float @ret_only_qnan_results_square(float noundef %x) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan_results_square( ; CHECK-SAME: float noundef [[X:%.*]]) { -; CHECK-NEXT: [[MUL:%.*]] = fmul float [[X]], [[X]] -; CHECK-NEXT: ret float [[MUL]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %mul = fmul float %x, %x ret float %mul @@ -885,8 +884,7 @@ define nofpclass(inf norm sub zero) float @ret_only_nan_results_fmul(float %x, f define nofpclass(inf norm sub zero snan) float @ret_only_qnan_results_fmul(float %x, float %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan_results_fmul( ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[MUL:%.*]] = fmul float [[X]], [[Y]] -; CHECK-NEXT: ret float [[MUL]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %mul = fmul float %x, %y ret float %mul diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fpext.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fpext.ll index c1070954a26ff..7334277750d7e 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fpext.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fpext.ll @@ -36,8 +36,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan__fpext(half %x) { define nofpclass(inf norm sub zero snan) float @ret_only_qnan__fpext(half %x) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan__fpext( ; CHECK-SAME: half [[X:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = fpext half [[X]] to float -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = fpext half %x to float ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc-round.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc-round.ll index 9ca3956be5358..33fe7977701ab 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc-round.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc-round.ll @@ -40,8 +40,7 @@ define nofpclass(inf norm sub zero qnan) half @ret_only_snan__fptrunc(float %x) define nofpclass(inf norm sub zero snan) half @ret_only_qnan__fptrunc(float %x) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan__fptrunc( ; CHECK-SAME: float [[X:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call half @llvm.fptrunc.round.f16.f32(float [[X]], metadata !"round.downward") -; CHECK-NEXT: ret half [[RESULT]] +; CHECK-NEXT: ret half 0xH7E00 ; %result = call half @llvm.fptrunc.round.f16.f32(float %x, metadata !"round.downward") ret half %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc.ll index c1d5dacbc26c9..2edb04956d407 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fptrunc.ll @@ -40,8 +40,7 @@ define nofpclass(inf norm sub zero qnan) half @ret_only_snan__fptrunc(float %x) define nofpclass(inf norm sub zero snan) half @ret_only_qnan__fptrunc(float %x) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan__fptrunc( ; CHECK-SAME: float [[X:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = fptrunc float [[X]] to half -; CHECK-NEXT: ret half [[RESULT]] +; CHECK-NEXT: ret half 0xH7E00 ; %result = fptrunc float %x to half ret half %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-frexp.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-frexp.ll index 75591556fc1e7..18977a10139dd 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-frexp.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-frexp.ll @@ -65,7 +65,7 @@ define nofpclass(nan) half @extractvalue_not_frexp() { define nofpclass(snan inf norm sub zero) half @ret_only_qnan__frexp(half %unknown) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) half @ret_only_qnan__frexp( ; CHECK-SAME: half [[UNKNOWN:%.*]]) { -; CHECK-NEXT: ret half [[UNKNOWN]] +; CHECK-NEXT: ret half 0xH7E00 ; %frexp = call { half, i32 } @llvm.frexp.f16.i32(half %unknown) %frexp.mant = extractvalue { half, i32 } %frexp, 0 @@ -296,8 +296,7 @@ define nofpclass(qnan) half @ret_nofpclass_qnan__frexp_select_unknown_qnan(i1 %c ; CHECK-LABEL: define nofpclass(qnan) half @ret_nofpclass_qnan__frexp_select_unknown_qnan( ; CHECK-SAME: i1 [[COND:%.*]], half [[UNKNOWN:%.*]]) { ; CHECK-NEXT: [[ONLY_QNAN:%.*]] = call half @returns_qnan() -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], half [[UNKNOWN]], half [[ONLY_QNAN]] -; CHECK-NEXT: [[FREXP:%.*]] = call { half, i32 } @llvm.frexp.f16.i32(half [[SELECT]]) +; CHECK-NEXT: [[FREXP:%.*]] = call { half, i32 } @llvm.frexp.f16.i32(half [[UNKNOWN]]) ; CHECK-NEXT: [[FREXP_MANT:%.*]] = extractvalue { half, i32 } [[FREXP]], 0 ; CHECK-NEXT: ret half [[FREXP_MANT]] ; @@ -513,7 +512,7 @@ define nofpclass(snan) half @src_only_inf__frexp() { define nofpclass(snan) half @src_only_nan__frexp() { ; CHECK-LABEL: define nofpclass(snan) half @src_only_nan__frexp() { ; CHECK-NEXT: [[ONLY_NAN:%.*]] = call half @returns_nan() -; CHECK-NEXT: ret half [[ONLY_NAN]] +; CHECK-NEXT: ret half 0xH7E00 ; %only.nan = call half @returns_nan() %frexp = call { half, i32 } @llvm.frexp.f16.i32(half %only.nan) diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-insertelement.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-insertelement.ll index 36d8766d967aa..8c6679d8be038 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-insertelement.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-insertelement.ll @@ -29,8 +29,7 @@ define nofpclass(qnan inf zero sub norm) <4 x half> @ret_only_snan__insert_unkno define nofpclass(snan inf zero sub norm) <4 x half> @ret_only_qnan__insert_unknown_unknown(<4 x half> %vec, half %elt, i32 %idx) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) <4 x half> @ret_only_qnan__insert_unknown_unknown( ; CHECK-SAME: <4 x half> [[VEC:%.*]], half [[ELT:%.*]], i32 [[IDX:%.*]]) { -; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> [[VEC]], half [[ELT]], i32 [[IDX]] -; CHECK-NEXT: ret <4 x half> [[INSERT]] +; CHECK-NEXT: ret <4 x half> splat (half 0xH7E00) ; %insert = insertelement <4 x half> %vec, half %elt, i32 %idx ret <4 x half> %insert @@ -160,7 +159,7 @@ define nofpclass(snan) <4 x half> @insert_unknown_taints_known_nan_vector_input( ; CHECK-LABEL: define nofpclass(snan) <4 x half> @insert_unknown_taints_known_nan_vector_input( ; CHECK-SAME: half [[UNKNOWN_ELT:%.*]], i32 [[IDX:%.*]]) { ; CHECK-NEXT: [[NAN_VEC:%.*]] = call <4 x half> @returns_nan() -; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> [[NAN_VEC]], half [[UNKNOWN_ELT]], i32 [[IDX]] +; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> splat (half 0xH7E00), half [[UNKNOWN_ELT]], i32 [[IDX]] ; CHECK-NEXT: [[EXP:%.*]] = call <4 x half> @llvm.exp.v4f16(<4 x half> [[INSERT]]) ; CHECK-NEXT: ret <4 x half> [[EXP]] ; @@ -175,7 +174,7 @@ define nofpclass(snan) <4 x half> @insert_unknown_vector_taints_known_nan_vector ; CHECK-LABEL: define nofpclass(snan) <4 x half> @insert_unknown_vector_taints_known_nan_vector_insert( ; CHECK-SAME: <4 x half> [[UNKNOWN_VEC:%.*]], i32 [[IDX:%.*]]) { ; CHECK-NEXT: [[NAN_ELT:%.*]] = call half @returns_nan_f16() -; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> [[UNKNOWN_VEC]], half [[NAN_ELT]], i32 [[IDX]] +; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> [[UNKNOWN_VEC]], half 0xH7E00, i32 [[IDX]] ; CHECK-NEXT: [[EXP:%.*]] = call <4 x half> @llvm.exp.v4f16(<4 x half> [[INSERT]]) ; CHECK-NEXT: ret <4 x half> [[EXP]] ; diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximum.ll index 4c0f2f9d7ae78..b6a6e63af8acb 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximum.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximum.ll @@ -68,8 +68,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan(float %x, float %y define nofpclass(inf norm sub zero snan) float @ret_only_qnan(float %x, float %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan( ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call nsz float @llvm.maximum.f32(float [[X]], float [[Y]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = call float @llvm.maximum.f32(float %x, float %y) ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll index 4c87ca17a3512..2589d80a256d6 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll @@ -67,8 +67,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan(float %x, float %y define nofpclass(inf norm sub zero snan) float @ret_only_qnan(float %x, float %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan( ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call nsz float @llvm.maximumnum.f32(float [[X]], float [[Y]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = call float @llvm.maximumnum.f32(float %x, float %y) ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimum.ll index e62ec503c78ab..fba6e9c45da4d 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimum.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimum.ll @@ -67,8 +67,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan(float %x, float %y define nofpclass(inf norm sub zero snan) float @ret_only_qnan(float %x, float %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan( ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call nsz float @llvm.minimum.f32(float [[X]], float [[Y]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = call float @llvm.minimum.f32(float %x, float %y) ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll index e66e3afb52c77..b67077cb7dbd9 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll @@ -67,8 +67,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan(float %x, float %y define nofpclass(inf norm sub zero snan) float @ret_only_qnan(float %x, float %y) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan( ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call nsz float @llvm.minimumnum.f32(float [[X]], float [[Y]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = call float @llvm.minimumnum.f32(float %x, float %y) ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-rounding-intrinsics.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-rounding-intrinsics.ll index 1d8a08170677f..d1642569c6610 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-rounding-intrinsics.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-rounding-intrinsics.ll @@ -42,8 +42,7 @@ define nofpclass(inf norm sub zero qnan) float @ret_only_snan__floor(float %x) { define nofpclass(inf norm sub zero snan) float @ret_only_qnan__floor(float %x) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) float @ret_only_qnan__floor( ; CHECK-SAME: float [[X:%.*]]) { -; CHECK-NEXT: [[RESULT:%.*]] = call float @llvm.floor.f32(float [[X]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %result = call float @llvm.floor.f32(float %x) ret float %result diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-shufflevector.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-shufflevector.ll index ee8be3ca1bf89..565e9b76ddea3 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-shufflevector.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-shufflevector.ll @@ -28,8 +28,7 @@ define nofpclass(qnan inf zero sub norm) <4 x half> @ret_only_snan__shufflevecto define nofpclass(snan inf zero sub norm) <4 x half> @ret_only_qnan__shufflevector_unknown(<4 x half> %vec0, <4 x half> %vec1) { ; CHECK-LABEL: define nofpclass(snan inf zero sub norm) <4 x half> @ret_only_qnan__shufflevector_unknown( ; CHECK-SAME: <4 x half> [[VEC0:%.*]], <4 x half> [[VEC1:%.*]]) { -; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> [[VEC0]], <4 x half> [[VEC1]], <4 x i32> <i32 6, i32 2, i32 3, i32 0> -; CHECK-NEXT: ret <4 x half> [[SHUFFLE]] +; CHECK-NEXT: ret <4 x half> splat (half 0xH7E00) ; %shuffle = shufflevector <4 x half> %vec0, <4 x half> %vec1, <4 x i32> <i32 6, i32 2, i32 3, i32 0> ret <4 x half> %shuffle @@ -242,7 +241,7 @@ define nofpclass(snan) <4 x half> @ret_nonnan_rhs_taints_known_nan_result(i1 %co ; CHECK-LABEL: define nofpclass(snan) <4 x half> @ret_nonnan_rhs_taints_known_nan_result( ; CHECK-SAME: i1 [[COND:%.*]], <4 x half> [[UNKNOWN:%.*]]) { ; CHECK-NEXT: [[NAN:%.*]] = call <4 x half> @returns_nan() -; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> [[NAN]], <4 x half> [[UNKNOWN]], <4 x i32> <i32 5, i32 0, i32 1, i32 3> +; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> <half 0xH7E00, half 0xH7E00, half poison, half 0xH7E00>, <4 x half> [[UNKNOWN]], <4 x i32> <i32 5, i32 0, i32 1, i32 3> ; CHECK-NEXT: [[EXP:%.*]] = call <4 x half> @llvm.exp.v4f16(<4 x half> [[SHUFFLE]]) ; CHECK-NEXT: ret <4 x half> [[EXP]] ; @@ -257,7 +256,7 @@ define nofpclass(snan) <4 x half> @ret_nonnan_lhs_taints_known_nan_result(i1 %co ; CHECK-LABEL: define nofpclass(snan) <4 x half> @ret_nonnan_lhs_taints_known_nan_result( ; CHECK-SAME: i1 [[COND:%.*]], <4 x half> [[UNKNOWN:%.*]]) { ; CHECK-NEXT: [[NAN:%.*]] = call <4 x half> @returns_nan() -; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> [[UNKNOWN]], <4 x half> [[NAN]], <4 x i32> <i32 5, i32 0, i32 1, i32 3> +; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> [[UNKNOWN]], <4 x half> <half poison, half 0xH7E00, half poison, half poison>, <4 x i32> <i32 5, i32 0, i32 1, i32 3> ; CHECK-NEXT: [[EXP:%.*]] = call <4 x half> @llvm.exp.v4f16(<4 x half> [[SHUFFLE]]) ; CHECK-NEXT: ret <4 x half> [[EXP]] ; diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-sqrt.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-sqrt.ll index b09faf0f4c3af..0520fef0f0e79 100644 --- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-sqrt.ll +++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-sqrt.ll @@ -163,9 +163,7 @@ define nofpclass(inf norm zero) float @ret_only_nan_or_sub__sqrt__select_unknown ; CHECK-LABEL: define nofpclass(inf zero norm) float @ret_only_nan_or_sub__sqrt__select_unknown_or_maybe_ninf( ; CHECK-SAME: i1 [[COND:%.*]], float nofpclass(nan) [[X:%.*]]) { ; CHECK-NEXT: [[MAYBE_NINF:%.*]] = call nofpclass(nan pinf sub norm) float @func() -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0xFFF0000000000000 -; CHECK-NEXT: [[RESULT:%.*]] = call float @llvm.sqrt.f32(float [[SELECT]]) -; CHECK-NEXT: ret float [[RESULT]] +; CHECK-NEXT: ret float 0x7FF8000000000000 ; %maybe.ninf = call nofpclass(pinf norm sub nan) float @func() %select = select i1 %cond, float %x, float %maybe.ninf @@ -178,9 +176,7 @@ define nofpclass(inf norm zero) float @ret_only_nan_or_sub__sqrt__select_unknown ; CHECK-LABEL: define nofpclass(inf zero norm) float @ret_only_nan_or_sub__sqrt__select_unknown_or_maybe_nnorm( ; CHECK-SAME: i1 [[COND:%.*]], float nofpclass(nan) [[X:%.*]]) { ; CHECK-NEXT: [[MAYBE_NNORM:%.*]] = call nofpcl... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/176123 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
