1*0a6a1f1dSLionel Sambuc; RUN: llc -mtriple=thumb-eabi -mattr=+v7,+thumb2 %s -o - | FileCheck %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambucdefine i8 @f1(i8* %call1, i8* %call3, i32 %h, i32 %w, i32 %Width) { 4f4a2713aSLionel Sambuc; CHECK: f1: 5f4a2713aSLionel Sambucentry: 6f4a2713aSLionel Sambuc %mul17 = mul nsw i32 %Width, %h 7f4a2713aSLionel Sambuc %add = add nsw i32 %mul17, %w 8f4a2713aSLionel Sambuc %sub19 = sub i32 %add, %Width 9f4a2713aSLionel Sambuc %sub20 = add i32 %sub19, -1 10f4a2713aSLionel Sambuc %arrayidx21 = getelementptr inbounds i8* %call1, i32 %sub20 11f4a2713aSLionel Sambuc %0 = load i8* %arrayidx21, align 1 12f4a2713aSLionel Sambuc %conv22 = zext i8 %0 to i32 13f4a2713aSLionel Sambuc %arrayidx25 = getelementptr inbounds i8* %call1, i32 %sub19 14f4a2713aSLionel Sambuc %1 = load i8* %arrayidx25, align 1 15f4a2713aSLionel Sambuc %conv26 = zext i8 %1 to i32 16f4a2713aSLionel Sambuc %mul23189 = add i32 %conv26, %conv22 17f4a2713aSLionel Sambuc %add30 = add i32 %sub19, 1 18f4a2713aSLionel Sambuc %arrayidx31 = getelementptr inbounds i8* %call1, i32 %add30 19f4a2713aSLionel Sambuc %2 = load i8* %arrayidx31, align 1 20f4a2713aSLionel Sambuc %conv32 = zext i8 %2 to i32 21f4a2713aSLionel Sambuc; CHECK: ldrb r{{[0-9]*}}, [r{{[0-9]*}}, #-1] 22f4a2713aSLionel Sambuc; CHECK-NEXT: ldrb r{{[0-9]*}}, [r{{[0-9]*}}, #1] 23f4a2713aSLionel Sambuc %add28190 = add i32 %mul23189, %conv32 24f4a2713aSLionel Sambuc %sub35 = add i32 %add, -1 25f4a2713aSLionel Sambuc %arrayidx36 = getelementptr inbounds i8* %call1, i32 %sub35 26f4a2713aSLionel Sambuc %3 = load i8* %arrayidx36, align 1 27f4a2713aSLionel Sambuc %conv37 = zext i8 %3 to i32 28f4a2713aSLionel Sambuc %add34191 = add i32 %add28190, %conv37 29f4a2713aSLionel Sambuc %arrayidx40 = getelementptr inbounds i8* %call1, i32 %add 30f4a2713aSLionel Sambuc %4 = load i8* %arrayidx40, align 1 31f4a2713aSLionel Sambuc %conv41 = zext i8 %4 to i32 32f4a2713aSLionel Sambuc %mul42 = mul nsw i32 %conv41, 255 33f4a2713aSLionel Sambuc %add44 = add i32 %add, 1 34f4a2713aSLionel Sambuc %arrayidx45 = getelementptr inbounds i8* %call1, i32 %add44 35f4a2713aSLionel Sambuc %5 = load i8* %arrayidx45, align 1 36f4a2713aSLionel Sambuc %conv46 = zext i8 %5 to i32 37f4a2713aSLionel Sambuc; CHECK: ldrb r{{[0-9]*}}, [r{{[0-9]*}}, #-1] 38f4a2713aSLionel Sambuc; CHECK-NEXT: ldrb r{{[0-9]*}}, [r{{[0-9]*}}, #1] 39f4a2713aSLionel Sambuc %add49 = add i32 %add, %Width 40f4a2713aSLionel Sambuc %sub50 = add i32 %add49, -1 41f4a2713aSLionel Sambuc %arrayidx51 = getelementptr inbounds i8* %call1, i32 %sub50 42f4a2713aSLionel Sambuc %6 = load i8* %arrayidx51, align 1 43f4a2713aSLionel Sambuc %conv52 = zext i8 %6 to i32 44f4a2713aSLionel Sambuc %arrayidx56 = getelementptr inbounds i8* %call1, i32 %add49 45f4a2713aSLionel Sambuc %7 = load i8* %arrayidx56, align 1 46f4a2713aSLionel Sambuc %conv57 = zext i8 %7 to i32 47f4a2713aSLionel Sambuc %add61 = add i32 %add49, 1 48f4a2713aSLionel Sambuc %arrayidx62 = getelementptr inbounds i8* %call1, i32 %add61 49f4a2713aSLionel Sambuc %8 = load i8* %arrayidx62, align 1 50f4a2713aSLionel Sambuc %conv63 = zext i8 %8 to i32 51f4a2713aSLionel Sambuc; CHECK: ldrb r{{[0-9]*}}, [r{{[0-9]*}}, #-1] 52f4a2713aSLionel Sambuc; CHECK-NEXT: ldrb{{[.w]*}} r{{[0-9]*}}, [r{{[0-9]*}}, #1] 53f4a2713aSLionel Sambuc %tmp = add i32 %add34191, %conv46 54f4a2713aSLionel Sambuc %tmp193 = add i32 %tmp, %conv52 55f4a2713aSLionel Sambuc %tmp194 = add i32 %tmp193, %conv57 56f4a2713aSLionel Sambuc %tmp195 = add i32 %tmp194, %conv63 57f4a2713aSLionel Sambuc %tmp196 = mul i32 %tmp195, -28 58f4a2713aSLionel Sambuc %add65 = add i32 %tmp196, %mul42 59f4a2713aSLionel Sambuc %9 = lshr i32 %add65, 8 60f4a2713aSLionel Sambuc %conv68 = trunc i32 %9 to i8 61f4a2713aSLionel Sambuc %arrayidx69 = getelementptr inbounds i8* %call3, i32 %add 62f4a2713aSLionel Sambuc store i8 %conv68, i8* %arrayidx69, align 1 63f4a2713aSLionel Sambuc ret i8 %conv68 64f4a2713aSLionel Sambuc} 65