1; RUN: llc < %s -mtriple aarch64--none-eabi -verify-machineinstrs | FileCheck %s 2; RUN: llc < %s -mtriple aarch64--none-eabi -mattr=+strict-align -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-STRICT 3 4; CHECK-LABEL: Strh_zero 5; CHECK: str wzr 6; CHECK-STRICT-LABEL: Strh_zero 7; CHECK-STRICT: strh wzr 8; CHECK-STRICT: strh wzr 9define void @Strh_zero(i16* nocapture %P, i32 %n) { 10entry: 11 %idxprom = sext i32 %n to i64 12 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom 13 store i16 0, i16* %arrayidx 14 %add = add nsw i32 %n, 1 15 %idxprom1 = sext i32 %add to i64 16 %arrayidx2 = getelementptr inbounds i16, i16* %P, i64 %idxprom1 17 store i16 0, i16* %arrayidx2 18 ret void 19} 20 21; CHECK-LABEL: Strh_zero_4 22; CHECK: str xzr 23; CHECK-STRICT-LABEL: Strh_zero_4 24; CHECK-STRICT: strh wzr 25; CHECK-STRICT: strh wzr 26; CHECK-STRICT: strh wzr 27; CHECK-STRICT: strh wzr 28define void @Strh_zero_4(i16* nocapture %P, i32 %n) { 29entry: 30 %idxprom = sext i32 %n to i64 31 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom 32 store i16 0, i16* %arrayidx 33 %add = add nsw i32 %n, 1 34 %idxprom1 = sext i32 %add to i64 35 %arrayidx2 = getelementptr inbounds i16, i16* %P, i64 %idxprom1 36 store i16 0, i16* %arrayidx2 37 %add3 = add nsw i32 %n, 2 38 %idxprom4 = sext i32 %add3 to i64 39 %arrayidx5 = getelementptr inbounds i16, i16* %P, i64 %idxprom4 40 store i16 0, i16* %arrayidx5 41 %add6 = add nsw i32 %n, 3 42 %idxprom7 = sext i32 %add6 to i64 43 %arrayidx8 = getelementptr inbounds i16, i16* %P, i64 %idxprom7 44 store i16 0, i16* %arrayidx8 45 ret void 46} 47 48; CHECK-LABEL: Strw_zero 49; CHECK: str xzr 50; CHECK-STRICT-LABEL: Strw_zero 51; CHECK-STRICT: stp wzr, wzr 52define void @Strw_zero(i32* nocapture %P, i32 %n) { 53entry: 54 %idxprom = sext i32 %n to i64 55 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom 56 store i32 0, i32* %arrayidx 57 %add = add nsw i32 %n, 1 58 %idxprom1 = sext i32 %add to i64 59 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1 60 store i32 0, i32* %arrayidx2 61 ret void 62} 63 64; CHECK-LABEL: Strw_zero_nonzero 65; CHECK: stp wzr, w1 66define void @Strw_zero_nonzero(i32* nocapture %P, i32 %n) { 67entry: 68 %idxprom = sext i32 %n to i64 69 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom 70 store i32 0, i32* %arrayidx 71 %add = add nsw i32 %n, 1 72 %idxprom1 = sext i32 %add to i64 73 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1 74 store i32 %n, i32* %arrayidx2 75 ret void 76} 77 78; CHECK-LABEL: Strw_zero_4 79; CHECK: stp xzr, xzr 80; CHECK-STRICT-LABEL: Strw_zero_4 81; CHECK-STRICT: stp wzr, wzr 82; CHECK-STRICT: stp wzr, wzr 83define void @Strw_zero_4(i32* nocapture %P, i32 %n) { 84entry: 85 %idxprom = sext i32 %n to i64 86 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom 87 store i32 0, i32* %arrayidx 88 %add = add nsw i32 %n, 1 89 %idxprom1 = sext i32 %add to i64 90 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1 91 store i32 0, i32* %arrayidx2 92 %add3 = add nsw i32 %n, 2 93 %idxprom4 = sext i32 %add3 to i64 94 %arrayidx5 = getelementptr inbounds i32, i32* %P, i64 %idxprom4 95 store i32 0, i32* %arrayidx5 96 %add6 = add nsw i32 %n, 3 97 %idxprom7 = sext i32 %add6 to i64 98 %arrayidx8 = getelementptr inbounds i32, i32* %P, i64 %idxprom7 99 store i32 0, i32* %arrayidx8 100 ret void 101} 102 103; CHECK-LABEL: Sturb_zero 104; CHECK: sturh wzr 105; CHECK-STRICT-LABEL: Sturb_zero 106; CHECK-STRICT: sturb wzr 107; CHECK-STRICT: sturb wzr 108define void @Sturb_zero(i8* nocapture %P, i32 %n) #0 { 109entry: 110 %sub = add nsw i32 %n, -2 111 %idxprom = sext i32 %sub to i64 112 %arrayidx = getelementptr inbounds i8, i8* %P, i64 %idxprom 113 store i8 0, i8* %arrayidx 114 %sub2= add nsw i32 %n, -1 115 %idxprom1 = sext i32 %sub2 to i64 116 %arrayidx2 = getelementptr inbounds i8, i8* %P, i64 %idxprom1 117 store i8 0, i8* %arrayidx2 118 ret void 119} 120 121; CHECK-LABEL: Sturh_zero 122; CHECK: stur wzr 123; CHECK-STRICT-LABEL: Sturh_zero 124; CHECK-STRICT: sturh wzr 125; CHECK-STRICT: sturh wzr 126define void @Sturh_zero(i16* nocapture %P, i32 %n) { 127entry: 128 %sub = add nsw i32 %n, -2 129 %idxprom = sext i32 %sub to i64 130 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom 131 store i16 0, i16* %arrayidx 132 %sub1 = add nsw i32 %n, -3 133 %idxprom2 = sext i32 %sub1 to i64 134 %arrayidx3 = getelementptr inbounds i16, i16* %P, i64 %idxprom2 135 store i16 0, i16* %arrayidx3 136 ret void 137} 138 139; CHECK-LABEL: Sturh_zero_4 140; CHECK: stur xzr 141; CHECK-STRICT-LABEL: Sturh_zero_4 142; CHECK-STRICT: sturh wzr 143; CHECK-STRICT: sturh wzr 144; CHECK-STRICT: sturh wzr 145; CHECK-STRICT: sturh wzr 146define void @Sturh_zero_4(i16* nocapture %P, i32 %n) { 147entry: 148 %sub = add nsw i32 %n, -3 149 %idxprom = sext i32 %sub to i64 150 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom 151 store i16 0, i16* %arrayidx 152 %sub1 = add nsw i32 %n, -4 153 %idxprom2 = sext i32 %sub1 to i64 154 %arrayidx3 = getelementptr inbounds i16, i16* %P, i64 %idxprom2 155 store i16 0, i16* %arrayidx3 156 %sub4 = add nsw i32 %n, -2 157 %idxprom5 = sext i32 %sub4 to i64 158 %arrayidx6 = getelementptr inbounds i16, i16* %P, i64 %idxprom5 159 store i16 0, i16* %arrayidx6 160 %sub7 = add nsw i32 %n, -1 161 %idxprom8 = sext i32 %sub7 to i64 162 %arrayidx9 = getelementptr inbounds i16, i16* %P, i64 %idxprom8 163 store i16 0, i16* %arrayidx9 164 ret void 165} 166 167; CHECK-LABEL: Sturw_zero 168; CHECK: stur xzr 169; CHECK-STRICT-LABEL: Sturw_zero 170; CHECK-STRICT: stp wzr, wzr 171define void @Sturw_zero(i32* nocapture %P, i32 %n) { 172entry: 173 %sub = add nsw i32 %n, -3 174 %idxprom = sext i32 %sub to i64 175 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom 176 store i32 0, i32* %arrayidx 177 %sub1 = add nsw i32 %n, -4 178 %idxprom2 = sext i32 %sub1 to i64 179 %arrayidx3 = getelementptr inbounds i32, i32* %P, i64 %idxprom2 180 store i32 0, i32* %arrayidx3 181 ret void 182} 183 184; CHECK-LABEL: Sturw_zero_4 185; CHECK: stp xzr, xzr 186; CHECK-STRICT-LABEL: Sturw_zero_4 187; CHECK-STRICT: stp wzr, wzr 188; CHECK-STRICT: stp wzr, wzr 189define void @Sturw_zero_4(i32* nocapture %P, i32 %n) { 190entry: 191 %sub = add nsw i32 %n, -3 192 %idxprom = sext i32 %sub to i64 193 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom 194 store i32 0, i32* %arrayidx 195 %sub1 = add nsw i32 %n, -4 196 %idxprom2 = sext i32 %sub1 to i64 197 %arrayidx3 = getelementptr inbounds i32, i32* %P, i64 %idxprom2 198 store i32 0, i32* %arrayidx3 199 %sub4 = add nsw i32 %n, -2 200 %idxprom5 = sext i32 %sub4 to i64 201 %arrayidx6 = getelementptr inbounds i32, i32* %P, i64 %idxprom5 202 store i32 0, i32* %arrayidx6 203 %sub7 = add nsw i32 %n, -1 204 %idxprom8 = sext i32 %sub7 to i64 205 %arrayidx9 = getelementptr inbounds i32, i32* %P, i64 %idxprom8 206 store i32 0, i32* %arrayidx9 207 ret void 208} 209 210