From 82c65cc8f8568dfd86c094a7a599f616ba757f1d Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 17 Jul 2023 17:14:40 -0400 Subject: [PATCH] ValueTracking: Fix computeKnownFPClass for vector-with-scalar powi Fixes regression reported after 0f4eb557e87912afa412b1b0299d10eb7443410b --- llvm/lib/Analysis/ValueTracking.cpp | 8 +- llvm/test/Transforms/Attributor/nofpclass-powi.ll | 97 ++++++++++++++++++----- 2 files changed, 80 insertions(+), 25 deletions(-) diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 209c992..e2fc09c 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4647,10 +4647,12 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, break; const Value *Exp = II->getArgOperand(1); - unsigned BitWidth = - Exp->getType()->getScalarType()->getIntegerBitWidth(); + Type *ExpTy = Exp->getType(); + unsigned BitWidth = ExpTy->getScalarType()->getIntegerBitWidth(); KnownBits ExponentKnownBits(BitWidth); - computeKnownBits(Exp, DemandedElts, ExponentKnownBits, Depth + 1, Q); + computeKnownBits(Exp, + isa(ExpTy) ? DemandedElts : APInt(1, 1), + ExponentKnownBits, Depth + 1, Q); if (ExponentKnownBits.Zero[0]) { // Is even Known.knownNot(fcNegative); diff --git a/llvm/test/Transforms/Attributor/nofpclass-powi.ll b/llvm/test/Transforms/Attributor/nofpclass-powi.ll index 29e6d99..e216bf7 100644 --- a/llvm/test/Transforms/Attributor/nofpclass-powi.ll +++ b/llvm/test/Transforms/Attributor/nofpclass-powi.ll @@ -5,11 +5,12 @@ declare float @llvm.powi.f32.i32(float, i32) declare float @llvm.powi.f32.i64(float, i64) declare <2 x float> @llvm.powi.v2f32.v2i32(<2 x float>, <2 x i32>) +declare <4 x float> @llvm.powi.v4f32.i32(<4 x float>, i32) define float @ret_powi_f32(float %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32 ; CHECK-SAME: (float [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1:[0-9]+]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5:[0-9]+]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6:[0-9]+]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -19,7 +20,7 @@ define float @ret_powi_f32(float %arg0, i32 %arg1) #0 { define float @ret_powi_f32_i64(float %arg0, i64 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_i64 ; CHECK-SAME: (float [[ARG0:%.*]], i64 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i64(float [[ARG0]], i64 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i64(float [[ARG0]], i64 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i64(float %arg0, i64 %arg1) @@ -29,7 +30,7 @@ define float @ret_powi_f32_i64(float %arg0, i64 %arg1) #0 { define <2 x float> @ret_powi_v2f32(<2 x float> %arg0, <2 x i32> %arg1) #0 { ; CHECK-LABEL: define <2 x float> @ret_powi_v2f32 ; CHECK-SAME: (<2 x float> [[ARG0:%.*]], <2 x i32> [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret <2 x float> [[CALL]] ; %call = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> %arg0, <2 x i32> %arg1) @@ -39,7 +40,7 @@ define <2 x float> @ret_powi_v2f32(<2 x float> %arg0, <2 x i32> %arg1) #0 { define float @ret_powi_f32_odd_constant(float %arg0) #0 { ; CHECK-LABEL: define float @ret_powi_f32_odd_constant ; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 noundef 3) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 noundef 3) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 3) @@ -49,7 +50,7 @@ define float @ret_powi_f32_odd_constant(float %arg0) #0 { define float @ret_powi_f32_even_constant(float %arg0) #0 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_even_constant ; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 noundef 4) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 noundef 4) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 4) @@ -59,7 +60,7 @@ define float @ret_powi_f32_even_constant(float %arg0) #0 { define <2 x float> @ret_powi_v2f32_even_nonsplat(<2 x float> %arg0) #0 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) <2 x float> @ret_powi_v2f32_even_nonsplat ; CHECK-SAME: (<2 x float> [[ARG0:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> noundef ) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> noundef ) #[[ATTR6]] ; CHECK-NEXT: ret <2 x float> [[CALL]] ; %call = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> %arg0, <2 x i32> ) @@ -69,7 +70,7 @@ define <2 x float> @ret_powi_v2f32_even_nonsplat(<2 x float> %arg0) #0 { define <2 x float> @ret_powi_v2f32_odd_nonsplat(<2 x float> %arg0) #0 { ; CHECK-LABEL: define <2 x float> @ret_powi_v2f32_odd_nonsplat ; CHECK-SAME: (<2 x float> [[ARG0:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> noundef ) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> noundef ) #[[ATTR6]] ; CHECK-NEXT: ret <2 x float> [[CALL]] ; %call = call <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> %arg0, <2 x i32> ) @@ -80,7 +81,7 @@ define float @ret_powi_f32_masked_to_even(float %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_masked_to_even ; CHECK-SAME: (float [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { ; CHECK-NEXT: [[KNOWN_EVEN:%.*]] = and i32 [[ARG1]], -2 -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[KNOWN_EVEN]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[KNOWN_EVEN]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %known.even = and i32 %arg1, -2 @@ -92,7 +93,7 @@ define float @ret_powi_f32_masked_to_even_extrabits(float %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_masked_to_even_extrabits ; CHECK-SAME: (float [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { ; CHECK-NEXT: [[KNOWN_EVEN:%.*]] = and i32 [[ARG1]], -4 -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[KNOWN_EVEN]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[KNOWN_EVEN]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %known.even = and i32 %arg1, -4 @@ -104,7 +105,7 @@ define <2 x float> @ret_powi_v2f32_masked_to_even(<2 x float> %arg0, <2 x i32> % ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) <2 x float> @ret_powi_v2f32_masked_to_even ; CHECK-SAME: (<2 x float> [[ARG0:%.*]], <2 x i32> [[ARG1:%.*]]) #[[ATTR1]] { ; CHECK-NEXT: [[KNOWN_EVEN:%.*]] = and <2 x i32> [[ARG1]], -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> [[KNOWN_EVEN]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) <2 x float> @llvm.powi.v2f32.v2i32(<2 x float> [[ARG0]], <2 x i32> [[KNOWN_EVEN]]) #[[ATTR6]] ; CHECK-NEXT: ret <2 x float> [[CALL]] ; %known.even = and <2 x i32> %arg1, @@ -115,7 +116,7 @@ define <2 x float> @ret_powi_v2f32_masked_to_even(<2 x float> %arg0, <2 x i32> % define float @ret_powi_f32_noneg(float nofpclass(ninf nsub nnorm) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_noneg ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -125,7 +126,7 @@ define float @ret_powi_f32_noneg(float nofpclass(ninf nsub nnorm) %arg0, i32 %ar define float @ret_powi_f32_noneg_nonzero(float nofpclass(ninf nsub nnorm nzero) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_noneg_nonzero ; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -135,7 +136,7 @@ define float @ret_powi_f32_noneg_nonzero(float nofpclass(ninf nsub nnorm nzero) define float @ret_powi_f32_noneg_nozero(float nofpclass(ninf nsub nnorm) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_noneg_nozero ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -145,7 +146,7 @@ define float @ret_powi_f32_noneg_nozero(float nofpclass(ninf nsub nnorm) %arg0, define float @ret_powi_f32_nonzero(float nofpclass(nzero) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_nonzero ; CHECK-SAME: (float nofpclass(nzero) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -155,7 +156,7 @@ define float @ret_powi_f32_nonzero(float nofpclass(nzero) %arg0, i32 %arg1) #0 { define float @ret_powi_f32_nopzero(float nofpclass(pzero) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_nopzero ; CHECK-SAME: (float nofpclass(pzero) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -165,7 +166,7 @@ define float @ret_powi_f32_nopzero(float nofpclass(pzero) %arg0, i32 %arg1) #0 { define float @ret_powi_f32_noneg_ftz_daz(float nofpclass(ninf nsub nnorm) %arg0, i32 %arg1) #1 { ; CHECK-LABEL: define float @ret_powi_f32_noneg_ftz_daz ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR2:[0-9]+]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -175,7 +176,7 @@ define float @ret_powi_f32_noneg_ftz_daz(float nofpclass(ninf nsub nnorm) %arg0, define float @ret_powi_f32_noneg_nonzero_ftz_daz(float nofpclass(ninf nsub nnorm nzero) %arg0, i32 %arg1) #1 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_noneg_nonzero_ftz_daz ; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR2]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -185,7 +186,7 @@ define float @ret_powi_f32_noneg_nonzero_ftz_daz(float nofpclass(ninf nsub nnorm define float @ret_powi_f32_noneg_nonzero_ftpz_dapz(float nofpclass(ninf nsub nnorm nzero) %arg0, i32 %arg1) #2 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_noneg_nonzero_ftpz_dapz ; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR3:[0-9]+]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -195,7 +196,7 @@ define float @ret_powi_f32_noneg_nonzero_ftpz_dapz(float nofpclass(ninf nsub nno define float @ret_powi_f32_noninf_nonnorm(float nofpclass(ninf nnorm) %arg0, i32 %arg1) #0 { ; CHECK-LABEL: define float @ret_powi_f32_noninf_nonnorm ; CHECK-SAME: (float nofpclass(ninf nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -205,7 +206,7 @@ define float @ret_powi_f32_noninf_nonnorm(float nofpclass(ninf nnorm) %arg0, i32 define float @ret_powi_f32_noninf_nonnorm_ftz_daz(float nofpclass(ninf nnorm) %arg0, i32 %arg1) #1 { ; CHECK-LABEL: define float @ret_powi_f32_noninf_nonnorm_ftz_daz ; CHECK-SAME: (float nofpclass(ninf nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR2]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -215,7 +216,7 @@ define float @ret_powi_f32_noninf_nonnorm_ftz_daz(float nofpclass(ninf nnorm) %a define float @ret_powi_f32_noneg_ftz_ieee(float nofpclass(ninf nsub nnorm) %arg0, i32 %arg1) #3 { ; CHECK-LABEL: define float @ret_powi_f32_noneg_ftz_ieee ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR4:[0-9]+]] { -; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) @@ -225,13 +226,65 @@ define float @ret_powi_f32_noneg_ftz_ieee(float nofpclass(ninf nsub nnorm) %arg0 define float @ret_powi_f32_noneg_nonzero_ftz_ieee(float nofpclass(ninf nsub nnorm nzero) %arg0, i32 %arg1) #3 { ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_powi_f32_noneg_nonzero_ftz_ieee ; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR4]] { -; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR5]] +; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.powi.f32.i32(float [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] ; CHECK-NEXT: ret float [[CALL]] ; %call = call float @llvm.powi.f32.i32(float %arg0, i32 %arg1) ret float %call } +define <4 x float> @powi_v4f32_i32(<4 x float> %arg0, i32 %arg1) { +; CHECK-LABEL: define <4 x float> @powi_v4f32_i32 +; CHECK-SAME: (<4 x float> [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR5:[0-9]+]] { +; CHECK-NEXT: [[POWI:%.*]] = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] +; CHECK-NEXT: ret <4 x float> [[POWI]] +; + %powi = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %arg0, i32 %arg1) + ret <4 x float> %powi +} + +define <4 x float> @powi_v4f32_i32_nozero(<4 x float> nofpclass(zero) %arg0, i32 %arg1) { +; CHECK-LABEL: define <4 x float> @powi_v4f32_i32_nozero +; CHECK-SAME: (<4 x float> nofpclass(zero) [[ARG0:%.*]], i32 [[ARG1:%.*]]) #[[ATTR5]] { +; CHECK-NEXT: [[POWI:%.*]] = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[ARG0]], i32 [[ARG1]]) #[[ATTR6]] +; CHECK-NEXT: ret <4 x float> [[POWI]] +; + %powi = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %arg0, i32 %arg1) + ret <4 x float> %powi +} + +define <4 x float> @powi_v4f32_i32_constint_even(<4 x float> %arg) { +; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) <4 x float> @powi_v4f32_i32_constint_even +; CHECK-SAME: (<4 x float> [[ARG:%.*]]) #[[ATTR5]] { +; CHECK-NEXT: [[POWI:%.*]] = call nofpclass(ninf nzero nsub nnorm) <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[ARG]], i32 noundef 4) #[[ATTR6]] +; CHECK-NEXT: ret <4 x float> [[POWI]] +; + %powi = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %arg, i32 4) + ret <4 x float> %powi +} + +define <4 x float> @powi_v4f32_i32_constint_odd(<4 x float> %arg) { +; CHECK-LABEL: define <4 x float> @powi_v4f32_i32_constint_odd +; CHECK-SAME: (<4 x float> [[ARG:%.*]]) #[[ATTR5]] { +; CHECK-NEXT: [[POWI:%.*]] = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[ARG]], i32 noundef 3) #[[ATTR6]] +; CHECK-NEXT: ret <4 x float> [[POWI]] +; + %powi = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %arg, i32 3) + ret <4 x float> %powi +} + +define <4 x float> @powi_v4f32_i32_regression(<4 x float> %arg) { +; CHECK-LABEL: define nofpclass(nzero) <4 x float> @powi_v4f32_i32_regression +; CHECK-SAME: (<4 x float> [[ARG:%.*]]) #[[ATTR5]] { +; CHECK-NEXT: [[POWI:%.*]] = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[ARG]], i32 noundef 4) #[[ATTR6]] +; CHECK-NEXT: [[USER:%.*]] = fsub <4 x float> [[POWI]], +; CHECK-NEXT: ret <4 x float> [[USER]] +; + %powi = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %arg, i32 4) + %user = fsub <4 x float> %powi, + ret <4 x float> %user +} + attributes #0 = { "denormal-fp-math"="ieee,ieee" } attributes #1 = { "denormal-fp-math"="preserve-sign,preserve-sign" } attributes #2 = { "denormal-fp-math"="positive-zero,positive-zero" } -- 2.7.4