diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp index e81cdd29c8f16..18a13cc808672 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp @@ -741,20 +741,49 @@ GCNTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, // Legalize the type. std::pair LT = getTypeLegalizationCost(RetTy); MVT::SimpleValueType SLT = LT.second.getScalarType().SimpleTy; + unsigned NElts = + LT.second.isVector() ? LT.second.getVectorNumElements() : 1; if (SLT == MVT::f64) { - int NumOps = 20; + unsigned NumOps = 20; if (IID == Intrinsic::exp) ++NumOps; else if (IID == Intrinsic::exp10) NumOps += 3; - unsigned NElts = - LT.second.isVector() ? LT.second.getVectorNumElements() : 1; - return LT.first * NElts * NumOps * get64BitInstrCost(CostKind); } + if (SLT == MVT::f32) { + unsigned NumFullRateOps = 0; + // v_exp_f32 (quarter rate). + unsigned NumQuarterRateOps = 1; + + if (!ICA.getFlags().approxFunc() && IID != Intrinsic::exp2) { + // Non-AFN exp/exp10: range reduction + v_exp_f32 + ldexp + + // overflow/underflow checks (lowerFEXP). Denorm is also handled. + // FMA preamble: ~13 full-rate ops; non-FMA: ~17. + NumFullRateOps = ST->hasFastFMAF32() ? 13 : 17; + } else { + if (IID == Intrinsic::exp) { + // lowerFEXPUnsafe: fmul (base conversion) + v_exp_f32. + NumFullRateOps = 1; + } else if (IID == Intrinsic::exp10) { + // lowerFEXP10Unsafe: 3 fmul + 2 v_exp_f32 (double-exp2). + NumFullRateOps = 3; + NumQuarterRateOps = 2; + } + // Denorm scaling adds setcc + select + fadd + select + fmul. + if (HasFP32Denormals) + NumFullRateOps += 5; + } + + InstructionCost Cost = + NumFullRateOps * getFullRateInstrCost() + + NumQuarterRateOps * getQuarterRateInstrCost(CostKind); + return LT.first * NElts * Cost; + } + break; } default: diff --git a/llvm/test/Analysis/CostModel/AMDGPU/exp.ll b/llvm/test/Analysis/CostModel/AMDGPU/exp.ll index 2383b7e3be80f..c51004edc847c 100644 --- a/llvm/test/Analysis/CostModel/AMDGPU/exp.ll +++ b/llvm/test/Analysis/CostModel/AMDGPU/exp.ll @@ -11,14 +11,14 @@ define void @exp_f16() { ; BASE-LABEL: 'exp_f16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp.f16(half poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp.v2f16(<2 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp.v3f16(<3 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp.v4f16(<4 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp.v5f16(<5 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp.v8f16(<8 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp.v16f16(<16 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp.v17f16(<17 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f16 = call half @llvm.exp.f16(half poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f16 = call <2 x half> @llvm.exp.v2f16(<2 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v3f16 = call <3 x half> @llvm.exp.v3f16(<3 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f16 = call <4 x half> @llvm.exp.v4f16(<4 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v5f16 = call <5 x half> @llvm.exp.v5f16(<5 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f16 = call <8 x half> @llvm.exp.v8f16(<8 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16f16 = call <16 x half> @llvm.exp.v16f16(<16 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 714 for instruction: %v17f16 = call <17 x half> @llvm.exp.v17f16(<17 x half> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp_f16' @@ -55,14 +55,14 @@ define void @exp_f16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp_f16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp.f16(half poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp.v2f16(<2 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp.v3f16(<3 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp.v4f16(<4 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp.v5f16(<5 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp.v8f16(<8 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp.v16f16(<16 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp.v17f16(<17 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f16 = call half @llvm.exp.f16(half poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f16 = call <2 x half> @llvm.exp.v2f16(<2 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v3f16 = call <3 x half> @llvm.exp.v3f16(<3 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f16 = call <4 x half> @llvm.exp.v4f16(<4 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v5f16 = call <5 x half> @llvm.exp.v5f16(<5 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f16 = call <8 x half> @llvm.exp.v8f16(<8 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 304 for instruction: %v16f16 = call <16 x half> @llvm.exp.v16f16(<16 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 646 for instruction: %v17f16 = call <17 x half> @llvm.exp.v17f16(<17 x half> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp_f16' @@ -111,14 +111,14 @@ define void @exp_f16() { define void @exp_bf16() { ; BASE-LABEL: 'exp_bf16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp.bf16(bfloat poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp.v2bf16(<2 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp.v3bf16(<3 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp.v4bf16(<4 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp.v5bf16(<5 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp.v8bf16(<8 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp.v16bf16(<16 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp.v17bf16(<17 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %bf16 = call bfloat @llvm.exp.bf16(bfloat poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp.v2bf16(<2 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp.v3bf16(<3 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp.v4bf16(<4 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp.v5bf16(<5 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp.v8bf16(<8 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp.v16bf16(<16 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 714 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp.v17bf16(<17 x bfloat> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp_bf16' @@ -155,14 +155,14 @@ define void @exp_bf16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp_bf16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp.bf16(bfloat poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp.v2bf16(<2 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp.v3bf16(<3 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp.v4bf16(<4 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp.v5bf16(<5 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp.v8bf16(<8 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp.v16bf16(<16 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp.v17bf16(<17 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %bf16 = call bfloat @llvm.exp.bf16(bfloat poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp.v2bf16(<2 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp.v3bf16(<3 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp.v4bf16(<4 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp.v5bf16(<5 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp.v8bf16(<8 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 304 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp.v16bf16(<16 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 646 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp.v17bf16(<17 x bfloat> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp_bf16' @@ -210,27 +210,93 @@ define void @exp_bf16() { } define void @exp_f32() { -; ALL-LABEL: 'exp_f32' -; ALL-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp.f32(float poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; BASE-LABEL: 'exp_f32' +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; -; ALL-SIZE-LABEL: 'exp_f32' -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp.f32(float poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; GFX8-LABEL: 'exp_f32' +; GFX8-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX9-LABEL: 'exp_f32' +; GFX9-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX10-LABEL: 'exp_f32' +; GFX10-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; BASE-SIZE-LABEL: 'exp_f32' +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX8-SIZE-LABEL: 'exp_f32' +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX9-SIZE-LABEL: 'exp_f32' +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX10-SIZE-LABEL: 'exp_f32' +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %f32 = call float @llvm.exp.f32(float poison) %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) @@ -276,3 +342,174 @@ define void @exp_f64() { %v17f64 = call <17 x double> @llvm.exp.v17f64(<17 x double> poison) ret void } + +define void @exp_f32_afn_ieee() #0 { +; ALL-LABEL: 'exp_f32_afn_ieee' +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %f32 = call afn float @llvm.exp.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 40 for instruction: %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 50 for instruction: %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 80 for instruction: %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 480 for instruction: %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 1280 for instruction: %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp_f32_afn_ieee' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %f32 = call afn float @llvm.exp.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 40 for instruction: %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 384 for instruction: %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1024 for instruction: %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) + ret void +} + +define void @exp_f32_afn_daz() #1 { +; ALL-LABEL: 'exp_f32_afn_daz' +; ALL-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %f32 = call afn float @llvm.exp.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 25 for instruction: %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 40 for instruction: %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 240 for instruction: %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 640 for instruction: %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp_f32_afn_daz' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %f32 = call afn float @llvm.exp.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 384 for instruction: %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp.v17f32(<17 x float> poison) + ret void +} + +define void @exp_f32_daz() #1 { +; BASE-LABEL: 'exp_f32_daz' +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX8-LABEL: 'exp_f32_daz' +; GFX8-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX9-LABEL: 'exp_f32_daz' +; GFX9-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX10-LABEL: 'exp_f32_daz' +; GFX10-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; BASE-SIZE-LABEL: 'exp_f32_daz' +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX8-SIZE-LABEL: 'exp_f32_daz' +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX9-SIZE-LABEL: 'exp_f32_daz' +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX10-SIZE-LABEL: 'exp_f32_daz' +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp.f32(float poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call float @llvm.exp.f32(float poison) + %v2f32 = call <2 x float> @llvm.exp.v2f32(<2 x float> poison) + %v3f32 = call <3 x float> @llvm.exp.v3f32(<3 x float> poison) + %v4f32 = call <4 x float> @llvm.exp.v4f32(<4 x float> poison) + %v5f32 = call <5 x float> @llvm.exp.v5f32(<5 x float> poison) + %v8f32 = call <8 x float> @llvm.exp.v8f32(<8 x float> poison) + %v16f32 = call <16 x float> @llvm.exp.v16f32(<16 x float> poison) + %v17f32 = call <17 x float> @llvm.exp.v17f32(<17 x float> poison) + ret void +} + +attributes #0 = { nounwind denormal_fpenv(float: ieee|ieee) } +attributes #1 = { nounwind denormal_fpenv(float: preservesign) } diff --git a/llvm/test/Analysis/CostModel/AMDGPU/exp10.ll b/llvm/test/Analysis/CostModel/AMDGPU/exp10.ll index 5df77c7784e45..067532e23df7a 100644 --- a/llvm/test/Analysis/CostModel/AMDGPU/exp10.ll +++ b/llvm/test/Analysis/CostModel/AMDGPU/exp10.ll @@ -11,14 +11,14 @@ define void @exp10_f16() { ; BASE-LABEL: 'exp10_f16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp10.f16(half poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp10.v2f16(<2 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp10.v3f16(<3 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp10.v4f16(<4 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp10.v5f16(<5 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp10.v8f16(<8 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp10.v16f16(<16 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp10.v17f16(<17 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f16 = call half @llvm.exp10.f16(half poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f16 = call <2 x half> @llvm.exp10.v2f16(<2 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v3f16 = call <3 x half> @llvm.exp10.v3f16(<3 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f16 = call <4 x half> @llvm.exp10.v4f16(<4 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v5f16 = call <5 x half> @llvm.exp10.v5f16(<5 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f16 = call <8 x half> @llvm.exp10.v8f16(<8 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16f16 = call <16 x half> @llvm.exp10.v16f16(<16 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 714 for instruction: %v17f16 = call <17 x half> @llvm.exp10.v17f16(<17 x half> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp10_f16' @@ -55,14 +55,14 @@ define void @exp10_f16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp10_f16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp10.f16(half poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp10.v2f16(<2 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp10.v3f16(<3 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp10.v4f16(<4 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp10.v5f16(<5 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp10.v8f16(<8 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp10.v16f16(<16 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp10.v17f16(<17 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f16 = call half @llvm.exp10.f16(half poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f16 = call <2 x half> @llvm.exp10.v2f16(<2 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v3f16 = call <3 x half> @llvm.exp10.v3f16(<3 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f16 = call <4 x half> @llvm.exp10.v4f16(<4 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v5f16 = call <5 x half> @llvm.exp10.v5f16(<5 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f16 = call <8 x half> @llvm.exp10.v8f16(<8 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 304 for instruction: %v16f16 = call <16 x half> @llvm.exp10.v16f16(<16 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 646 for instruction: %v17f16 = call <17 x half> @llvm.exp10.v17f16(<17 x half> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp10_f16' @@ -111,14 +111,14 @@ define void @exp10_f16() { define void @exp10_bf16() { ; BASE-LABEL: 'exp10_bf16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp10.bf16(bfloat poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp10.v2bf16(<2 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp10.v3bf16(<3 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp10.v4bf16(<4 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp10.v5bf16(<5 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp10.v8bf16(<8 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp10.v16bf16(<16 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp10.v17bf16(<17 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %bf16 = call bfloat @llvm.exp10.bf16(bfloat poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp10.v2bf16(<2 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp10.v3bf16(<3 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp10.v4bf16(<4 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp10.v5bf16(<5 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp10.v8bf16(<8 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp10.v16bf16(<16 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 714 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp10.v17bf16(<17 x bfloat> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp10_bf16' @@ -155,14 +155,14 @@ define void @exp10_bf16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp10_bf16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp10.bf16(bfloat poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp10.v2bf16(<2 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp10.v3bf16(<3 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp10.v4bf16(<4 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp10.v5bf16(<5 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp10.v8bf16(<8 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp10.v16bf16(<16 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp10.v17bf16(<17 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %bf16 = call bfloat @llvm.exp10.bf16(bfloat poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp10.v2bf16(<2 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp10.v3bf16(<3 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp10.v4bf16(<4 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp10.v5bf16(<5 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp10.v8bf16(<8 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 304 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp10.v16bf16(<16 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 646 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp10.v17bf16(<17 x bfloat> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp10_bf16' @@ -210,27 +210,93 @@ define void @exp10_bf16() { } define void @exp10_f32() { -; ALL-LABEL: 'exp10_f32' -; ALL-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp10.f32(float poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; BASE-LABEL: 'exp10_f32' +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; -; ALL-SIZE-LABEL: 'exp10_f32' -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp10.f32(float poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; GFX8-LABEL: 'exp10_f32' +; GFX8-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX9-LABEL: 'exp10_f32' +; GFX9-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX10-LABEL: 'exp10_f32' +; GFX10-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; BASE-SIZE-LABEL: 'exp10_f32' +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX8-SIZE-LABEL: 'exp10_f32' +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX9-SIZE-LABEL: 'exp10_f32' +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX10-SIZE-LABEL: 'exp10_f32' +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %f32 = call float @llvm.exp10.f32(float poison) %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) @@ -276,3 +342,174 @@ define void @exp10_f64() { %v17f64 = call <17 x double> @llvm.exp10.v17f64(<17 x double> poison) ret void } + +define void @exp10_f32_afn_ieee() #0 { +; ALL-LABEL: 'exp10_f32_afn_ieee' +; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %f32 = call afn float @llvm.exp10.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 80 for instruction: %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 768 for instruction: %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 2048 for instruction: %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp10_f32_afn_ieee' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %f32 = call afn float @llvm.exp10.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 576 for instruction: %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1536 for instruction: %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp10.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) + ret void +} + +define void @exp10_f32_afn_daz() #1 { +; ALL-LABEL: 'exp10_f32_afn_daz' +; ALL-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %f32 = call afn float @llvm.exp10.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 44 for instruction: %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 55 for instruction: %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 88 for instruction: %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 528 for instruction: %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 1408 for instruction: %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp10_f32_afn_daz' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %f32 = call afn float @llvm.exp10.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 35 for instruction: %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 896 for instruction: %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp10.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp10.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp10.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp10.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp10.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp10.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp10.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp10.v17f32(<17 x float> poison) + ret void +} + +define void @exp10_f32_daz() #1 { +; BASE-LABEL: 'exp10_f32_daz' +; BASE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX8-LABEL: 'exp10_f32_daz' +; GFX8-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 63 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 105 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 1008 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 2688 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX8-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX9-LABEL: 'exp10_f32_daz' +; GFX9-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; GFX10-LABEL: 'exp10_f32_daz' +; GFX10-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 51 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 85 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 816 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 2176 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; BASE-SIZE-LABEL: 'exp10_f32_daz' +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX8-SIZE-LABEL: 'exp10_f32_daz' +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 57 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 76 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 95 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 152 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 912 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 2432 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX8-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX9-SIZE-LABEL: 'exp10_f32_daz' +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX9-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; +; GFX10-SIZE-LABEL: 'exp10_f32_daz' +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %f32 = call float @llvm.exp10.f32(float poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 75 for instruction: %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 720 for instruction: %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1920 for instruction: %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) +; GFX10-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call float @llvm.exp10.f32(float poison) + %v2f32 = call <2 x float> @llvm.exp10.v2f32(<2 x float> poison) + %v3f32 = call <3 x float> @llvm.exp10.v3f32(<3 x float> poison) + %v4f32 = call <4 x float> @llvm.exp10.v4f32(<4 x float> poison) + %v5f32 = call <5 x float> @llvm.exp10.v5f32(<5 x float> poison) + %v8f32 = call <8 x float> @llvm.exp10.v8f32(<8 x float> poison) + %v16f32 = call <16 x float> @llvm.exp10.v16f32(<16 x float> poison) + %v17f32 = call <17 x float> @llvm.exp10.v17f32(<17 x float> poison) + ret void +} + +attributes #0 = { nounwind denormal_fpenv(float: ieee|ieee) } +attributes #1 = { nounwind denormal_fpenv(float: preservesign) } diff --git a/llvm/test/Analysis/CostModel/AMDGPU/exp2.ll b/llvm/test/Analysis/CostModel/AMDGPU/exp2.ll index 4f1673dc528df..0e2483448e8f9 100644 --- a/llvm/test/Analysis/CostModel/AMDGPU/exp2.ll +++ b/llvm/test/Analysis/CostModel/AMDGPU/exp2.ll @@ -11,14 +11,14 @@ define void @exp2_f16() { ; BASE-LABEL: 'exp2_f16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp2.f16(half poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp2.v2f16(<2 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp2.v3f16(<3 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp2.v4f16(<4 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp2.v5f16(<5 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp2.v8f16(<8 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp2.v16f16(<16 x half> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp2.v17f16(<17 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %f16 = call half @llvm.exp2.f16(half poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v2f16 = call <2 x half> @llvm.exp2.v2f16(<2 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v3f16 = call <3 x half> @llvm.exp2.v3f16(<3 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v4f16 = call <4 x half> @llvm.exp2.v4f16(<4 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v5f16 = call <5 x half> @llvm.exp2.v5f16(<5 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v8f16 = call <8 x half> @llvm.exp2.v8f16(<8 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v16f16 = call <16 x half> @llvm.exp2.v16f16(<16 x half> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 306 for instruction: %v17f16 = call <17 x half> @llvm.exp2.v17f16(<17 x half> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp2_f16' @@ -55,14 +55,14 @@ define void @exp2_f16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp2_f16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f16 = call half @llvm.exp2.f16(half poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f16 = call <2 x half> @llvm.exp2.v2f16(<2 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3f16 = call <3 x half> @llvm.exp2.v3f16(<3 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f16 = call <4 x half> @llvm.exp2.v4f16(<4 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5f16 = call <5 x half> @llvm.exp2.v5f16(<5 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f16 = call <8 x half> @llvm.exp2.v8f16(<8 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f16 = call <16 x half> @llvm.exp2.v16f16(<16 x half> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17f16 = call <17 x half> @llvm.exp2.v17f16(<17 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %f16 = call half @llvm.exp2.f16(half poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %v2f16 = call <2 x half> @llvm.exp2.v2f16(<2 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v3f16 = call <3 x half> @llvm.exp2.v3f16(<3 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v4f16 = call <4 x half> @llvm.exp2.v4f16(<4 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v5f16 = call <5 x half> @llvm.exp2.v5f16(<5 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v8f16 = call <8 x half> @llvm.exp2.v8f16(<8 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %v16f16 = call <16 x half> @llvm.exp2.v16f16(<16 x half> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 238 for instruction: %v17f16 = call <17 x half> @llvm.exp2.v17f16(<17 x half> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp2_f16' @@ -111,14 +111,14 @@ define void @exp2_f16() { define void @exp2_bf16() { ; BASE-LABEL: 'exp2_bf16' -; BASE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp2.bf16(bfloat poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp2.v2bf16(<2 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp2.v3bf16(<3 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp2.v4bf16(<4 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp2.v5bf16(<5 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp2.v8bf16(<8 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp2.v16bf16(<16 x bfloat> poison) -; BASE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp2.v17bf16(<17 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %bf16 = call bfloat @llvm.exp2.bf16(bfloat poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp2.v2bf16(<2 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp2.v3bf16(<3 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp2.v4bf16(<4 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp2.v5bf16(<5 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp2.v8bf16(<8 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp2.v16bf16(<16 x bfloat> poison) +; BASE-NEXT: Cost Model: Found an estimated cost of 306 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp2.v17bf16(<17 x bfloat> poison) ; BASE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; GFX8-LABEL: 'exp2_bf16' @@ -155,14 +155,14 @@ define void @exp2_bf16() { ; GFX10-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; BASE-SIZE-LABEL: 'exp2_bf16' -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bf16 = call bfloat @llvm.exp2.bf16(bfloat poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp2.v2bf16(<2 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp2.v3bf16(<3 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp2.v4bf16(<4 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp2.v5bf16(<5 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp2.v8bf16(<8 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp2.v16bf16(<16 x bfloat> poison) -; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp2.v17bf16(<17 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %bf16 = call bfloat @llvm.exp2.bf16(bfloat poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %v2bf16 = call <2 x bfloat> @llvm.exp2.v2bf16(<2 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v3bf16 = call <3 x bfloat> @llvm.exp2.v3bf16(<3 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v4bf16 = call <4 x bfloat> @llvm.exp2.v4bf16(<4 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v5bf16 = call <5 x bfloat> @llvm.exp2.v5bf16(<5 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v8bf16 = call <8 x bfloat> @llvm.exp2.v8bf16(<8 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %v16bf16 = call <16 x bfloat> @llvm.exp2.v16bf16(<16 x bfloat> poison) +; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 238 for instruction: %v17bf16 = call <17 x bfloat> @llvm.exp2.v17bf16(<17 x bfloat> poison) ; BASE-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; GFX8-SIZE-LABEL: 'exp2_bf16' @@ -211,25 +211,25 @@ define void @exp2_bf16() { define void @exp2_f32() { ; ALL-LABEL: 'exp2_f32' -; ALL-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp2.f32(float poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) -; ALL-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %f32 = call float @llvm.exp2.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 27 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 1152 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void ; ; ALL-SIZE-LABEL: 'exp2_f32' -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp2.f32(float poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) -; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %f32 = call float @llvm.exp2.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 35 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 896 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %f32 = call float @llvm.exp2.f32(float poison) @@ -276,3 +276,108 @@ define void @exp2_f64() { %v17f64 = call <17 x double> @llvm.exp2.v17f64(<17 x double> poison) ret void } + +define void @exp2_f32_afn_ieee() #0 { +; ALL-LABEL: 'exp2_f32_afn_ieee' +; ALL-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %f32 = call afn float @llvm.exp2.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 27 for instruction: %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 1152 for instruction: %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp2_f32_afn_ieee' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %f32 = call afn float @llvm.exp2.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 35 for instruction: %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 336 for instruction: %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 896 for instruction: %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp2.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) + ret void +} + +define void @exp2_f32_afn_daz() #1 { +; ALL-LABEL: 'exp2_f32_afn_daz' +; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f32 = call afn float @llvm.exp2.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 512 for instruction: %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp2_f32_afn_daz' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.exp2.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call afn float @llvm.exp2.f32(float poison) + %v2f32 = call afn <2 x float> @llvm.exp2.v2f32(<2 x float> poison) + %v3f32 = call afn <3 x float> @llvm.exp2.v3f32(<3 x float> poison) + %v4f32 = call afn <4 x float> @llvm.exp2.v4f32(<4 x float> poison) + %v5f32 = call afn <5 x float> @llvm.exp2.v5f32(<5 x float> poison) + %v8f32 = call afn <8 x float> @llvm.exp2.v8f32(<8 x float> poison) + %v16f32 = call afn <16 x float> @llvm.exp2.v16f32(<16 x float> poison) + %v17f32 = call afn <17 x float> @llvm.exp2.v17f32(<17 x float> poison) + ret void +} + +define void @exp2_f32_daz() #1 { +; ALL-LABEL: 'exp2_f32_daz' +; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f32 = call float @llvm.exp2.f32(float poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 512 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void +; +; ALL-SIZE-LABEL: 'exp2_f32_daz' +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.exp2.f32(float poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) +; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + %f32 = call float @llvm.exp2.f32(float poison) + %v2f32 = call <2 x float> @llvm.exp2.v2f32(<2 x float> poison) + %v3f32 = call <3 x float> @llvm.exp2.v3f32(<3 x float> poison) + %v4f32 = call <4 x float> @llvm.exp2.v4f32(<4 x float> poison) + %v5f32 = call <5 x float> @llvm.exp2.v5f32(<5 x float> poison) + %v8f32 = call <8 x float> @llvm.exp2.v8f32(<8 x float> poison) + %v16f32 = call <16 x float> @llvm.exp2.v16f32(<16 x float> poison) + %v17f32 = call <17 x float> @llvm.exp2.v17f32(<17 x float> poison) + ret void +} + +attributes #0 = { nounwind denormal_fpenv(float: ieee|ieee) } +attributes #1 = { nounwind denormal_fpenv(float: preservesign) } diff --git a/llvm/test/Transforms/SLPVectorizer/AMDGPU/exp2-vectorize.ll b/llvm/test/Transforms/SLPVectorizer/AMDGPU/exp2-vectorize.ll new file mode 100644 index 0000000000000..a4f7ef9e7bb59 --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/AMDGPU/exp2-vectorize.ll @@ -0,0 +1,83 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6 +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -passes=slp-vectorizer %s | FileCheck -check-prefix=GFX9 %s +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 -passes=slp-vectorizer %s | FileCheck -check-prefix=GFX1250 %s + +define amdgpu_kernel void @exp2_combine(ptr addrspace(1) %arg) { +; GFX9-LABEL: define amdgpu_kernel void @exp2_combine( +; GFX9-SAME: ptr addrspace(1) [[ARG:%.*]]) #[[ATTR0:[0-9]+]] { +; GFX9-NEXT: [[TID:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() +; GFX9-NEXT: [[IDX:%.*]] = zext i32 [[TID]] to i64 +; GFX9-NEXT: [[PTR0:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX]] +; GFX9-NEXT: [[VAL0:%.*]] = load float, ptr addrspace(1) [[PTR0]], align 4 +; GFX9-NEXT: [[EXP0:%.*]] = call float @llvm.exp2.f32(float [[VAL0]]) +; GFX9-NEXT: store float [[EXP0]], ptr addrspace(1) [[PTR0]], align 4 +; GFX9-NEXT: [[IDX1:%.*]] = add nuw nsw i64 [[IDX]], 1 +; GFX9-NEXT: [[PTR1:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX1]] +; GFX9-NEXT: [[VAL1:%.*]] = load float, ptr addrspace(1) [[PTR1]], align 4 +; GFX9-NEXT: [[EXP1:%.*]] = call float @llvm.exp2.f32(float [[VAL1]]) +; GFX9-NEXT: store float [[EXP1]], ptr addrspace(1) [[PTR1]], align 4 +; GFX9-NEXT: ret void +; +; GFX1250-LABEL: define amdgpu_kernel void @exp2_combine( +; GFX1250-SAME: ptr addrspace(1) [[ARG:%.*]]) #[[ATTR0:[0-9]+]] { +; GFX1250-NEXT: [[TID:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() +; GFX1250-NEXT: [[IDX:%.*]] = zext i32 [[TID]] to i64 +; GFX1250-NEXT: [[PTR0:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX]] +; GFX1250-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr addrspace(1) [[PTR0]], align 4 +; GFX1250-NEXT: [[TMP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[TMP1]]) +; GFX1250-NEXT: store <2 x float> [[TMP2]], ptr addrspace(1) [[PTR0]], align 4 +; GFX1250-NEXT: ret void +; + %tid = tail call i32 @llvm.amdgcn.workitem.id.x() + %idx = zext i32 %tid to i64 + %ptr0 = getelementptr inbounds float, ptr addrspace(1) %arg, i64 %idx + %val0 = load float, ptr addrspace(1) %ptr0, align 4 + %exp0 = call float @llvm.exp2.f32(float %val0) + store float %exp0, ptr addrspace(1) %ptr0, align 4 + %idx1 = add nuw nsw i64 %idx, 1 + %ptr1 = getelementptr inbounds float, ptr addrspace(1) %arg, i64 %idx1 + %val1 = load float, ptr addrspace(1) %ptr1, align 4 + %exp1 = call float @llvm.exp2.f32(float %val1) + store float %exp1, ptr addrspace(1) %ptr1, align 4 + ret void +} + +define amdgpu_kernel void @exp_afn_combine(ptr addrspace(1) %arg) { +; GFX9-LABEL: define amdgpu_kernel void @exp_afn_combine( +; GFX9-SAME: ptr addrspace(1) [[ARG:%.*]]) #[[ATTR0]] { +; GFX9-NEXT: [[TID:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() +; GFX9-NEXT: [[IDX:%.*]] = zext i32 [[TID]] to i64 +; GFX9-NEXT: [[PTR0:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX]] +; GFX9-NEXT: [[VAL0:%.*]] = load float, ptr addrspace(1) [[PTR0]], align 4 +; GFX9-NEXT: [[EXP0:%.*]] = call afn float @llvm.exp.f32(float [[VAL0]]) +; GFX9-NEXT: store float [[EXP0]], ptr addrspace(1) [[PTR0]], align 4 +; GFX9-NEXT: [[IDX1:%.*]] = add nuw nsw i64 [[IDX]], 1 +; GFX9-NEXT: [[PTR1:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX1]] +; GFX9-NEXT: [[VAL1:%.*]] = load float, ptr addrspace(1) [[PTR1]], align 4 +; GFX9-NEXT: [[EXP1:%.*]] = call afn float @llvm.exp.f32(float [[VAL1]]) +; GFX9-NEXT: store float [[EXP1]], ptr addrspace(1) [[PTR1]], align 4 +; GFX9-NEXT: ret void +; +; GFX1250-LABEL: define amdgpu_kernel void @exp_afn_combine( +; GFX1250-SAME: ptr addrspace(1) [[ARG:%.*]]) #[[ATTR0]] { +; GFX1250-NEXT: [[TID:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() +; GFX1250-NEXT: [[IDX:%.*]] = zext i32 [[TID]] to i64 +; GFX1250-NEXT: [[PTR0:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[ARG]], i64 [[IDX]] +; GFX1250-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr addrspace(1) [[PTR0]], align 4 +; GFX1250-NEXT: [[TMP2:%.*]] = call afn <2 x float> @llvm.exp.v2f32(<2 x float> [[TMP1]]) +; GFX1250-NEXT: store <2 x float> [[TMP2]], ptr addrspace(1) [[PTR0]], align 4 +; GFX1250-NEXT: ret void +; + %tid = tail call i32 @llvm.amdgcn.workitem.id.x() + %idx = zext i32 %tid to i64 + %ptr0 = getelementptr inbounds float, ptr addrspace(1) %arg, i64 %idx + %val0 = load float, ptr addrspace(1) %ptr0, align 4 + %exp0 = call afn float @llvm.exp.f32(float %val0) + store float %exp0, ptr addrspace(1) %ptr0, align 4 + %idx1 = add nuw nsw i64 %idx, 1 + %ptr1 = getelementptr inbounds float, ptr addrspace(1) %arg, i64 %idx1 + %val1 = load float, ptr addrspace(1) %ptr1, align 4 + %exp1 = call afn float @llvm.exp.f32(float %val1) + store float %exp1, ptr addrspace(1) %ptr1, align 4 + ret void +}