aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/BasicAA/intrinsics.ll7
-rw-r--r--test/Analysis/BasicAA/invariant_load.ll29
-rw-r--r--test/Analysis/BasicAA/pure-const-dce.ll9
-rw-r--r--test/Analysis/CostModel/ARM/cast.ll158
-rw-r--r--test/Analysis/CostModel/ARM/gep.ll43
-rw-r--r--test/Analysis/CostModel/ARM/insertelement.ll46
-rw-r--r--test/Analysis/CostModel/ARM/lit.local.cfg6
-rw-r--r--test/Analysis/CostModel/ARM/select.ll54
-rw-r--r--test/Analysis/CostModel/ARM/shuffle.ll40
-rw-r--r--test/Analysis/CostModel/PowerPC/insert_extract.ll16
-rw-r--r--test/Analysis/CostModel/PowerPC/lit.local.cfg6
-rw-r--r--test/Analysis/CostModel/PowerPC/load_store.ll34
-rw-r--r--test/Analysis/CostModel/X86/arith.ll32
-rw-r--r--test/Analysis/CostModel/X86/cast.ll12
-rw-r--r--test/Analysis/CostModel/X86/cmp.ll42
-rw-r--r--test/Analysis/CostModel/X86/gep.ll40
-rw-r--r--test/Analysis/CostModel/X86/i32.ll2
-rw-r--r--test/Analysis/CostModel/X86/intrinsic-cost.ll32
-rw-r--r--test/Analysis/CostModel/X86/load_store.ll64
-rw-r--r--test/Analysis/CostModel/X86/vectorized-loop.ll5
-rw-r--r--test/Analysis/CostModel/no_info.ll5
-rw-r--r--test/Analysis/Dominators/invoke.ll2
-rw-r--r--test/Analysis/Profiling/lit.local.cfg12
-rw-r--r--test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll2
-rw-r--r--test/Analysis/RegionInfo/Stats/block_sort.ll (renamed from test/Analysis/RegionInfo/block_sort.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/cond_loop.ll (renamed from test/Analysis/RegionInfo/cond_loop.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/condition_complicated.ll (renamed from test/Analysis/RegionInfo/condition_complicated.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/condition_complicated_2.ll (renamed from test/Analysis/RegionInfo/condition_complicated_2.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/condition_forward_edge.ll (renamed from test/Analysis/RegionInfo/condition_forward_edge.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/condition_same_exit.ll (renamed from test/Analysis/RegionInfo/condition_same_exit.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/condition_simple.ll (renamed from test/Analysis/RegionInfo/condition_simple.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/exit_in_condition.ll (renamed from test/Analysis/RegionInfo/exit_in_condition.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/infinite_loop.ll (renamed from test/Analysis/RegionInfo/infinite_loop.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/infinite_loop_2.ll (renamed from test/Analysis/RegionInfo/infinite_loop_2.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/infinite_loop_3.ll (renamed from test/Analysis/RegionInfo/infinite_loop_3.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/infinite_loop_4.ll (renamed from test/Analysis/RegionInfo/infinite_loop_4.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/lit.local.cfg4
-rw-r--r--test/Analysis/RegionInfo/Stats/loop_with_condition.ll (renamed from test/Analysis/RegionInfo/loop_with_condition.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/loops_1.ll (renamed from test/Analysis/RegionInfo/loops_1.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/loops_2.ll (renamed from test/Analysis/RegionInfo/loops_2.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/mix_1.ll (renamed from test/Analysis/RegionInfo/mix_1.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/nested_loops.ll (renamed from test/Analysis/RegionInfo/nested_loops.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/next.ll (renamed from test/Analysis/RegionInfo/next.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/paper.ll (renamed from test/Analysis/RegionInfo/paper.ll)0
-rw-r--r--test/Analysis/RegionInfo/Stats/two_loops_same_header.ll (renamed from test/Analysis/RegionInfo/two_loops_same_header.ll)0
-rw-r--r--test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll4
-rw-r--r--test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll2
-rw-r--r--test/Analysis/ScalarEvolution/fold.ll2
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll20
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll5
50 files changed, 693 insertions, 42 deletions
diff --git a/test/Analysis/BasicAA/intrinsics.ll b/test/Analysis/BasicAA/intrinsics.ll
index 59725cfded..c1cf587204 100644
--- a/test/Analysis/BasicAA/intrinsics.ll
+++ b/test/Analysis/BasicAA/intrinsics.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
; CHECK: define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
; CHECK-NEXT: entry:
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR:#[0-9]+]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
@@ -22,7 +22,7 @@ entry:
; CHECK: define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
; CHECK-NEXT: entry:
; CHECK-NEXT: %q = getelementptr i8* %p, i64 16
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
@@ -37,3 +37,6 @@ entry:
declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
+
+; CHECK: attributes #0 = { nounwind readonly }
+; CHECK: attributes [[ATTR]] = { nounwind }
diff --git a/test/Analysis/BasicAA/invariant_load.ll b/test/Analysis/BasicAA/invariant_load.ll
new file mode 100644
index 0000000000..cd6ddb92d2
--- /dev/null
+++ b/test/Analysis/BasicAA/invariant_load.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
+
+; The input *.ll is obtained by manually annotating "invariant.load" to the
+; two loads. With "invariant.load" metadata, the second load is redundant.
+;
+; int foo(int *p, char *q) {
+; *q = (char)*p;
+; return *p + 1;
+; }
+
+define i32 @foo(i32* nocapture %p, i8* nocapture %q) {
+entry:
+ %0 = load i32* %p, align 4, !tbaa !0, !invariant.load !3
+ %conv = trunc i32 %0 to i8
+ store i8 %conv, i8* %q, align 1, !tbaa !1
+ %1 = load i32* %p, align 4, !tbaa !0, !invariant.load !3
+ %add = add nsw i32 %1, 1
+ ret i32 %add
+
+; CHECK: foo
+; CHECK: %0 = load i32* %p
+; CHECK: store i8 %conv, i8* %q,
+; CHECK: %add = add nsw i32 %0, 1
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{}
diff --git a/test/Analysis/BasicAA/pure-const-dce.ll b/test/Analysis/BasicAA/pure-const-dce.ll
index 266e607b21..e48992860a 100644
--- a/test/Analysis/BasicAA/pure-const-dce.ll
+++ b/test/Analysis/BasicAA/pure-const-dce.ll
@@ -4,11 +4,11 @@
; CHECK: @test
; CHECK: entry
-; CHECK: %tmp0 = call i32 @TestConst(i32 5) readnone
-; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) readonly
+; CHECK: %tmp0 = call i32 @TestConst(i32 5) [[READNONE:#[0-9]+]]
+; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) [[READONLY:#[0-9]+]]
; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7)
; CHECK-NEXT: store i32 1, i32* @g
-; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) readonly
+; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) [[READONLY]]
; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %sum0 = add i32 %tmp0, %tmp1
@@ -49,3 +49,6 @@ declare i32 @TestConst(i32) readnone
declare i32 @TestPure(i32) readonly
declare i32 @TestNone(i32)
+
+; CHECK: attributes [[READNONE]] = { readnone }
+; CHECK: attributes [[READONLY]] = { readonly }
diff --git a/test/Analysis/CostModel/ARM/cast.ll b/test/Analysis/CostModel/ARM/cast.ll
new file mode 100644
index 0000000000..464b6ece0e
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/cast.ll
@@ -0,0 +1,158 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+define i32 @casts() {
+
+ ; -- scalars --
+ ; CHECK: cost of 1 {{.*}} sext
+ %r0 = sext i1 undef to i8
+ ; CHECK: cost of 1 {{.*}} zext
+ %r1 = zext i1 undef to i8
+ ; CHECK: cost of 1 {{.*}} sext
+ %r2 = sext i1 undef to i16
+ ; CHECK: cost of 1 {{.*}} zext
+ %r3 = zext i1 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r4 = sext i1 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r5 = zext i1 undef to i32
+ ; CHECK: cost of 1 {{.*}} sext
+ %r6 = sext i1 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r7 = zext i1 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r8 = trunc i8 undef to i1
+ ; CHECK: cost of 1 {{.*}} sext
+ %r9 = sext i8 undef to i16
+ ; CHECK: cost of 1 {{.*}} zext
+ %r10 = zext i8 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r11 = sext i8 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r12 = zext i8 undef to i32
+ ; CHECK: cost of 1 {{.*}} sext
+ %r13 = sext i8 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r14 = zext i8 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r15 = trunc i16 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r16 = trunc i16 undef to i8
+ ; CHECK: cost of 1 {{.*}} sext
+ %r17 = sext i16 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r18 = zext i16 undef to i32
+ ; CHECK: cost of 2 {{.*}} sext
+ %r19 = sext i16 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r20 = zext i16 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r21 = trunc i32 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r22 = trunc i32 undef to i8
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r23 = trunc i32 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r24 = sext i32 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r25 = zext i32 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r26 = trunc i64 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r27 = trunc i64 undef to i8
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r28 = trunc i64 undef to i16
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r29 = trunc i64 undef to i32
+
+ ; -- floating point conversions --
+ ; Moves between scalar and NEON registers.
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r30 = fptoui float undef to i1
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r31 = fptosi float undef to i1
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r32 = fptoui float undef to i8
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r33 = fptosi float undef to i8
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r34 = fptoui float undef to i16
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r35 = fptosi float undef to i16
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r36 = fptoui float undef to i32
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r37 = fptosi float undef to i32
+ ; CHECK: cost of 10 {{.*}} fptoui
+ %r38 = fptoui float undef to i64
+ ; CHECK: cost of 10 {{.*}} fptosi
+ %r39 = fptosi float undef to i64
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r40 = fptoui double undef to i1
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r41 = fptosi double undef to i1
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r42 = fptoui double undef to i8
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r43 = fptosi double undef to i8
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r44 = fptoui double undef to i16
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r45 = fptosi double undef to i16
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r46 = fptoui double undef to i32
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r47 = fptosi double undef to i32
+ ; Function call
+ ; CHECK: cost of 10 {{.*}} fptoui
+ %r48 = fptoui double undef to i64
+ ; CHECK: cost of 10 {{.*}} fptosi
+ %r49 = fptosi double undef to i64
+
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r50 = sitofp i1 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r51 = uitofp i1 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r52 = sitofp i1 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r53 = uitofp i1 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r54 = sitofp i8 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r55 = uitofp i8 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r56 = sitofp i8 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r57 = uitofp i8 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r58 = sitofp i16 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r59 = uitofp i16 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r60 = sitofp i16 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r61 = uitofp i16 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r62 = sitofp i32 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r63 = uitofp i32 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r64 = sitofp i32 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r65 = uitofp i32 undef to double
+ ; Function call
+ ; CHECK: cost of 10 {{.*}} sitofp
+ %r66 = sitofp i64 undef to float
+ ; CHECK: cost of 10 {{.*}} uitofp
+ %r67 = uitofp i64 undef to float
+ ; CHECK: cost of 10 {{.*}} sitofp
+ %r68 = sitofp i64 undef to double
+ ; CHECK: cost of 10 {{.*}} uitofp
+ %r69 = uitofp i64 undef to double
+
+ ;CHECK: cost of 0 {{.*}} ret
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/ARM/gep.ll b/test/Analysis/CostModel/ARM/gep.ll
new file mode 100644
index 0000000000..a63b87d2ad
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/gep.ll
@@ -0,0 +1,43 @@
+; RUN: opt -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+define void @test_geps() {
+ ; Cost of scalar integer geps should be one. We can't always expect it to be
+ ; folded into the instruction addressing mode.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i8*
+ %a0 = getelementptr inbounds i8* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i16*
+ %a1 = getelementptr inbounds i16* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i32*
+ %a2 = getelementptr inbounds i32* undef, i32 0
+
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i64*
+ %a3 = getelementptr inbounds i64* undef, i32 0
+
+ ; Cost of scalar floating point geps should be one. We cannot fold the address
+ ; computation.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds float*
+ %a4 = getelementptr inbounds float* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds double*
+ %a5 = getelementptr inbounds double* undef, i32 0
+
+
+ ; Cost of vector geps should be one. We cannot fold the address computation.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i8>*
+ %a7 = getelementptr inbounds <4 x i8>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i16>*
+ %a8 = getelementptr inbounds <4 x i16>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i32>*
+ %a9 = getelementptr inbounds <4 x i32>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i64>*
+ %a10 = getelementptr inbounds <4 x i64>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x float>*
+ %a11 = getelementptr inbounds <4 x float>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x double>*
+ %a12 = getelementptr inbounds <4 x double>* undef, i32 0
+
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/insertelement.ll b/test/Analysis/CostModel/ARM/insertelement.ll
new file mode 100644
index 0000000000..f951b08f9b
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/insertelement.ll
@@ -0,0 +1,46 @@
+; RUN: opt -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; Multiple insert elements from loads into d subregisters are expensive on swift
+; due to renaming constraints.
+%T_i8v = type <8 x i8>
+%T_i8 = type i8
+; CHECK: insertelement_i8
+define void @insertelement_i8(%T_i8* %saddr,
+ %T_i8v* %vaddr) {
+ %v0 = load %T_i8v* %vaddr
+ %v1 = load %T_i8* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <8 x i8>
+ %v2 = insertelement %T_i8v %v0, %T_i8 %v1, i32 1
+ store %T_i8v %v2, %T_i8v* %vaddr
+ ret void
+}
+
+
+%T_i16v = type <4 x i16>
+%T_i16 = type i16
+; CHECK: insertelement_i16
+define void @insertelement_i16(%T_i16* %saddr,
+ %T_i16v* %vaddr) {
+ %v0 = load %T_i16v* %vaddr
+ %v1 = load %T_i16* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <4 x i16>
+ %v2 = insertelement %T_i16v %v0, %T_i16 %v1, i32 1
+ store %T_i16v %v2, %T_i16v* %vaddr
+ ret void
+}
+
+%T_i32v = type <2 x i32>
+%T_i32 = type i32
+; CHECK: insertelement_i32
+define void @insertelement_i32(%T_i32* %saddr,
+ %T_i32v* %vaddr) {
+ %v0 = load %T_i32v* %vaddr
+ %v1 = load %T_i32* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <2 x i32>
+ %v2 = insertelement %T_i32v %v0, %T_i32 %v1, i32 1
+ store %T_i32v %v2, %T_i32v* %vaddr
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/lit.local.cfg b/test/Analysis/CostModel/ARM/lit.local.cfg
new file mode 100644
index 0000000000..cb77b09ef4
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/lit.local.cfg
@@ -0,0 +1,6 @@
+config.suffixes = ['.ll', '.c', '.cpp']
+
+targets = set(config.root.targets_to_build.split())
+if not 'ARM' in targets:
+ config.unsupported = True
+
diff --git a/test/Analysis/CostModel/ARM/select.ll b/test/Analysis/CostModel/ARM/select.ll
new file mode 100644
index 0000000000..96afccfc8c
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/select.ll
@@ -0,0 +1,54 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; CHECK: casts
+define void @casts() {
+ ; Scalar values
+ ; CHECK: cost of 1 {{.*}} select
+ %v1 = select i1 undef, i8 undef, i8 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v2 = select i1 undef, i16 undef, i16 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v3 = select i1 undef, i32 undef, i32 undef
+ ; CHECK: cost of 2 {{.*}} select
+ %v4 = select i1 undef, i64 undef, i64 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v5 = select i1 undef, float undef, float undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v6 = select i1 undef, double undef, double undef
+
+ ; Vector values
+ ; CHECK: cost of 1 {{.*}} select
+ %v7 = select <2 x i1> undef, <2 x i8> undef, <2 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v8 = select <4 x i1> undef, <4 x i8> undef, <4 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v9 = select <8 x i1> undef, <8 x i8> undef, <8 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v10 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v11 = select <2 x i1> undef, <2 x i16> undef, <2 x i16> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v12 = select <4 x i1> undef, <4 x i16> undef, <4 x i16> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v13 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v14 = select <2 x i1> undef, <2 x i32> undef, <2 x i32> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v15 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v16 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v17 = select <2 x i1> undef, <2 x float> undef, <2 x float> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v18 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v19 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/shuffle.ll b/test/Analysis/CostModel/ARM/shuffle.ll
new file mode 100644
index 0000000000..c92d668804
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/shuffle.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; CHECK: shuffle
+define void @shuffle() {
+
+
+ ;; Reverse shuffles should be lowered to vrev and possibly a vext (for
+ ;; quadwords)
+
+ ; Vector values
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v7 = shufflevector <2 x i8> undef, <2 x i8>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v8 = shufflevector <4 x i8> undef, <4 x i8>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v9 = shufflevector <8 x i8> undef, <8 x i8>undef, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v10 = shufflevector <16 x i8> undef, <16 x i8>undef, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v11 = shufflevector <2 x i16> undef, <2 x i16>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v12 = shufflevector <4 x i16> undef, <4 x i16>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v13 = shufflevector <8 x i16> undef, <8 x i16>undef, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v14 = shufflevector <2 x i32> undef, <2 x i32>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v15 = shufflevector <4 x i32> undef, <4 x i32>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v16 = shufflevector <2 x float> undef, <2 x float>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v17 = shufflevector <4 x float> undef, <4 x float>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/PowerPC/insert_extract.ll b/test/Analysis/CostModel/PowerPC/insert_extract.ll
new file mode 100644
index 0000000000..f51963d56f
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/insert_extract.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define i32 @insert(i32 %arg) {
+ ; CHECK: cost of 13 {{.*}} insertelement
+ %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+ ret i32 undef
+}
+
+define i32 @extract(<4 x i32> %arg) {
+ ; CHECK: cost of 13 {{.*}} extractelement
+ %x = extractelement <4 x i32> %arg, i32 0
+ ret i32 %x
+}
+
diff --git a/test/Analysis/CostModel/PowerPC/lit.local.cfg b/test/Analysis/CostModel/PowerPC/lit.local.cfg
new file mode 100644
index 0000000000..4019eca0bb
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/lit.local.cfg
@@ -0,0 +1,6 @@
+config.suffixes = ['.ll', '.c', '.cpp']
+
+targets = set(config.root.targets_to_build.split())
+if not 'PowerPC' in targets:
+ config.unsupported = True
+
diff --git a/test/Analysis/CostModel/PowerPC/load_store.ll b/test/Analysis/CostModel/PowerPC/load_store.ll
new file mode 100644
index 0000000000..c77cce955a
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/load_store.ll
@@ -0,0 +1,34 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define i32 @stores(i32 %arg) {
+
+ ; CHECK: cost of 1 {{.*}} store
+ store i8 undef, i8* undef, align 4
+ ; CHECK: cost of 1 {{.*}} store
+ store i16 undef, i16* undef, align 4
+ ; CHECK: cost of 1 {{.*}} store
+ store i32 undef, i32* undef, align 4
+ ; CHECK: cost of 2 {{.*}} store
+ store i64 undef, i64* undef, align 4
+ ; CHECK: cost of 4 {{.*}} store
+ store i128 undef, i128* undef, align 4
+
+ ret i32 undef
+}
+define i32 @loads(i32 %arg) {
+ ; CHECK: cost of 1 {{.*}} load
+ load i8* undef, align 4
+ ; CHECK: cost of 1 {{.*}} load
+ load i16* undef, align 4
+ ; CHECK: cost of 1 {{.*}} load
+ load i32* undef, align 4
+ ; CHECK: cost of 2 {{.*}} load
+ load i64* undef, align 4
+ ; CHECK: cost of 4 {{.*}} load
+ load i128* undef, align 4
+
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/X86/arith.ll b/test/Analysis/CostModel/X86/arith.ll
index ae78d44aeb..f0521bae48 100644
--- a/test/Analysis/CostModel/X86/arith.ll
+++ b/test/Analysis/CostModel/X86/arith.ll
@@ -1,4 +1,6 @@
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core2 | FileCheck %s --check-prefix=SSE3
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck %s --check-prefix=AVX2
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
@@ -32,7 +34,37 @@ define i32 @xor(i32 %arg) {
ret i32 undef
}
+; CHECK: mul
+define void @mul() {
+ ; A <2 x i32> gets expanded to a <2 x i64> vector.
+ ; A <2 x i64> vector multiply is implemented using
+ ; 3 PMULUDQ and 2 PADDS and 4 shifts.
+ ;CHECK: cost of 9 {{.*}} mul
+ %A0 = mul <2 x i32> undef, undef
+ ;CHECK: cost of 9 {{.*}} mul
+ %A1 = mul <2 x i64> undef, undef
+ ;CHECK: cost of 18 {{.*}} mul
+ %A2 = mul <4 x i64> undef, undef
+ ret void
+}
+
+; SSE3: sse3mull
+define void @sse3mull() {
+ ; SSE3: cost of 6 {{.*}} mul
+ %A0 = mul <4 x i32> undef, undef
+ ret void
+ ; SSE3: avx2mull
+}
+
+; AVX2: avx2mull
+define void @avx2mull() {
+ ; AVX2: cost of 9 {{.*}} mul
+ %A0 = mul <4 x i64> undef, undef
+ ret void
+ ; AVX2: fmul
+}
+; CHECK: fmul
define i32 @fmul(i32 %arg) {
;CHECK: cost of 1 {{.*}} fmul
%A = fmul <4 x float> undef, undef
diff --git a/test/Analysis/CostModel/X86/cast.ll b/test/Analysis/CostModel/X86/cast.ll
index cedc682598..bacc778691 100644
--- a/test/Analysis/CostModel/X86/cast.ll
+++ b/test/Analysis/CostModel/X86/cast.ll
@@ -44,6 +44,10 @@ define i32 @zext_sext(<8 x i1> %in) {
%B = zext <8 x i16> undef to <8 x i32>
;CHECK: cost of 1 {{.*}} sext
%C = sext <4 x i32> undef to <4 x i64>
+ ;CHECK: cost of 8 {{.*}} sext
+ %C1 = sext <4 x i8> undef to <4 x i64>
+ ;CHECK: cost of 8 {{.*}} sext
+ %C2 = sext <4 x i16> undef to <4 x i64>
;CHECK: cost of 1 {{.*}} zext
%D = zext <4 x i32> undef to <4 x i64>
@@ -59,7 +63,7 @@ define i32 @zext_sext(<8 x i1> %in) {
ret i32 undef
}
-define i32 @masks(<8 x i1> %in) {
+define i32 @masks8(<8 x i1> %in) {
;CHECK: cost of 6 {{.*}} zext
%Z = zext <8 x i1> %in to <8 x i32>
;CHECK: cost of 9 {{.*}} sext
@@ -67,3 +71,9 @@ define i32 @masks(<8 x i1> %in) {
ret i32 undef
}
+define i32 @masks4(<4 x i1> %in) {
+ ;CHECK: cost of 8 {{.*}} sext
+ %S = sext <4 x i1> %in to <4 x i64>
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/X86/cmp.ll b/test/Analysis/CostModel/X86/cmp.ll
index 90b09c1154..713b3742e9 100644
--- a/test/Analysis/CostModel/X86/cmp.ll
+++ b/test/Analysis/CostModel/X86/cmp.ll
@@ -1,38 +1,52 @@
-; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck --check-prefix=AVX1 %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck --check-prefix=AVX2 %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
define i32 @cmp(i32 %arg) {
; -- floats --
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%A = fcmp olt <2 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%B = fcmp olt <4 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%C = fcmp olt <8 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%D = fcmp olt <2 x double> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%E = fcmp olt <4 x double> undef, undef
; -- integers --
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%F = icmp eq <16 x i8> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%G = icmp eq <8 x i16> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%H = icmp eq <4 x i32> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%I = icmp eq <2 x i64> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%J = icmp eq <4 x i64> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%K = icmp eq <8 x i32> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%L = icmp eq <16 x i16> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%M = icmp eq <32 x i8> undef, undef
;CHECK: cost of 0 {{.*}} ret
diff --git a/test/Analysis/CostModel/X86/gep.ll b/test/Analysis/CostModel/X86/gep.ll
new file mode 100644
index 0000000000..877184a3ea
--- /dev/null
+++ b/test/Analysis/CostModel/X86/gep.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+
+define void @test_geps() {
+ ; Cost of should be zero. We expect it to be folded into
+ ; the instruction addressing mode.
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i8*
+ %a0 = getelementptr inbounds i8* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i16*
+ %a1 = getelementptr inbounds i16* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i32*
+ %a2 = getelementptr inbounds i32* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i64*
+ %a3 = getelementptr inbounds i64* undef, i32 0
+
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds float*
+ %a4 = getelementptr inbounds float* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds double*
+ %a5 = getelementptr inbounds double* undef, i32 0
+
+ ; Vector geps should also have zero cost.
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i8>*
+ %a7 = getelementptr inbounds <4 x i8>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i16>*
+ %a8 = getelementptr inbounds <4 x i16>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i32>*
+ %a9 = getelementptr inbounds <4 x i32>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i64>*
+ %a10 = getelementptr inbounds <4 x i64>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x float>*
+ %a11 = getelementptr inbounds <4 x float>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x double>*
+ %a12 = getelementptr inbounds <4 x double>* undef, i32 0
+
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/X86/i32.ll b/test/Analysis/CostModel/X86/i32.ll
index 52c295934c..c2dce762a0 100644
--- a/test/Analysis/CostModel/X86/i32.ll
+++ b/test/Analysis/CostModel/X86/i32.ll
@@ -1,7 +1,5 @@
; RUN: opt < %s -cost-model -analyze -mtriple=i386 -mcpu=corei7-avx | FileCheck %s
-
-;CHECK: cost of 2 {{.*}} add
;CHECK: cost of 0 {{.*}} ret
define i32 @no_info(i32 %arg) {
%e = add i64 undef, undef
diff --git a/test/Analysis/CostModel/X86/intrinsic-cost.ll b/test/Analysis/CostModel/X86/intrinsic-cost.ll
new file mode 100644
index 0000000000..e235a36222
--- /dev/null
+++ b/test/Analysis/CostModel/X86/intrinsic-cost.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck %s -check-prefix=CORE2
+; RUN: opt -S -mtriple=x86_64-apple-darwin -mcpu=corei7 -cost-model -analyze < %s | FileCheck %s -check-prefix=COREI7
+
+; If SSE4.1 roundps instruction is available it is cheap to lower, otherwise
+; it'll be scalarized into calls which are expensive.
+define void @test1(float* nocapture %f) nounwind {
+vector.ph:
+ br label %vector.body
+
+vector.body: ; preds = %vector.body, %vector.ph
+ %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
+ %0 = getelementptr inbounds float* %f, i64 %index
+ %1 = bitcast float* %0 to <4 x float>*
+ %wide.load = load <4 x float>* %1, align 4
+ %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+ store <4 x float> %2, <4 x float>* %1, align 4
+ %index.next = add i64 %index, 4
+ %3 = icmp eq i64 %index.next, 1024
+ br i1 %3, label %for.end, label %vector.body
+
+for.end: ; preds = %vector.body
+ ret void
+
+; CORE2: Printing analysis 'Cost Model Analysis' for function 'test1':
+; CORE2: Cost Model: Found an estimated cost of 400 for instruction: %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+
+; COREI7: Printing analysis 'Cost Model Analysis' for function 'test1':
+; COREI7: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+
+}
+
+declare <4 x float> @llvm.ceil.v4f32(<4 x float>) nounwind readnone
diff --git a/test/Analysis/CostModel/X86/load_store.ll b/test/Analysis/CostModel/X86/load_store.ll
new file mode 100644
index 0000000000..4195b1d879
--- /dev/null
+++ b/test/Analysis/CostModel/X86/load_store.ll
@@ -0,0 +1,64 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+define i32 @stores(i32 %arg) {
+
+ ;CHECK: cost of 1 {{.*}} store
+ store i8 undef, i8* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i16 undef, i16* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i32 undef, i32* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i64 undef, i64* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store i128 undef, i128* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} store
+ store <4 x i16> undef, <4 x i16>* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store <4 x i32> undef, <4 x i32>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store <4 x i64> undef, <4 x i64>* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} store
+ store <8 x i16> undef, <8 x i16>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store <8 x i32> undef, <8 x i32>* undef, align 4
+ ;CHECK: cost of 4 {{.*}} store
+ store <8 x i64> undef, <8 x i64>* undef, align 4
+
+ ret i32 undef
+}
+define i32 @loads(i32 %arg) {
+ ;CHECK: cost of 1 {{.*}} load
+ load i8* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i16* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i32* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i64* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load i128* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} load
+ load <2 x i32>* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load <4 x i32>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load <8 x i32>* undef, align 4
+
+
+ ;CHECK: cost of 1 {{.*}} load
+ load <2 x i64>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load <4 x i64>* undef, align 4
+ ;CHECK: cost of 4 {{.*}} load
+ load <8 x i64>* undef, align 4
+
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/X86/vectorized-loop.ll b/test/Analysis/CostModel/X86/vectorized-loop.ll
index 6c9e111bb1..25b11145c6 100644
--- a/test/Analysis/CostModel/X86/vectorized-loop.ll
+++ b/test/Analysis/CostModel/X86/vectorized-loop.ll
@@ -28,16 +28,17 @@ vector.body: ; preds = %for.body.lr.ph, %ve
%4 = getelementptr inbounds i32* %B, i64 %3
;CHECK: cost of 0 {{.*}} bitcast
%5 = bitcast i32* %4 to <8 x i32>*
- ;CHECK: cost of 1 {{.*}} load
+ ;CHECK: cost of 2 {{.*}} load
%6 = load <8 x i32>* %5, align 4
;CHECK: cost of 4 {{.*}} mul
%7 = mul nsw <8 x i32> %6, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
%8 = getelementptr inbounds i32* %A, i64 %index
%9 = bitcast i32* %8 to <8 x i32>*
+ ;CHECK: cost of 2 {{.*}} load
%10 = load <8 x i32>* %9, align 4
;CHECK: cost of 4 {{.*}} add
%11 = add nsw <8 x i32> %10, %7
- ;CHECK: cost of 1 {{.*}} store
+ ;CHECK: cost of 2 {{.*}} store
store <8 x i32> %11, <8 x i32>* %9, align 4
%index.next = add i64 %index, 8
%12 = icmp eq i64 %index.next, %end.idx.rnd.down
diff --git a/test/Analysis/CostModel/no_info.ll b/test/Analysis/CostModel/no_info.ll
index d20d56b79a..f3f165b1b5 100644
--- a/test/Analysis/CostModel/no_info.ll
+++ b/test/Analysis/CostModel/no_info.ll
@@ -1,11 +1,8 @@
; RUN: opt < %s -cost-model -analyze | FileCheck %s
; The cost model does not have any target information so it can't make a decision.
-; Notice that OPT does not read the triple information from the module itself, only through the command line.
-; This info ignored:
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.8.0"
+; -- No triple in this module --
;CHECK: Unknown cost {{.*}} add
;CHECK: Unknown cost {{.*}} ret
diff --git a/test/Analysis/Dominators/invoke.ll b/test/Analysis/Dominators/invoke.ll
index f935750c98..da0b246165 100644
--- a/test/Analysis/Dominators/invoke.ll
+++ b/test/Analysis/Dominators/invoke.ll
@@ -1,4 +1,4 @@
-; RUN: opt -verify -disable-output %s
+; RUN: opt -verify -disable-output < %s
; This tests that we handle unreachable blocks correctly
define void @f() {
diff --git a/test/Analysis/Profiling/lit.local.cfg b/test/Analysis/Profiling/lit.local.cfg
index 19eebc0ac7..d507d3fd71 100644
--- a/test/Analysis/Profiling/lit.local.cfg
+++ b/test/Analysis/Profiling/lit.local.cfg
@@ -1 +1,13 @@
config.suffixes = ['.ll', '.c', '.cpp']
+
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+# Most profiling tests rely on a JIT being present to gather their data; AArch64
+# doesn't have any JIT at present so they will fail when run there.
+if root.host_arch in ['AArch64']:
+ config.unsupported = True
diff --git a/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll b/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
index 218b4375f7..0dfa0bf9cd 100644
--- a/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
+++ b/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
@@ -1,4 +1,4 @@
-; RUN: opt -regions %s
+; RUN: opt -regions < %s
define i32 @main() nounwind {
entry:
br label %for.cond
diff --git a/test/Analysis/RegionInfo/block_sort.ll b/test/Analysis/RegionInfo/Stats/block_sort.ll
index ac77ab36e6..ac77ab36e6 100644
--- a/test/Analysis/RegionInfo/block_sort.ll
+++ b/test/Analysis/RegionInfo/Stats/block_sort.ll
diff --git a/test/Analysis/RegionInfo/cond_loop.ll b/test/Analysis/RegionInfo/Stats/cond_loop.ll
index 1145ffdba0..1145ffdba0 100644
--- a/test/Analysis/RegionInfo/cond_loop.ll
+++ b/test/Analysis/RegionInfo/Stats/cond_loop.ll
diff --git a/test/Analysis/RegionInfo/condition_complicated.ll b/test/Analysis/RegionInfo/Stats/condition_complicated.ll
index 6b398800db..6b398800db 100644
--- a/test/Analysis/RegionInfo/condition_complicated.ll
+++ b/test/Analysis/RegionInfo/Stats/condition_complicated.ll
diff --git a/test/Analysis/RegionInfo/condition_complicated_2.ll b/test/Analysis/RegionInfo/Stats/condition_complicated_2.ll
index f551108d60..f551108d60 100644
--- a/test/Analysis/RegionInfo/condition_complicated_2.ll
+++ b/test/Analysis/RegionInfo/Stats/condition_complicated_2.ll
diff --git a/test/Analysis/RegionInfo/condition_forward_edge.ll b/test/Analysis/RegionInfo/Stats/condition_forward_edge.ll
index 5e4d9d2f8b..5e4d9d2f8b 100644
--- a/test/Analysis/RegionInfo/condition_forward_edge.ll
+++ b/test/Analysis/RegionInfo/Stats/condition_forward_edge.ll
diff --git a/test/Analysis/RegionInfo/condition_same_exit.ll b/test/Analysis/RegionInfo/Stats/condition_same_exit.ll
index e48413a4c2..e48413a4c2 100644
--- a/test/Analysis/RegionInfo/condition_same_exit.ll
+++ b/test/Analysis/RegionInfo/Stats/condition_same_exit.ll
diff --git a/test/Analysis/RegionInfo/condition_simple.ll b/test/Analysis/RegionInfo/Stats/condition_simple.ll
index 00d9ed24e1..00d9ed24e1 100644
--- a/test/Analysis/RegionInfo/condition_simple.ll
+++ b/test/Analysis/RegionInfo/Stats/condition_simple.ll
diff --git a/test/Analysis/RegionInfo/exit_in_condition.ll b/test/Analysis/RegionInfo/Stats/exit_in_condition.ll
index b84abecc16..b84abecc16 100644
--- a/test/Analysis/RegionInfo/exit_in_condition.ll
+++ b/test/Analysis/RegionInfo/Stats/exit_in_condition.ll
diff --git a/test/Analysis/RegionInfo/infinite_loop.ll b/test/Analysis/RegionInfo/Stats/infinite_loop.ll
index 8e588286a5..8e588286a5 100644
--- a/test/Analysis/RegionInfo/infinite_loop.ll
+++ b/test/Analysis/RegionInfo/Stats/infinite_loop.ll
diff --git a/test/Analysis/RegionInfo/infinite_loop_2.ll b/test/Analysis/RegionInfo/Stats/infinite_loop_2.ll
index a8227e340c..a8227e340c 100644
--- a/test/Analysis/RegionInfo/infinite_loop_2.ll
+++ b/test/Analysis/RegionInfo/Stats/infinite_loop_2.ll
diff --git a/test/Analysis/RegionInfo/infinite_loop_3.ll b/test/Analysis/RegionInfo/Stats/infinite_loop_3.ll
index b09c9c1e59..b09c9c1e59 100644
--- a/test/Analysis/RegionInfo/infinite_loop_3.ll
+++ b/test/Analysis/RegionInfo/Stats/infinite_loop_3.ll
diff --git a/test/Analysis/RegionInfo/infinite_loop_4.ll b/test/Analysis/RegionInfo/Stats/infinite_loop_4.ll
index 681c305ce9..681c305ce9 100644
--- a/test/Analysis/RegionInfo/infinite_loop_4.ll
+++ b/test/Analysis/RegionInfo/Stats/infinite_loop_4.ll
diff --git a/test/Analysis/RegionInfo/Stats/lit.local.cfg b/test/Analysis/RegionInfo/Stats/lit.local.cfg
new file mode 100644
index 0000000000..89c0cd9d48
--- /dev/null
+++ b/test/Analysis/RegionInfo/Stats/lit.local.cfg
@@ -0,0 +1,4 @@
+config.suffixes = ['.ll', '.c', '.cpp']
+
+if not config.root.enable_assertions:
+ config.unsupported = True
diff --git a/test/Analysis/RegionInfo/loop_with_condition.ll b/test/Analysis/RegionInfo/Stats/loop_with_condition.ll
index 08d2ba8e35..08d2ba8e35 100644
--- a/test/Analysis/RegionInfo/loop_with_condition.ll
+++ b/test/Analysis/RegionInfo/Stats/loop_with_condition.ll
diff --git a/test/Analysis/RegionInfo/loops_1.ll b/test/Analysis/RegionInfo/Stats/loops_1.ll
index 6449949df8..6449949df8 100644
--- a/test/Analysis/RegionInfo/loops_1.ll
+++ b/test/Analysis/RegionInfo/Stats/loops_1.ll
diff --git a/test/Analysis/RegionInfo/loops_2.ll b/test/Analysis/RegionInfo/Stats/loops_2.ll
index dc4a1adffb..dc4a1adffb 100644
--- a/test/Analysis/RegionInfo/loops_2.ll
+++ b/test/Analysis/RegionInfo/Stats/loops_2.ll
diff --git a/test/Analysis/RegionInfo/mix_1.ll b/test/Analysis/RegionInfo/Stats/mix_1.ll
index 1474e033e5..1474e033e5 100644
--- a/test/Analysis/RegionInfo/mix_1.ll
+++ b/test/Analysis/RegionInfo/Stats/mix_1.ll
diff --git a/test/Analysis/RegionInfo/nested_loops.ll b/test/Analysis/RegionInfo/Stats/nested_loops.ll
index a3707a1987..a3707a1987 100644
--- a/test/Analysis/RegionInfo/nested_loops.ll
+++ b/test/Analysis/RegionInfo/Stats/nested_loops.ll
diff --git a/test/Analysis/RegionInfo/next.ll b/test/Analysis/RegionInfo/Stats/next.ll
index 890b4f2300..890b4f2300 100644
--- a/test/Analysis/RegionInfo/next.ll
+++ b/test/Analysis/RegionInfo/Stats/next.ll
diff --git a/test/Analysis/RegionInfo/paper.ll b/test/Analysis/RegionInfo/Stats/paper.ll
index 96c87e0559..96c87e0559 100644
--- a/test/Analysis/RegionInfo/paper.ll
+++ b/test/Analysis/RegionInfo/Stats/paper.ll
diff --git a/test/Analysis/RegionInfo/two_loops_same_header.ll b/test/Analysis/RegionInfo/Stats/two_loops_same_header.ll
index e75661e890..e75661e890 100644
--- a/test/Analysis/RegionInfo/two_loops_same_header.ll
+++ b/test/Analysis/RegionInfo/Stats/two_loops_same_header.ll
diff --git a/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
index aba0ce7467..5a02398104 100644
--- a/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
+++ b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
@@ -1,8 +1,10 @@
-; RUN: opt -indvars -scalar-evolution -analyze %s
+; RUN: opt -indvars -scalar-evolution -analyze < %s | FileCheck %s
; This test checks if the SCEV analysis is printed out at all.
; It failed once as the RequiredTransitive option was not implemented
; correctly.
+; CHECK: Classifying expressions for: @main
+
define i32 @main() nounwind {
entry:
br label %for.cond
diff --git a/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll b/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
index 9f17e27577..49e944dcd2 100644
--- a/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
+++ b/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
@@ -1,4 +1,4 @@
-; RUN: opt -indvars %s
+; RUN: opt -indvars < %s
; PR9424: Attempt to use a SCEVCouldNotCompute object!
; The inner loop computes the Step and Start of the outer loop.
; Call that Vexit. The outer End value is max(2,Vexit), because
diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll
index 4e2adf187e..57006dd9bb 100644
--- a/test/Analysis/ScalarEvolution/fold.ll
+++ b/test/Analysis/ScalarEvolution/fold.ll
@@ -1,4 +1,4 @@
-; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
+; RUN: opt -analyze -scalar-evolution -S < %s | FileCheck %s
define i16 @test1(i8 %x) {
%A = zext i8 %x to i12
diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
index 1ac59278e7..c6cc26a241 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -9,13 +9,13 @@
; invalid, as it's possible that this only happens after optimization on a
; code path which isn't ever executed.
-; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
+; CHECK: define void @test0_yes(i32* nocapture %p) #0 {
define void @test0_yes(i32* %p) nounwind {
store i32 0, i32* %p, !tbaa !1
ret void
}
-; CHECK: define void @test0_no(i32* nocapture %p) nounwind {
+; CHECK: define void @test0_no(i32* nocapture %p) #1 {
define void @test0_no(i32* %p) nounwind {
store i32 0, i32* %p, !tbaa !2
ret void
@@ -24,13 +24,13 @@ define void @test0_no(i32* %p) nounwind {
; Add the readonly attribute, since there's just a call to a function which
; TBAA says doesn't modify any memory.
-; CHECK: define void @test1_yes(i32* nocapture %p) nounwind readonly {
+; CHECK: define void @test1_yes(i32* nocapture %p) #2 {
define void @test1_yes(i32* %p) nounwind {
call void @callee(i32* %p), !tbaa !1
ret void
}
-; CHECK: define void @test1_no(i32* %p) nounwind {
+; CHECK: define void @test1_no(i32* %p) #1 {
define void @test1_no(i32* %p) nounwind {
call void @callee(i32* %p), !tbaa !2
ret void
@@ -43,13 +43,13 @@ define void @test1_no(i32* %p) nounwind {
; This is unusual, since the function is memcpy, but as above, this
; isn't necessarily invalid.
-; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone {
+; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) #0 {
define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1
ret void
}
-; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind {
+; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) #1 {
define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2
ret void
@@ -57,13 +57,13 @@ define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
; Similar to the others, va_arg only accesses memory through its operand.
-; CHECK: define i32 @test3_yes(i8* nocapture %p) nounwind readnone {
+; CHECK: define i32 @test3_yes(i8* nocapture %p) #0 {
define i32 @test3_yes(i8* %p) nounwind {
%t = va_arg i8* %p, i32, !tbaa !1
ret i32 %t
}
-; CHECK: define i32 @test3_no(i8* nocapture %p) nounwind {
+; CHECK: define i32 @test3_no(i8* nocapture %p) #1 {
define i32 @test3_no(i8* %p) nounwind {
%t = va_arg i8* %p, i32, !tbaa !2
ret i32 %t
@@ -72,6 +72,10 @@ define i32 @test3_no(i8* %p) nounwind {
declare void @callee(i32* %p) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind
+; CHECK: attributes #0 = { nounwind readnone }
+; CHECK: attributes #1 = { nounwind }
+; CHECK: attributes #2 = { nounwind readonly }
+
; Root note.
!0 = metadata !{ }
diff --git a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
index 8f080e2108..6f1c22da3a 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
; CHECK: define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
; CHECK-NEXT: entry:
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[NUW:#[0-9]+]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
@@ -22,6 +22,9 @@ entry:
declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
+; CHECK: attributes #0 = { nounwind readonly }
+; CHECK: attributes [[NUW]] = { nounwind }
+
!0 = metadata !{metadata !"tbaa root", null}
!1 = metadata !{metadata !"A", metadata !0}
!2 = metadata !{metadata !"B", metadata !0}