summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-05-15 17:40:48 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-05-15 17:40:48 +0000
commit6e9898f36239f16f477acf6edb1146f0442822aa (patch)
tree8f56e24bc4813dcd488e12d812b3adb1157d072f
parentfe65877c7669052e1a8bad9cc517ff1a347cdb9e (diff)
downloadbcm5719-llvm-6e9898f36239f16f477acf6edb1146f0442822aa.tar.gz
bcm5719-llvm-6e9898f36239f16f477acf6edb1146f0442822aa.zip
[CostModel][X86] Added scalar bitreverse tests
llvm-svn: 269594
-rw-r--r--llvm/test/Analysis/CostModel/X86/bitreverse.ll51
1 files changed, 51 insertions, 0 deletions
diff --git a/llvm/test/Analysis/CostModel/X86/bitreverse.ll b/llvm/test/Analysis/CostModel/X86/bitreverse.ll
index cd5c22b9096..9eb0ef2b4b5 100644
--- a/llvm/test/Analysis/CostModel/X86/bitreverse.ll
+++ b/llvm/test/Analysis/CostModel/X86/bitreverse.ll
@@ -5,6 +5,57 @@
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver4 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX2
+; Verify the cost of scalar bitreverse instructions.
+
+declare i64 @llvm.bitreverse.i64(i64)
+declare i32 @llvm.bitreverse.i32(i32)
+declare i16 @llvm.bitreverse.i16(i16)
+declare i8 @llvm.bitreverse.i8(i8)
+
+define i64 @var_bitreverse_i64(i64 %a) {
+; CHECK: 'Cost Model Analysis' for function 'var_bitreverse_i64':
+; SSE2: Found an estimated cost of 1 for instruction: %bitreverse
+; SSE42: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX2: Found an estimated cost of 1 for instruction: %bitreverse
+; XOP: Found an estimated cost of 1 for instruction: %bitreverse
+ %bitreverse = call i64 @llvm.bitreverse.i64(i64 %a)
+ ret i64 %bitreverse
+}
+
+define i32 @var_bitreverse_i32(i32 %a) {
+; CHECK: 'Cost Model Analysis' for function 'var_bitreverse_i32':
+; SSE2: Found an estimated cost of 1 for instruction: %bitreverse
+; SSE42: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX2: Found an estimated cost of 1 for instruction: %bitreverse
+; XOP: Found an estimated cost of 1 for instruction: %bitreverse
+ %bitreverse = call i32 @llvm.bitreverse.i32(i32 %a)
+ ret i32 %bitreverse
+}
+
+define i16 @var_bitreverse_i16(i16 %a) {
+; CHECK: 'Cost Model Analysis' for function 'var_bitreverse_i16':
+; SSE2: Found an estimated cost of 1 for instruction: %bitreverse
+; SSE42: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX2: Found an estimated cost of 1 for instruction: %bitreverse
+; XOP: Found an estimated cost of 1 for instruction: %bitreverse
+ %bitreverse = call i16 @llvm.bitreverse.i16(i16 %a)
+ ret i16 %bitreverse
+}
+
+define i8 @var_bitreverse_i8(i8 %a) {
+; CHECK: 'Cost Model Analysis' for function 'var_bitreverse_i8':
+; SSE2: Found an estimated cost of 1 for instruction: %bitreverse
+; SSE42: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX: Found an estimated cost of 1 for instruction: %bitreverse
+; AVX2: Found an estimated cost of 1 for instruction: %bitreverse
+; XOP: Found an estimated cost of 1 for instruction: %bitreverse
+ %bitreverse = call i8 @llvm.bitreverse.i8(i8 %a)
+ ret i8 %bitreverse
+}
+
; Verify the cost of vector bitreverse instructions.
declare <2 x i64> @llvm.bitreverse.v2i64(<2 x i64>)
OpenPOWER on IntegriCloud