summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-01-06 11:02:40 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-01-06 11:02:40 +0000
commit441d1d35d2a2d2b1ce43aa1905c9157ce5fe496f (patch)
tree33637a9487980a9008961ac0e7d194cabcad216c
parent965d802ec74e5c37def766bd955de07a50914f12 (diff)
downloadbcm5719-llvm-441d1d35d2a2d2b1ce43aa1905c9157ce5fe496f.tar.gz
bcm5719-llvm-441d1d35d2a2d2b1ce43aa1905c9157ce5fe496f.zip
[CostModel][X86] Add SDIV/UDIV cost tests for a wider range of targets
Added a test demonstrating bug in AVX512 division costs llvm-svn: 291228
-rw-r--r--llvm/test/Analysis/CostModel/X86/vdiv-cost.ll68
1 files changed, 50 insertions, 18 deletions
diff --git a/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll b/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll
index c8e4557cbef..a6191c5a5eb 100644
--- a/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll
+++ b/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll
@@ -1,13 +1,20 @@
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2,-sse4.1 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE2
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core-avx2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX2
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE2
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+ssse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SSSE3
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse4.2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE42
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512F
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512BW
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512DQ
define <4 x i32> @test1(<4 x i32> %a) {
%div = udiv <4 x i32> %a, <i32 7, i32 7, i32 7, i32 7>
ret <4 x i32> %div
; CHECK: 'Cost Model Analysis' for function 'test1':
-; SSE2: Found an estimated cost of 15 for instruction: %div
-; AVX2: Found an estimated cost of 15 for instruction: %div
+; SSE: Found an estimated cost of 15 for instruction: %div
+; AVX: Found an estimated cost of 15 for instruction: %div
+; AVX512: Found an estimated cost of 15 for instruction: %div
}
define <8 x i32> @test2(<8 x i32> %a) {
@@ -15,8 +22,10 @@ define <8 x i32> @test2(<8 x i32> %a) {
ret <8 x i32> %div
; CHECK: 'Cost Model Analysis' for function 'test2':
-; SSE2: Found an estimated cost of 30 for instruction: %div
+; SSE: Found an estimated cost of 30 for instruction: %div
+; AVX1: Found an estimated cost of 30 for instruction: %div
; AVX2: Found an estimated cost of 15 for instruction: %div
+; AVX512: Found an estimated cost of 15 for instruction: %div
}
define <8 x i16> @test3(<8 x i16> %a) {
@@ -24,8 +33,9 @@ define <8 x i16> @test3(<8 x i16> %a) {
ret <8 x i16> %div
; CHECK: 'Cost Model Analysis' for function 'test3':
-; SSE2: Found an estimated cost of 6 for instruction: %div
-; AVX2: Found an estimated cost of 6 for instruction: %div
+; SSE: Found an estimated cost of 6 for instruction: %div
+; AVX: Found an estimated cost of 6 for instruction: %div
+; AVX512: Found an estimated cost of 6 for instruction: %div
}
define <16 x i16> @test4(<16 x i16> %a) {
@@ -33,8 +43,10 @@ define <16 x i16> @test4(<16 x i16> %a) {
ret <16 x i16> %div
; CHECK: 'Cost Model Analysis' for function 'test4':
-; SSE2: Found an estimated cost of 12 for instruction: %div
+; SSE: Found an estimated cost of 12 for instruction: %div
+; AVX1: Found an estimated cost of 12 for instruction: %div
; AVX2: Found an estimated cost of 6 for instruction: %div
+; AVX512: Found an estimated cost of 6 for instruction: %div
}
define <8 x i16> @test5(<8 x i16> %a) {
@@ -42,8 +54,9 @@ define <8 x i16> @test5(<8 x i16> %a) {
ret <8 x i16> %div
; CHECK: 'Cost Model Analysis' for function 'test5':
-; SSE2: Found an estimated cost of 6 for instruction: %div
-; AVX2: Found an estimated cost of 6 for instruction: %div
+; SSE: Found an estimated cost of 6 for instruction: %div
+; AVX: Found an estimated cost of 6 for instruction: %div
+; AVX512: Found an estimated cost of 6 for instruction: %div
}
define <16 x i16> @test6(<16 x i16> %a) {
@@ -51,8 +64,10 @@ define <16 x i16> @test6(<16 x i16> %a) {
ret <16 x i16> %div
; CHECK: 'Cost Model Analysis' for function 'test6':
-; SSE2: Found an estimated cost of 12 for instruction: %div
+; SSE: Found an estimated cost of 12 for instruction: %div
+; AVX1: Found an estimated cost of 12 for instruction: %div
; AVX2: Found an estimated cost of 6 for instruction: %div
+; AVX512: Found an estimated cost of 6 for instruction: %div
}
define <16 x i8> @test7(<16 x i8> %a) {
@@ -60,8 +75,9 @@ define <16 x i8> @test7(<16 x i8> %a) {
ret <16 x i8> %div
; CHECK: 'Cost Model Analysis' for function 'test7':
-; SSE2: Found an estimated cost of 320 for instruction: %div
-; AVX2: Found an estimated cost of 320 for instruction: %div
+; SSE: Found an estimated cost of 320 for instruction: %div
+; AVX: Found an estimated cost of 320 for instruction: %div
+; AVX512: Found an estimated cost of 320 for instruction: %div
}
define <4 x i32> @test8(<4 x i32> %a) {
@@ -69,8 +85,9 @@ define <4 x i32> @test8(<4 x i32> %a) {
ret <4 x i32> %div
; CHECK: 'Cost Model Analysis' for function 'test8':
-; SSE2: Found an estimated cost of 19 for instruction: %div
-; AVX2: Found an estimated cost of 15 for instruction: %div
+; SSE: Found an estimated cost of 19 for instruction: %div
+; AVX: Found an estimated cost of 15 for instruction: %div
+; AVX512: Found an estimated cost of 15 for instruction: %div
}
define <8 x i32> @test9(<8 x i32> %a) {
@@ -78,8 +95,10 @@ define <8 x i32> @test9(<8 x i32> %a) {
ret <8 x i32> %div
; CHECK: 'Cost Model Analysis' for function 'test9':
-; SSE2: Found an estimated cost of 38 for instruction: %div
+; SSE: Found an estimated cost of 38 for instruction: %div
+; AVX1: Found an estimated cost of 38 for instruction: %div
; AVX2: Found an estimated cost of 15 for instruction: %div
+; AVX512: Found an estimated cost of 15 for instruction: %div
}
define <8 x i32> @test10(<8 x i32> %a) {
@@ -87,6 +106,19 @@ define <8 x i32> @test10(<8 x i32> %a) {
ret <8 x i32> %div
; CHECK: 'Cost Model Analysis' for function 'test10':
-; SSE2: Found an estimated cost of 160 for instruction: %div
-; AVX2: Found an estimated cost of 160 for instruction: %div
+; SSE: Found an estimated cost of 160 for instruction: %div
+; AVX: Found an estimated cost of 160 for instruction: %div
+; AVX512: Found an estimated cost of 160 for instruction: %div
}
+
+define <16 x i32> @test11(<16 x i32> %a) {
+ %div = sdiv <16 x i32> %a, <i32 8, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7, i32 8, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7>
+ ret <16 x i32> %div
+
+; CHECK: 'Cost Model Analysis' for function 'test11':
+; SSE: Found an estimated cost of 320 for instruction: %div
+; AVX: Found an estimated cost of 320 for instruction: %div
+; AVX512F: Found an estimated cost of 48 for instruction: %div
+; AVX512BW: Found an estimated cost of 320 for instruction: %div
+; AVX512DQ: Found an estimated cost of 48 for instruction: %div
+}
OpenPOWER on IntegriCloud