[llvm] [NFC][AMDGPU] Add CostModel tests for transcendental ops with varying function attrs (PR #188869)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 15:58:37 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-backend-amdgpu

Author: Chinmay Deshpande (chinmaydd)

<details>
<summary>Changes</summary>



---

Patch is 28.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/188869.diff


4 Files Affected:

- (modified) llvm/test/Analysis/CostModel/AMDGPU/log.ll (+105) 
- (modified) llvm/test/Analysis/CostModel/AMDGPU/log10.ll (+105) 
- (modified) llvm/test/Analysis/CostModel/AMDGPU/log2.ll (+36) 
- (modified) llvm/test/Analysis/CostModel/AMDGPU/sqrt.ll (+71) 


``````````diff
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/log.ll b/llvm/test/Analysis/CostModel/AMDGPU/log.ll
index 2cf7039982f26..6c3a9e9c86688 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/log.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/log.ll
@@ -276,3 +276,108 @@ define void @log_f64() {
   %v17f64 = call <17 x double> @llvm.log.v17f64(<17 x double> undef)
   ret void
 }
+
+define void @log_f32_afn_ieee() #0 {
+; ALL-LABEL: 'log_f32_afn_ieee'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log_f32_afn_ieee'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call afn float @llvm.log.f32(float undef)
+  %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+  %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+  %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+  %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+  %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+  %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+  %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+  ret void
+}
+
+define void @log_f32_afn_daz() #1 {
+; ALL-LABEL: 'log_f32_afn_daz'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log_f32_afn_daz'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call afn float @llvm.log.f32(float undef)
+  %v2f32 = call afn <2 x float> @llvm.log.v2f32(<2 x float> undef)
+  %v3f32 = call afn <3 x float> @llvm.log.v3f32(<3 x float> undef)
+  %v4f32 = call afn <4 x float> @llvm.log.v4f32(<4 x float> undef)
+  %v5f32 = call afn <5 x float> @llvm.log.v5f32(<5 x float> undef)
+  %v8f32 = call afn <8 x float> @llvm.log.v8f32(<8 x float> undef)
+  %v16f32 = call afn <16 x float> @llvm.log.v16f32(<16 x float> undef)
+  %v17f32 = call afn <17 x float> @llvm.log.v17f32(<17 x float> undef)
+  ret void
+}
+
+define void @log_f32_daz() #1 {
+; ALL-LABEL: 'log_f32_daz'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.log.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log_f32_daz'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.log.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.log.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.log.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.log.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.log.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.log.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.log.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.log.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call float @llvm.log.f32(float undef)
+  %v2f32 = call <2 x float> @llvm.log.v2f32(<2 x float> undef)
+  %v3f32 = call <3 x float> @llvm.log.v3f32(<3 x float> undef)
+  %v4f32 = call <4 x float> @llvm.log.v4f32(<4 x float> undef)
+  %v5f32 = call <5 x float> @llvm.log.v5f32(<5 x float> undef)
+  %v8f32 = call <8 x float> @llvm.log.v8f32(<8 x float> undef)
+  %v16f32 = call <16 x float> @llvm.log.v16f32(<16 x float> undef)
+  %v17f32 = call <17 x float> @llvm.log.v17f32(<17 x float> undef)
+  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/log10.ll b/llvm/test/Analysis/CostModel/AMDGPU/log10.ll
index d807c6cd63648..8672cb1815d4f 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/log10.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/log10.ll
@@ -276,3 +276,108 @@ define void @log10_f64() {
   %v17f64 = call <17 x double> @llvm.log10.v17f64(<17 x double> undef)
   ret void
 }
+
+define void @log10_f32_afn_ieee() #0 {
+; ALL-LABEL: 'log10_f32_afn_ieee'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log10.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log10_f32_afn_ieee'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log10.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call afn float @llvm.log10.f32(float undef)
+  %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+  %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+  %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+  %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+  %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+  %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+  %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+  ret void
+}
+
+define void @log10_f32_afn_daz() #1 {
+; ALL-LABEL: 'log10_f32_afn_daz'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log10.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log10_f32_afn_daz'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call afn float @llvm.log10.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call afn float @llvm.log10.f32(float undef)
+  %v2f32 = call afn <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+  %v3f32 = call afn <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+  %v4f32 = call afn <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+  %v5f32 = call afn <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+  %v8f32 = call afn <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+  %v16f32 = call afn <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+  %v17f32 = call afn <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+  ret void
+}
+
+define void @log10_f32_daz() #1 {
+; ALL-LABEL: 'log10_f32_daz'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.log10.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
+;
+; ALL-SIZE-LABEL: 'log10_f32_daz'
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.log10.f32(float undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %v8f32 = call <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %v16f32 = call <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v17f32 = call <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+  %f32 = call float @llvm.log10.f32(float undef)
+  %v2f32 = call <2 x float> @llvm.log10.v2f32(<2 x float> undef)
+  %v3f32 = call <3 x float> @llvm.log10.v3f32(<3 x float> undef)
+  %v4f32 = call <4 x float> @llvm.log10.v4f32(<4 x float> undef)
+  %v5f32 = call <5 x float> @llvm.log10.v5f32(<5 x float> undef)
+  %v8f32 = call <8 x float> @llvm.log10.v8f32(<8 x float> undef)
+  %v16f32 = call <16 x float> @llvm.log10.v16f32(<16 x float> undef)
+  %v17f32 = call <17 x float> @llvm.log10.v17f32(<17 x float> undef)
+  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/log2.ll b/llvm/test/Analysis/CostModel/AMDGPU/log2.ll
index 1ef3977fe4a8f..de6f298802642 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/log2.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/log2.ll
@@ -276,3 +276,39 @@ define void @log2_f64() {
   %v17f64 = call <17 x double> @llvm.log2.v17f64(<17 x double> undef)
   ret void
 }
+
+define void @log2_f32_daz() #0 {
+; ALL-LABEL: 'log2_f32_daz'
+; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %f32 = call float @llvm.log2.f32(float undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2f32 = call <2 x float> @llvm.log2.v2f32(<2 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %v3f32 = call <3 x float> @llvm.log2.v3f32(<3 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %v4f32 = call <4 x float> @llvm.log2.v4f32(<4 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v5f32 = call <5 x float> @llvm.log2.v5f32(<5 x float> undef)
+; ALL-NEXT:  Cost Model: Found an estimated cost of 16 for instruct...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/188869


More information about the llvm-commits mailing list