[llvm] 26012d6 - [CostModel][X86] Add baseline cost test for pdep/pext intrinsics (#222603)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 04:33:39 PDT 2026


Author: Simon Pilgrim
Date: 2026-09-10T11:33:34Z
New Revision: 26012d67fef70763f6593eacfe2af41272cf7b72

URL: https://github.com/llvm/llvm-project/commit/26012d67fef70763f6593eacfe2af41272cf7b72
DIFF: https://github.com/llvm/llvm-project/commit/26012d67fef70763f6593eacfe2af41272cf7b72.diff

LOG: [CostModel][X86] Add baseline cost test for pdep/pext intrinsics (#222603)

Slow pdep/pext targets in particular are highly inaccurate

Added: 
    llvm/test/Analysis/CostModel/X86/pdep.ll
    llvm/test/Analysis/CostModel/X86/pext.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/CostModel/X86/pdep.ll b/llvm/test/Analysis/CostModel/X86/pdep.ll
new file mode 100644
index 0000000000000..07ec25d4ed5ce
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/X86/pdep.ll
@@ -0,0 +1,154 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64    | FileCheck %s --check-prefixes=SSE,SSE2
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v2 | FileCheck %s --check-prefixes=SSE,SSE42
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s --check-prefixes=AVX2,AVX2-FAST
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=AVX512
+;
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=bdver4 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=AVX2,AVX2-FAST
+
+define i32 @pdep_i8(i32 %arg) {
+; SSE2-LABEL: 'pdep_i8'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pdep.i8(i8 undef, i8 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 47 for: %V16I8 = call <16 x i8> @llvm.pdep.v16i8(<16 x i8> undef, <16 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 94 for: %V32I8 = call <32 x i8> @llvm.pdep.v32i8(<32 x i8> undef, <32 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 188 for: %V64I8 = call <64 x i8> @llvm.pdep.v64i8(<64 x i8> undef, <64 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pdep_i8'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pdep.i8(i8 undef, i8 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pdep.v16i8(<16 x i8> undef, <16 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 64 for: %V32I8 = call <32 x i8> @llvm.pdep.v32i8(<32 x i8> undef, <32 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 128 for: %V64I8 = call <64 x i8> @llvm.pdep.v64i8(<64 x i8> undef, <64 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pdep_i8'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pdep.i8(i8 undef, i8 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pdep.v16i8(<16 x i8> undef, <16 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 65 for: %V32I8 = call <32 x i8> @llvm.pdep.v32i8(<32 x i8> undef, <32 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 130 for: %V64I8 = call <64 x i8> @llvm.pdep.v64i8(<64 x i8> undef, <64 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pdep_i8'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pdep.i8(i8 undef, i8 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pdep.v16i8(<16 x i8> undef, <16 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 65 for: %V32I8 = call <32 x i8> @llvm.pdep.v32i8(<32 x i8> undef, <32 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 131 for: %V64I8 = call <64 x i8> @llvm.pdep.v64i8(<64 x i8> undef, <64 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I8 = call i8 @llvm.pdep.i8(i8 undef, i8 undef)
+  %V16I8 = call <16 x i8> @llvm.pdep.v16i8(<16 x i8> undef, <16 x i8> undef)
+  %V32I8 = call <32 x i8> @llvm.pdep.v32i8(<32 x i8> undef, <32 x i8> undef)
+  %V64I8 = call <64 x i8> @llvm.pdep.v64i8(<64 x i8> undef, <64 x i8> undef)
+
+  ret i32 undef
+}
+
+define i32 @pdep_i16(i32 %arg) {
+; SSE-LABEL: 'pdep_i16'
+; SSE-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pdep.i16(i16 undef, i16 undef)
+; SSE-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pdep.v8i16(<8 x i16> undef, <8 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of 32 for: %V16I16 = call <16 x i16> @llvm.pdep.v16i16(<16 x i16> undef, <16 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of 64 for: %V32I16 = call <32 x i16> @llvm.pdep.v32i16(<32 x i16> undef, <32 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pdep_i16'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pdep.i16(i16 undef, i16 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pdep.v8i16(<8 x i16> undef, <8 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 33 for: %V16I16 = call <16 x i16> @llvm.pdep.v16i16(<16 x i16> undef, <16 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 66 for: %V32I16 = call <32 x i16> @llvm.pdep.v32i16(<32 x i16> undef, <32 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pdep_i16'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pdep.i16(i16 undef, i16 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pdep.v8i16(<8 x i16> undef, <8 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 33 for: %V16I16 = call <16 x i16> @llvm.pdep.v16i16(<16 x i16> undef, <16 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 67 for: %V32I16 = call <32 x i16> @llvm.pdep.v32i16(<32 x i16> undef, <32 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I16 = call i16 @llvm.pdep.i16(i16 undef, i16 undef)
+  %V8I16  = call <8 x i16>  @llvm.pdep.v8i16(<8 x i16> undef, <8 x i16> undef)
+  %V16I16 = call <16 x i16> @llvm.pdep.v16i16(<16 x i16> undef, <16 x i16> undef)
+  %V32I16 = call <32 x i16> @llvm.pdep.v32i16(<32 x i16> undef, <32 x i16> undef)
+
+  ret i32 undef
+}
+
+define i32 @pdep_i32(i32 %arg) {
+; SSE2-LABEL: 'pdep_i32'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pdep.i32(i32 undef, i32 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 11 for: %V4I32 = call <4 x i32> @llvm.pdep.v4i32(<4 x i32> undef, <4 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 22 for: %V8I32 = call <8 x i32> @llvm.pdep.v8i32(<8 x i32> undef, <8 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 44 for: %V16I32 = call <16 x i32> @llvm.pdep.v16i32(<16 x i32> undef, <16 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pdep_i32'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pdep.i32(i32 undef, i32 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pdep.v4i32(<4 x i32> undef, <4 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 16 for: %V8I32 = call <8 x i32> @llvm.pdep.v8i32(<8 x i32> undef, <8 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 32 for: %V16I32 = call <16 x i32> @llvm.pdep.v16i32(<16 x i32> undef, <16 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pdep_i32'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pdep.i32(i32 undef, i32 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pdep.v4i32(<4 x i32> undef, <4 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 17 for: %V8I32 = call <8 x i32> @llvm.pdep.v8i32(<8 x i32> undef, <8 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 34 for: %V16I32 = call <16 x i32> @llvm.pdep.v16i32(<16 x i32> undef, <16 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pdep_i32'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pdep.i32(i32 undef, i32 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pdep.v4i32(<4 x i32> undef, <4 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 17 for: %V8I32 = call <8 x i32> @llvm.pdep.v8i32(<8 x i32> undef, <8 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 35 for: %V16I32 = call <16 x i32> @llvm.pdep.v16i32(<16 x i32> undef, <16 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I32 = call i32 @llvm.pdep.i32(i32 undef, i32 undef)
+  %V4I32  = call <4 x i32>  @llvm.pdep.v4i32(<4 x i32> undef, <4 x i32> undef)
+  %V8I32  = call <8 x i32>  @llvm.pdep.v8i32(<8 x i32> undef, <8 x i32> undef)
+  %V16I32 = call <16 x i32> @llvm.pdep.v16i32(<16 x i32> undef, <16 x i32> undef)
+
+  ret i32 undef
+}
+
+define i32 @pdep_i64(i32 %arg) {
+; SSE2-LABEL: 'pdep_i64'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pdep.i64(i64 undef, i64 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 5 for: %V2I64 = call <2 x i64> @llvm.pdep.v2i64(<2 x i64> undef, <2 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 10 for: %V4I64 = call <4 x i64> @llvm.pdep.v4i64(<4 x i64> undef, <4 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 20 for: %V8I64 = call <8 x i64> @llvm.pdep.v8i64(<8 x i64> undef, <8 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pdep_i64'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pdep.i64(i64 undef, i64 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pdep.v2i64(<2 x i64> undef, <2 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 8 for: %V4I64 = call <4 x i64> @llvm.pdep.v4i64(<4 x i64> undef, <4 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 16 for: %V8I64 = call <8 x i64> @llvm.pdep.v8i64(<8 x i64> undef, <8 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pdep_i64'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pdep.i64(i64 undef, i64 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pdep.v2i64(<2 x i64> undef, <2 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 9 for: %V4I64 = call <4 x i64> @llvm.pdep.v4i64(<4 x i64> undef, <4 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 18 for: %V8I64 = call <8 x i64> @llvm.pdep.v8i64(<8 x i64> undef, <8 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pdep_i64'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pdep.i64(i64 undef, i64 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pdep.v2i64(<2 x i64> undef, <2 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 9 for: %V4I64 = call <4 x i64> @llvm.pdep.v4i64(<4 x i64> undef, <4 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 19 for: %V8I64 = call <8 x i64> @llvm.pdep.v8i64(<8 x i64> undef, <8 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I64 = call i64 @llvm.pdep.i64(i64 undef, i64 undef)
+  %V2I64 = call <2 x i64> @llvm.pdep.v2i64(<2 x i64> undef, <2 x i64> undef)
+  %V4I64 = call <4 x i64> @llvm.pdep.v4i64(<4 x i64> undef, <4 x i64> undef)
+  %V8I64 = call <8 x i64> @llvm.pdep.v8i64(<8 x i64> undef, <8 x i64> undef)
+
+  ret i32 undef
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; AVX2-FAST: {{.*}}
+; AVX2-SLOW: {{.*}}

diff  --git a/llvm/test/Analysis/CostModel/X86/pext.ll b/llvm/test/Analysis/CostModel/X86/pext.ll
new file mode 100644
index 0000000000000..c9c21c3a4efed
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/X86/pext.ll
@@ -0,0 +1,154 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64    | FileCheck %s --check-prefixes=SSE,SSE2
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v2 | FileCheck %s --check-prefixes=SSE,SSE42
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s --check-prefixes=AVX2,AVX2-FAST
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=AVX512
+;
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=bdver4 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=AVX2,AVX2-SLOW
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=all -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=AVX2,AVX2-FAST
+
+define i32 @pext_i8(i32 %arg) {
+; SSE2-LABEL: 'pext_i8'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pext.i8(i8 undef, i8 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 47 for: %V16I8 = call <16 x i8> @llvm.pext.v16i8(<16 x i8> undef, <16 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 94 for: %V32I8 = call <32 x i8> @llvm.pext.v32i8(<32 x i8> undef, <32 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 188 for: %V64I8 = call <64 x i8> @llvm.pext.v64i8(<64 x i8> undef, <64 x i8> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pext_i8'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pext.i8(i8 undef, i8 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pext.v16i8(<16 x i8> undef, <16 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 64 for: %V32I8 = call <32 x i8> @llvm.pext.v32i8(<32 x i8> undef, <32 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 128 for: %V64I8 = call <64 x i8> @llvm.pext.v64i8(<64 x i8> undef, <64 x i8> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pext_i8'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pext.i8(i8 undef, i8 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pext.v16i8(<16 x i8> undef, <16 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 65 for: %V32I8 = call <32 x i8> @llvm.pext.v32i8(<32 x i8> undef, <32 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 130 for: %V64I8 = call <64 x i8> @llvm.pext.v64i8(<64 x i8> undef, <64 x i8> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pext_i8'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I8 = call i8 @llvm.pext.i8(i8 undef, i8 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 32 for: %V16I8 = call <16 x i8> @llvm.pext.v16i8(<16 x i8> undef, <16 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 65 for: %V32I8 = call <32 x i8> @llvm.pext.v32i8(<32 x i8> undef, <32 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 131 for: %V64I8 = call <64 x i8> @llvm.pext.v64i8(<64 x i8> undef, <64 x i8> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I8 = call i8 @llvm.pext.i8(i8 undef, i8 undef)
+  %V16I8 = call <16 x i8> @llvm.pext.v16i8(<16 x i8> undef, <16 x i8> undef)
+  %V32I8 = call <32 x i8> @llvm.pext.v32i8(<32 x i8> undef, <32 x i8> undef)
+  %V64I8 = call <64 x i8> @llvm.pext.v64i8(<64 x i8> undef, <64 x i8> undef)
+
+  ret i32 undef
+}
+
+define i32 @pext_i16(i32 %arg) {
+; SSE-LABEL: 'pext_i16'
+; SSE-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pext.i16(i16 undef, i16 undef)
+; SSE-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pext.v8i16(<8 x i16> undef, <8 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of 32 for: %V16I16 = call <16 x i16> @llvm.pext.v16i16(<16 x i16> undef, <16 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of 64 for: %V32I16 = call <32 x i16> @llvm.pext.v32i16(<32 x i16> undef, <32 x i16> undef)
+; SSE-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pext_i16'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pext.i16(i16 undef, i16 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pext.v8i16(<8 x i16> undef, <8 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 33 for: %V16I16 = call <16 x i16> @llvm.pext.v16i16(<16 x i16> undef, <16 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 66 for: %V32I16 = call <32 x i16> @llvm.pext.v32i16(<32 x i16> undef, <32 x i16> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pext_i16'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I16 = call i16 @llvm.pext.i16(i16 undef, i16 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 16 for: %V8I16 = call <8 x i16> @llvm.pext.v8i16(<8 x i16> undef, <8 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 33 for: %V16I16 = call <16 x i16> @llvm.pext.v16i16(<16 x i16> undef, <16 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 67 for: %V32I16 = call <32 x i16> @llvm.pext.v32i16(<32 x i16> undef, <32 x i16> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I16 = call i16 @llvm.pext.i16(i16 undef, i16 undef)
+  %V8I16  = call <8 x i16>  @llvm.pext.v8i16(<8 x i16> undef, <8 x i16> undef)
+  %V16I16 = call <16 x i16> @llvm.pext.v16i16(<16 x i16> undef, <16 x i16> undef)
+  %V32I16 = call <32 x i16> @llvm.pext.v32i16(<32 x i16> undef, <32 x i16> undef)
+
+  ret i32 undef
+}
+
+define i32 @pext_i32(i32 %arg) {
+; SSE2-LABEL: 'pext_i32'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pext.i32(i32 undef, i32 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 11 for: %V4I32 = call <4 x i32> @llvm.pext.v4i32(<4 x i32> undef, <4 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 22 for: %V8I32 = call <8 x i32> @llvm.pext.v8i32(<8 x i32> undef, <8 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 44 for: %V16I32 = call <16 x i32> @llvm.pext.v16i32(<16 x i32> undef, <16 x i32> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pext_i32'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pext.i32(i32 undef, i32 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pext.v4i32(<4 x i32> undef, <4 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 16 for: %V8I32 = call <8 x i32> @llvm.pext.v8i32(<8 x i32> undef, <8 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 32 for: %V16I32 = call <16 x i32> @llvm.pext.v16i32(<16 x i32> undef, <16 x i32> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pext_i32'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pext.i32(i32 undef, i32 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pext.v4i32(<4 x i32> undef, <4 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 17 for: %V8I32 = call <8 x i32> @llvm.pext.v8i32(<8 x i32> undef, <8 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 34 for: %V16I32 = call <16 x i32> @llvm.pext.v16i32(<16 x i32> undef, <16 x i32> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pext_i32'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I32 = call i32 @llvm.pext.i32(i32 undef, i32 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 8 for: %V4I32 = call <4 x i32> @llvm.pext.v4i32(<4 x i32> undef, <4 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 17 for: %V8I32 = call <8 x i32> @llvm.pext.v8i32(<8 x i32> undef, <8 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 35 for: %V16I32 = call <16 x i32> @llvm.pext.v16i32(<16 x i32> undef, <16 x i32> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I32 = call i32 @llvm.pext.i32(i32 undef, i32 undef)
+  %V4I32  = call <4 x i32>  @llvm.pext.v4i32(<4 x i32> undef, <4 x i32> undef)
+  %V8I32  = call <8 x i32>  @llvm.pext.v8i32(<8 x i32> undef, <8 x i32> undef)
+  %V16I32 = call <16 x i32> @llvm.pext.v16i32(<16 x i32> undef, <16 x i32> undef)
+
+  ret i32 undef
+}
+
+define i32 @pext_i64(i32 %arg) {
+; SSE2-LABEL: 'pext_i64'
+; SSE2-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pext.i64(i64 undef, i64 undef)
+; SSE2-NEXT:  Cost Model: Found costs of 5 for: %V2I64 = call <2 x i64> @llvm.pext.v2i64(<2 x i64> undef, <2 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 10 for: %V4I64 = call <4 x i64> @llvm.pext.v4i64(<4 x i64> undef, <4 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of 20 for: %V8I64 = call <8 x i64> @llvm.pext.v8i64(<8 x i64> undef, <8 x i64> undef)
+; SSE2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; SSE42-LABEL: 'pext_i64'
+; SSE42-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pext.i64(i64 undef, i64 undef)
+; SSE42-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pext.v2i64(<2 x i64> undef, <2 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 8 for: %V4I64 = call <4 x i64> @llvm.pext.v4i64(<4 x i64> undef, <4 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of 16 for: %V8I64 = call <8 x i64> @llvm.pext.v8i64(<8 x i64> undef, <8 x i64> undef)
+; SSE42-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX2-LABEL: 'pext_i64'
+; AVX2-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pext.i64(i64 undef, i64 undef)
+; AVX2-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pext.v2i64(<2 x i64> undef, <2 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 9 for: %V4I64 = call <4 x i64> @llvm.pext.v4i64(<4 x i64> undef, <4 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of 18 for: %V8I64 = call <8 x i64> @llvm.pext.v8i64(<8 x i64> undef, <8 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+; AVX512-LABEL: 'pext_i64'
+; AVX512-NEXT:  Cost Model: Found costs of 1 for: %I64 = call i64 @llvm.pext.i64(i64 undef, i64 undef)
+; AVX512-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = call <2 x i64> @llvm.pext.v2i64(<2 x i64> undef, <2 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 9 for: %V4I64 = call <4 x i64> @llvm.pext.v4i64(<4 x i64> undef, <4 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of 19 for: %V8I64 = call <8 x i64> @llvm.pext.v8i64(<8 x i64> undef, <8 x i64> undef)
+; AVX512-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
+;
+  %I64 = call i64 @llvm.pext.i64(i64 undef, i64 undef)
+  %V2I64 = call <2 x i64> @llvm.pext.v2i64(<2 x i64> undef, <2 x i64> undef)
+  %V4I64 = call <4 x i64> @llvm.pext.v4i64(<4 x i64> undef, <4 x i64> undef)
+  %V8I64 = call <8 x i64> @llvm.pext.v8i64(<8 x i64> undef, <8 x i64> undef)
+
+  ret i32 undef
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; AVX2-FAST: {{.*}}
+; AVX2-SLOW: {{.*}}


        


More information about the llvm-commits mailing list