From 6e9898f36239f16f477acf6edb1146f0442822aa Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 15 May 2016 17:40:48 +0000 Subject: [CostModel][X86] Added scalar bitreverse tests llvm-svn: 269594 --- llvm/test/Analysis/CostModel/X86/bitreverse.ll | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'llvm/test') 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>) -- cgit v1.2.3