1 ; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s 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 11 entry: 12 br label %for.cond 13 14 for.cond: ; preds = %for.body, %entry 15 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 16 %cmp = icmp ult i64 %i.0, 200 17 br i1 %cmp, label %for.body, label %for.end 18 19 for.body: ; preds = %for.cond 20 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 21 %0 = load i32 addrspace(1)* %arrayidx, align 4 22 %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 23 %1 = load i32 addrspace(1)* %arrayidx1, align 4 24 %add = add nsw i32 %0, %1 25 %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 26 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 27 %inc = add i64 %i.0, 1 28 br label %for.cond 29 30 for.end: ; preds = %for.cond 31 ret void 32 } 33 34 define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 { 35 ; CHECK-LABEL: @add_ints_as_1_0_0( 36 ; CHECK-NOT: <4 x i32> 37 ; CHECK: ret 38 entry: 39 br label %for.cond 40 41 for.cond: ; preds = %for.body, %entry 42 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 43 %cmp = icmp ult i64 %i.0, 200 44 br i1 %cmp, label %for.body, label %for.end 45 46 for.body: ; preds = %for.cond 47 %arrayidx = getelementptr inbounds i32* %b, i64 %i.0 48 %0 = load i32* %arrayidx, align 4 49 %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 50 %1 = load i32* %arrayidx1, align 4 51 %add = add nsw i32 %0, %1 52 %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 53 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 54 %inc = add i64 %i.0, 1 55 br label %for.cond 56 57 for.end: ; preds = %for.cond 58 ret void 59 } 60 61 define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 { 62 ; CHECK-LABEL: @add_ints_as_0_1_0( 63 ; CHECK-NOT: <4 x i32> 64 ; CHECK: ret 65 entry: 66 br label %for.cond 67 68 for.cond: ; preds = %for.body, %entry 69 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 70 %cmp = icmp ult i64 %i.0, 200 71 br i1 %cmp, label %for.body, label %for.end 72 73 for.body: ; preds = %for.cond 74 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 75 %0 = load i32 addrspace(1)* %arrayidx, align 4 76 %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 77 %1 = load i32* %arrayidx1, align 4 78 %add = add nsw i32 %0, %1 79 %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 80 store i32 %add, i32* %arrayidx2, align 4 81 %inc = add i64 %i.0, 1 82 br label %for.cond 83 84 for.end: ; preds = %for.cond 85 ret void 86 } 87 88 define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 { 89 ; CHECK-LABEL: @add_ints_as_0_1_1( 90 ; CHECK-NOT: <4 x i32> 91 ; CHECK: ret 92 entry: 93 br label %for.cond 94 95 for.cond: ; preds = %for.body, %entry 96 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 97 %cmp = icmp ult i64 %i.0, 200 98 br i1 %cmp, label %for.body, label %for.end 99 100 for.body: ; preds = %for.cond 101 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 102 %0 = load i32 addrspace(1)* %arrayidx, align 4 103 %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 104 %1 = load i32 addrspace(1)* %arrayidx1, align 4 105 %add = add nsw i32 %0, %1 106 %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 107 store i32 %add, i32* %arrayidx2, align 4 108 %inc = add i64 %i.0, 1 109 br label %for.cond 110 111 for.end: ; preds = %for.cond 112 ret void 113 } 114 115 define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* %c) #0 { 116 ; CHECK-LABEL: @add_ints_as_0_1_2( 117 ; CHECK-NOT: <4 x i32> 118 ; CHECK: ret 119 entry: 120 br label %for.cond 121 122 for.cond: ; preds = %for.body, %entry 123 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 124 %cmp = icmp ult i64 %i.0, 200 125 br i1 %cmp, label %for.body, label %for.end 126 127 for.body: ; preds = %for.cond 128 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 129 %0 = load i32 addrspace(1)* %arrayidx, align 4 130 %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0 131 %1 = load i32 addrspace(2)* %arrayidx1, align 4 132 %add = add nsw i32 %0, %1 133 %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 134 store i32 %add, i32* %arrayidx2, align 4 135 %inc = add i64 %i.0, 1 136 br label %for.cond 137 138 for.end: ; preds = %for.cond 139 ret void 140 } 141 142 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" } 143