aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/test/Analysis/CostModel/X86/ctpop.ll38
-rw-r--r--llvm/test/Analysis/CostModel/X86/cttz.ll67
2 files changed, 103 insertions, 2 deletions
diff --git a/llvm/test/Analysis/CostModel/X86/ctpop.ll b/llvm/test/Analysis/CostModel/X86/ctpop.ll
index d15255a..4e799c8 100644
--- a/llvm/test/Analysis/CostModel/X86/ctpop.ll
+++ b/llvm/test/Analysis/CostModel/X86/ctpop.ll
@@ -2,10 +2,12 @@
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=-popcnt,+sse2 | FileCheck %s -check-prefixes=SSE2,NOPOPCNT
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+sse2 | FileCheck %s -check-prefixes=SSE2,POPCNT
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+sse4.2 | FileCheck %s -check-prefixes=POPCNT,SSE42
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx | FileCheck %s -check-prefixes=POPCNT,AVX1
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx2 | FileCheck %s -check-prefixes=POPCNT,AVX2
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx | FileCheck %s -check-prefixes=POPCNT,AVX,AVX1
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx2 | FileCheck %s -check-prefixes=POPCNT,AVX,AVX2
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx512f | FileCheck %s -check-prefixes=POPCNT,AVX512,AVX512F
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx512vl,+avx512bw,+avx512dq | FileCheck %s -check-prefixes=POPCNT,AVX512,AVX512BW
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx512vl,+avx512vpopcntdq | FileCheck %s -check-prefixes=POPCNT,AVX512,AVX512VPOPCNT
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+popcnt,+avx512vl,+avx512bitalg | FileCheck %s -check-prefixes=POPCNT,AVX512,AVX512BITALG
; Verify the cost of scalar population count instructions.
@@ -154,6 +156,14 @@ define <8 x i64> @var_ctpop_v8i64(<8 x i64> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %ctpop
;
+; AVX512VPOPCNT-LABEL: 'var_ctpop_v8i64'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %ctpop
+;
+; AVX512BITALG-LABEL: 'var_ctpop_v8i64'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %ctpop
+;
%ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
ret <8 x i64> %ctpop
}
@@ -229,6 +239,14 @@ define <16 x i32> @var_ctpop_v16i32(<16 x i32> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %ctpop
;
+; AVX512VPOPCNT-LABEL: 'var_ctpop_v16i32'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %ctpop
+;
+; AVX512BITALG-LABEL: 'var_ctpop_v16i32'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %ctpop
+;
%ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
ret <16 x i32> %ctpop
}
@@ -304,6 +322,14 @@ define <32 x i16> @var_ctpop_v32i16(<32 x i16> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %ctpop
;
+; AVX512VPOPCNT-LABEL: 'var_ctpop_v32i16'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %ctpop
+;
+; AVX512BITALG-LABEL: 'var_ctpop_v32i16'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %ctpop
+;
%ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
ret <32 x i16> %ctpop
}
@@ -379,6 +405,14 @@ define <64 x i8> @var_ctpop_v64i8(<64 x i8> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %ctpop
;
+; AVX512VPOPCNT-LABEL: 'var_ctpop_v64i8'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %ctpop
+;
+; AVX512BITALG-LABEL: 'var_ctpop_v64i8'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %ctpop
+;
%ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
ret <64 x i8> %ctpop
}
diff --git a/llvm/test/Analysis/CostModel/X86/cttz.ll b/llvm/test/Analysis/CostModel/X86/cttz.ll
index 24266fd..c908579 100644
--- a/llvm/test/Analysis/CostModel/X86/cttz.ll
+++ b/llvm/test/Analysis/CostModel/X86/cttz.ll
@@ -6,6 +6,9 @@
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx2 | FileCheck %s -check-prefixes=BMI,AVX,AVX2
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx512f | FileCheck %s -check-prefixes=BMI,AVX512,AVX512F
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx512vl,+avx512bw,+avx512dq | FileCheck %s -check-prefixes=BMI,AVX512,AVX512BW
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx512vl,+avx512bw,+avx512dq | FileCheck %s -check-prefixes=BMI,AVX512,AVX512BW
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx512vl,+avx512vpopcntdq | FileCheck %s -check-prefixes=BMI,AVX512,AVX512VPOPCNT
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+bmi,+avx512vl,+avx512bitalg | FileCheck %s -check-prefixes=BMI,AVX512,AVX512BITALG
; Verify the cost of scalar trailing zero count instructions.
@@ -252,6 +255,14 @@ define <8 x i64> @var_cttz_v8i64(<8 x i64> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v8i64'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v8i64'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
+;
%cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 0)
ret <8 x i64> %cttz
}
@@ -281,6 +292,14 @@ define <8 x i64> @var_cttz_v8i64u(<8 x i64> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v8i64u'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v8i64u'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %cttz
+;
%cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 1)
ret <8 x i64> %cttz
}
@@ -402,6 +421,14 @@ define <16 x i32> @var_cttz_v16i32(<16 x i32> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v16i32'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v16i32'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
+;
%cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 0)
ret <16 x i32> %cttz
}
@@ -431,6 +458,14 @@ define <16 x i32> @var_cttz_v16i32u(<16 x i32> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v16i32u'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v16i32u'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %cttz
+;
%cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 1)
ret <16 x i32> %cttz
}
@@ -552,6 +587,14 @@ define <32 x i16> @var_cttz_v32i16(<32 x i16> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v32i16'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v32i16'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
+;
%cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 0)
ret <32 x i16> %cttz
}
@@ -581,6 +624,14 @@ define <32 x i16> @var_cttz_v32i16u(<32 x i16> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v32i16u'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v32i16u'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i16> %cttz
+;
%cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 1)
ret <32 x i16> %cttz
}
@@ -702,6 +753,14 @@ define <64 x i8> @var_cttz_v64i8(<64 x i8> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v64i8'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v64i8'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
+;
%cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 0)
ret <64 x i8> %cttz
}
@@ -731,6 +790,14 @@ define <64 x i8> @var_cttz_v64i8u(<64 x i8> %a) {
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
;
+; AVX512VPOPCNT-LABEL: 'var_cttz_v64i8u'
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
+; AVX512VPOPCNT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
+;
+; AVX512BITALG-LABEL: 'var_cttz_v64i8u'
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
+; AVX512BITALG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i8> %cttz
+;
%cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 1)
ret <64 x i8> %cttz
}