[llvm] r269594 - [CostModel][X86] Added scalar bitreverse tests

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun May 15 10:40:49 PDT 2016


Author: rksimon
Date: Sun May 15 12:40:48 2016
New Revision: 269594

URL: http://llvm.org/viewvc/llvm-project?rev=269594&view=rev
Log:
[CostModel][X86] Added scalar bitreverse tests

Modified:
    llvm/trunk/test/Analysis/CostModel/X86/bitreverse.ll

Modified: llvm/trunk/test/Analysis/CostModel/X86/bitreverse.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/X86/bitreverse.ll?rev=269594&r1=269593&r2=269594&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/X86/bitreverse.ll (original)
+++ llvm/trunk/test/Analysis/CostModel/X86/bitreverse.ll Sun May 15 12:40:48 2016
@@ -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>)




More information about the llvm-commits mailing list