| Sanjay Patel | b653de1 | 2014-09-10 17:58:16 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 2 |  | 
|  | 3 | ; Artificial datalayout | 
|  | 4 | target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n32:64" | 
|  | 5 |  | 
|  | 6 |  | 
|  | 7 | define void @add_ints_1_1_1(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 { | 
|  | 8 | ; CHECK-LABEL: @add_ints_1_1_1( | 
|  | 9 | ; CHECK: <4 x i32> | 
|  | 10 | ; CHECK: ret | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 11 |  | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 12 | entry: | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 13 | br label %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 14 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 15 | for.body:                                         ; preds = %entry, %for.body | 
|  | 16 | %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 17 | %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 18 | %0 = load i32, i32 addrspace(1)* %arrayidx, align 4 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 19 | %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %c, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 20 | %1 = load i32, i32 addrspace(1)* %arrayidx1, align 4 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 21 | %add = add nsw i32 %0, %1 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 22 | %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %i.01 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 23 | store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 24 | %inc = add i64 %i.01, 1 | 
|  | 25 | %cmp = icmp ult i64 %inc, 200 | 
|  | 26 | br i1 %cmp, label %for.body, label %for.end | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 27 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 28 | for.end:                                          ; preds = %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 29 | ret void | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 { | 
|  | 33 | ; CHECK-LABEL: @add_ints_as_1_0_0( | 
|  | 34 | ; CHECK-NOT: <4 x i32> | 
|  | 35 | ; CHECK: ret | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 36 |  | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 37 | entry: | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 38 | br label %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 39 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 40 | for.body:                                         ; preds = %entry, %for.body | 
|  | 41 | %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 42 | %arrayidx = getelementptr inbounds i32, i32* %b, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 43 | %0 = load i32, i32* %arrayidx, align 4 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 44 | %arrayidx1 = getelementptr inbounds i32, i32* %c, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 45 | %1 = load i32, i32* %arrayidx1, align 4 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 46 | %add = add nsw i32 %0, %1 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 47 | %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %i.01 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 48 | store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 49 | %inc = add i64 %i.01, 1 | 
|  | 50 | %cmp = icmp ult i64 %inc, 200 | 
|  | 51 | br i1 %cmp, label %for.body, label %for.end | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 52 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 53 | for.end:                                          ; preds = %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 54 | ret void | 
|  | 55 | } | 
|  | 56 |  | 
|  | 57 | define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 { | 
|  | 58 | ; CHECK-LABEL: @add_ints_as_0_1_0( | 
|  | 59 | ; CHECK-NOT: <4 x i32> | 
|  | 60 | ; CHECK: ret | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 61 |  | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 62 | entry: | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 63 | br label %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 64 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 65 | for.body:                                         ; preds = %entry, %for.body | 
|  | 66 | %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 67 | %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 68 | %0 = load i32, i32 addrspace(1)* %arrayidx, align 4 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 69 | %arrayidx1 = getelementptr inbounds i32, i32* %c, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 70 | %1 = load i32, i32* %arrayidx1, align 4 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 71 | %add = add nsw i32 %0, %1 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 72 | %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 73 | store i32 %add, i32* %arrayidx2, align 4 | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 74 | %inc = add i64 %i.01, 1 | 
|  | 75 | %cmp = icmp ult i64 %inc, 200 | 
|  | 76 | br i1 %cmp, label %for.body, label %for.end | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 77 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 78 | for.end:                                          ; preds = %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 79 | ret void | 
|  | 80 | } | 
|  | 81 |  | 
|  | 82 | define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 { | 
|  | 83 | ; CHECK-LABEL: @add_ints_as_0_1_1( | 
|  | 84 | ; CHECK-NOT: <4 x i32> | 
|  | 85 | ; CHECK: ret | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 86 |  | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 87 | entry: | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 88 | br label %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 89 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 90 | for.body:                                         ; preds = %entry, %for.body | 
|  | 91 | %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 92 | %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 93 | %0 = load i32, i32 addrspace(1)* %arrayidx, align 4 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 94 | %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %c, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 95 | %1 = load i32, i32 addrspace(1)* %arrayidx1, align 4 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 96 | %add = add nsw i32 %0, %1 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 97 | %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 98 | store i32 %add, i32* %arrayidx2, align 4 | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 99 | %inc = add i64 %i.01, 1 | 
|  | 100 | %cmp = icmp ult i64 %inc, 200 | 
|  | 101 | br i1 %cmp, label %for.body, label %for.end | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 102 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 103 | for.end:                                          ; preds = %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 104 | ret void | 
|  | 105 | } | 
|  | 106 |  | 
|  | 107 | define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* %c) #0 { | 
|  | 108 | ; CHECK-LABEL: @add_ints_as_0_1_2( | 
|  | 109 | ; CHECK-NOT: <4 x i32> | 
|  | 110 | ; CHECK: ret | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 111 |  | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 112 | entry: | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 113 | br label %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 114 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 115 | for.body:                                         ; preds = %entry, %for.body | 
|  | 116 | %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 117 | %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 118 | %0 = load i32, i32 addrspace(1)* %arrayidx, align 4 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 119 | %arrayidx1 = getelementptr inbounds i32, i32 addrspace(2)* %c, i64 %i.01 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 120 | %1 = load i32, i32 addrspace(2)* %arrayidx1, align 4 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 121 | %add = add nsw i32 %0, %1 | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 122 | %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01 | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 123 | store i32 %add, i32* %arrayidx2, align 4 | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 124 | %inc = add i64 %i.01, 1 | 
|  | 125 | %cmp = icmp ult i64 %inc, 200 | 
|  | 126 | br i1 %cmp, label %for.body, label %for.end | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 127 |  | 
| Michael Zolotukhin | 540580c | 2014-12-02 22:59:02 +0000 | [diff] [blame] | 128 | for.end:                                          ; preds = %for.body | 
| Matt Arsenault | 0be1cb1 | 2013-10-02 22:38:17 +0000 | [diff] [blame] | 129 | ret void | 
|  | 130 | } | 
|  | 131 |  | 
|  | 132 | attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |