summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/CostModel
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-08-12 09:24:33 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-08-12 09:24:33 +0000
commitd68a277f2329138b14b7faf3d871f08ecd6fc79d (patch)
tree6b0790775cc710cbd515ae96295863fe7da9cd51 /llvm/test/Analysis/CostModel
parentb0945e1bd2e2d7ac6dd8152e479a56db302d981e (diff)
downloadbcm5719-llvm-d68a277f2329138b14b7faf3d871f08ecd6fc79d.tar.gz
bcm5719-llvm-d68a277f2329138b14b7faf3d871f08ecd6fc79d.zip
[CostModel][X86][AArch64] Add some tests for extractvalue
In https://reviews.llvm.org/D65148 it is suggested that it should have zero cost, always. llvm-svn: 368548
Diffstat (limited to 'llvm/test/Analysis/CostModel')
-rw-r--r--llvm/test/Analysis/CostModel/AArch64/aggregates.ll76
-rw-r--r--llvm/test/Analysis/CostModel/X86/aggregates.ll76
2 files changed, 152 insertions, 0 deletions
diff --git a/llvm/test/Analysis/CostModel/AArch64/aggregates.ll b/llvm/test/Analysis/CostModel/AArch64/aggregates.ll
new file mode 100644
index 00000000000..25f6cf73afc
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/aggregates.ll
@@ -0,0 +1,76 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=CHECK,SSE,SSE2
+
+define i32 @extract_first_i32({i32, i32} %agg) {
+; CHECK-LABEL: 'extract_first_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i32 } %agg, 0
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i32} %agg, 0
+ ret i32 %r
+}
+
+define i32 @extract_second_i32({i32, i32} %agg) {
+; CHECK-LABEL: 'extract_second_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i32 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i32} %agg, 1
+ ret i32 %r
+}
+
+define i32 @extract_i32({i32, i1} %agg) {
+; CHECK-LABEL: 'extract_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i1 } %agg, 0
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i1} %agg, 0
+ ret i32 %r
+}
+
+define i1 @extract_i1({i32, i1} %agg) {
+; CHECK-LABEL: 'extract_i1'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i1 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i1 %r
+;
+ %r = extractvalue {i32, i1} %agg, 1
+ ret i1 %r
+}
+
+define float @extract_float({i32, float} %agg) {
+; CHECK-LABEL: 'extract_float'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, float } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r
+;
+ %r = extractvalue {i32, float} %agg, 1
+ ret float %r
+}
+
+define [42 x i42] @extract_array({i32, [42 x i42]} %agg) {
+; CHECK-LABEL: 'extract_array'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret [42 x i42] %r
+;
+ %r = extractvalue {i32, [42 x i42]} %agg, 1
+ ret [42 x i42] %r
+}
+
+define <42 x i42> @extract_vector({i32, <42 x i42>} %agg) {
+; CHECK-LABEL: 'extract_vector'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <42 x i42> %r
+;
+ %r = extractvalue {i32, <42 x i42>} %agg, 1
+ ret <42 x i42> %r
+}
+
+%T1 = type { i32, float, <4 x i1> }
+
+define %T1 @extract_struct({i32, %T1} %agg) {
+; CHECK-LABEL: 'extract_struct'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, %T1 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret %T1 %r
+;
+ %r = extractvalue {i32, %T1} %agg, 1
+ ret %T1 %r
+}
diff --git a/llvm/test/Analysis/CostModel/X86/aggregates.ll b/llvm/test/Analysis/CostModel/X86/aggregates.ll
new file mode 100644
index 00000000000..82be8aad889
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/X86/aggregates.ll
@@ -0,0 +1,76 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=CHECK,SSE,SSE2
+
+define i32 @extract_first_i32({i32, i32} %agg) {
+; CHECK-LABEL: 'extract_first_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i32 } %agg, 0
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i32} %agg, 0
+ ret i32 %r
+}
+
+define i32 @extract_second_i32({i32, i32} %agg) {
+; CHECK-LABEL: 'extract_second_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i32 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i32} %agg, 1
+ ret i32 %r
+}
+
+define i32 @extract_i32({i32, i1} %agg) {
+; CHECK-LABEL: 'extract_i32'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i1 } %agg, 0
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
+;
+ %r = extractvalue {i32, i1} %agg, 0
+ ret i32 %r
+}
+
+define i1 @extract_i1({i32, i1} %agg) {
+; CHECK-LABEL: 'extract_i1'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, i1 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i1 %r
+;
+ %r = extractvalue {i32, i1} %agg, 1
+ ret i1 %r
+}
+
+define float @extract_float({i32, float} %agg) {
+; CHECK-LABEL: 'extract_float'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, float } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r
+;
+ %r = extractvalue {i32, float} %agg, 1
+ ret float %r
+}
+
+define [42 x i42] @extract_array({i32, [42 x i42]} %agg) {
+; CHECK-LABEL: 'extract_array'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, [42 x i42] } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret [42 x i42] %r
+;
+ %r = extractvalue {i32, [42 x i42]} %agg, 1
+ ret [42 x i42] %r
+}
+
+define <42 x i42> @extract_vector({i32, <42 x i42>} %agg) {
+; CHECK-LABEL: 'extract_vector'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, <42 x i42> } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <42 x i42> %r
+;
+ %r = extractvalue {i32, <42 x i42>} %agg, 1
+ ret <42 x i42> %r
+}
+
+%T1 = type { i32, float, <4 x i1> }
+
+define %T1 @extract_struct({i32, %T1} %agg) {
+; CHECK-LABEL: 'extract_struct'
+; CHECK-NEXT: Cost Model: Unknown cost for instruction: %r = extractvalue { i32, %T1 } %agg, 1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret %T1 %r
+;
+ %r = extractvalue {i32, %T1} %agg, 1
+ ret %T1 %r
+}
OpenPOWER on IntegriCloud