1 ; PR1135 2 ; RUN: llc %s -o - | FileCheck %s 3 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" 4 target triple = "x86_64-apple-darwin10.3" 5 6 7 ; CHECK: movl %{{.*}}, (%rdi,[[R0:.+]],4) 8 ; CHECK: movl %{{.*}}, 8(%rdi,[[R0]],4) 9 ; CHECK: movl %{{.*}}, 4(%rdi,[[R0]],4) 10 ; CHECK: movl %{{.*}}, 12(%rdi,[[R0]],4) 11 12 define void @test(i32* nocapture %array, i32 %r0) nounwind ssp noredzone { 13 bb.nph: 14 br label %bb 15 16 bb: ; preds = %bb, %bb.nph 17 %j.010 = phi i8 [ 0, %bb.nph ], [ %14, %bb ] ; <i8> [#uses=1] 18 %k.19 = phi i8 [ 0, %bb.nph ], [ %.k.1, %bb ] ; <i8> [#uses=1] 19 %i0.08 = phi i8 [ 0, %bb.nph ], [ %15, %bb ] ; <i8> [#uses=3] 20 %0 = icmp slt i8 %i0.08, 4 ; <i1> [#uses=1] 21 %iftmp.0.0 = select i1 %0, i8 %i0.08, i8 0 ; <i8> [#uses=2] 22 %1 = icmp eq i8 %i0.08, 4 ; <i1> [#uses=1] 23 %2 = zext i1 %1 to i8 ; <i8> [#uses=1] 24 %.k.1 = add i8 %2, %k.19 ; <i8> [#uses=2] 25 %3 = shl i8 %.k.1, 2 ; <i8> [#uses=1] 26 %4 = add i8 %3, %iftmp.0.0 ; <i8> [#uses=1] 27 %5 = shl i8 %4, 2 ; <i8> [#uses=1] 28 %6 = zext i8 %5 to i64 ; <i64> [#uses=4] 29 %7 = getelementptr inbounds i32* %array, i64 %6 ; <i32*> [#uses=1] 30 store i32 %r0, i32* %7, align 4 31 %8 = or i64 %6, 2 ; <i64> [#uses=1] 32 %9 = getelementptr inbounds i32* %array, i64 %8 ; <i32*> [#uses=1] 33 store i32 %r0, i32* %9, align 4 34 %10 = or i64 %6, 1 ; <i64> [#uses=1] 35 %11 = getelementptr inbounds i32* %array, i64 %10 ; <i32*> [#uses=1] 36 store i32 %r0, i32* %11, align 4 37 %12 = or i64 %6, 3 ; <i64> [#uses=1] 38 %13 = getelementptr inbounds i32* %array, i64 %12 ; <i32*> [#uses=1] 39 store i32 %r0, i32* %13, align 4 40 %14 = add nsw i8 %j.010, 1 ; <i8> [#uses=2] 41 %15 = add i8 %iftmp.0.0, 1 ; <i8> [#uses=1] 42 %exitcond = icmp eq i8 %14, 32 ; <i1> [#uses=1] 43 br i1 %exitcond, label %return, label %bb 44 45 return: ; preds = %bb 46 ret void 47 } 48 49 ; CHECK: test1: 50 ; CHECK: movl %{{.*}}, (%[[RDI:...]],%[[RCX:...]],4) 51 ; CHECK: movl %{{.*}}, 8(%[[RDI]],%[[RCX]],4) 52 ; CHECK: movl %{{.*}}, 4(%[[RDI]],%[[RCX]],4) 53 ; CHECK: movl %{{.*}}, 12(%[[RDI]],%[[RCX]],4) 54 55 define void @test1(i32* nocapture %array, i32 %r0, i8 signext %k, i8 signext %i0) nounwind { 56 bb.nph: 57 br label %for.body 58 59 for.body: ; preds = %for.body, %bb.nph 60 %j.065 = phi i8 [ 0, %bb.nph ], [ %inc52, %for.body ] ; <i8> [#uses=1] 61 %i0.addr.064 = phi i8 [ %i0, %bb.nph ], [ %add, %for.body ] ; <i8> [#uses=3] 62 %k.addr.163 = phi i8 [ %k, %bb.nph ], [ %inc.k.addr.1, %for.body ] ; <i8> [#uses=1] 63 %cmp5 = icmp slt i8 %i0.addr.064, 4 ; <i1> [#uses=1] 64 %cond = select i1 %cmp5, i8 %i0.addr.064, i8 0 ; <i8> [#uses=2] 65 %cmp12 = icmp eq i8 %i0.addr.064, 4 ; <i1> [#uses=1] 66 %inc = zext i1 %cmp12 to i8 ; <i8> [#uses=1] 67 %inc.k.addr.1 = add i8 %inc, %k.addr.163 ; <i8> [#uses=2] 68 %mul = shl i8 %cond, 2 ; <i8> [#uses=1] 69 %mul22 = shl i8 %inc.k.addr.1, 4 ; <i8> [#uses=1] 70 %add23 = add i8 %mul22, %mul ; <i8> [#uses=1] 71 %idxprom = zext i8 %add23 to i64 ; <i64> [#uses=4] 72 %arrayidx = getelementptr inbounds i32* %array, i64 %idxprom ; <i32*> [#uses=1] 73 store i32 %r0, i32* %arrayidx 74 %add3356 = or i64 %idxprom, 2 ; <i64> [#uses=1] 75 %arrayidx36 = getelementptr inbounds i32* %array, i64 %add3356 ; <i32*> [#uses=1] 76 store i32 %r0, i32* %arrayidx36 77 %add4058 = or i64 %idxprom, 1 ; <i64> [#uses=1] 78 %arrayidx43 = getelementptr inbounds i32* %array, i64 %add4058 ; <i32*> [#uses=1] 79 store i32 %r0, i32* %arrayidx43 80 %add4760 = or i64 %idxprom, 3 ; <i64> [#uses=1] 81 %arrayidx50 = getelementptr inbounds i32* %array, i64 %add4760 ; <i32*> [#uses=1] 82 store i32 %r0, i32* %arrayidx50 83 %inc52 = add nsw i8 %j.065, 1 ; <i8> [#uses=2] 84 %add = add i8 %cond, 1 ; <i8> [#uses=1] 85 %exitcond = icmp eq i8 %inc52, 32 ; <i1> [#uses=1] 86 br i1 %exitcond, label %for.end, label %for.body 87 88 for.end: ; preds = %for.body 89 ret void 90 } 91