diff options
-rw-r--r-- | llvm/test/Analysis/CostModel/X86/bitreverse.ll | 51 |
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>) |