342 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=arm64-apple-ios | FileCheck %s3;4; <rdar://problem/13820218>5 6define signext i16 @extendedLeftShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {7; CHECK-LABEL: extendedLeftShiftcharToshortBy4:8; CHECK: ; %bb.0: ; %entry9; CHECK-NEXT: add w8, w0, #110; CHECK-NEXT: sbfiz w0, w8, #4, #811; CHECK-NEXT: ret12entry:13 %inc = add i8 %a, 114 %conv1 = sext i8 %inc to i3215 %shl = shl nsw i32 %conv1, 416 %conv2 = trunc i32 %shl to i1617 ret i16 %conv218}19 20define signext i16 @extendedRightShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {21; CHECK-LABEL: extendedRightShiftcharToshortBy4:22; CHECK: ; %bb.0: ; %entry23; CHECK-NEXT: add w8, w0, #124; CHECK-NEXT: sbfx w0, w8, #4, #425; CHECK-NEXT: ret26entry:27 %inc = add i8 %a, 128 %conv1 = sext i8 %inc to i3229 %shr4 = lshr i32 %conv1, 430 %conv2 = trunc i32 %shr4 to i1631 ret i16 %conv232}33 34define signext i16 @extendedLeftShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {35; CHECK-LABEL: extendedLeftShiftcharToshortBy8:36; CHECK: ; %bb.0: ; %entry37; CHECK-NEXT: add w8, w0, #138; CHECK-NEXT: sbfiz w0, w8, #8, #839; CHECK-NEXT: ret40entry:41 %inc = add i8 %a, 142 %conv1 = sext i8 %inc to i3243 %shl = shl nsw i32 %conv1, 844 %conv2 = trunc i32 %shl to i1645 ret i16 %conv246}47 48define signext i16 @extendedRightShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {49; CHECK-LABEL: extendedRightShiftcharToshortBy8:50; CHECK: ; %bb.0: ; %entry51; CHECK-NEXT: add w8, w0, #152; CHECK-NEXT: sxtb w8, w853; CHECK-NEXT: asr w0, w8, #854; CHECK-NEXT: ret55entry:56 %inc = add i8 %a, 157 %conv1 = sext i8 %inc to i3258 %shr4 = lshr i32 %conv1, 859 %conv2 = trunc i32 %shr4 to i1660 ret i16 %conv261}62 63define i32 @extendedLeftShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {64; CHECK-LABEL: extendedLeftShiftcharTointBy4:65; CHECK: ; %bb.0: ; %entry66; CHECK-NEXT: add w8, w0, #167; CHECK-NEXT: sbfiz w0, w8, #4, #868; CHECK-NEXT: ret69entry:70 %inc = add i8 %a, 171 %conv = sext i8 %inc to i3272 %shl = shl nsw i32 %conv, 473 ret i32 %shl74}75 76define i32 @extendedRightShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {77; CHECK-LABEL: extendedRightShiftcharTointBy4:78; CHECK: ; %bb.0: ; %entry79; CHECK-NEXT: add w8, w0, #180; CHECK-NEXT: sbfx w0, w8, #4, #481; CHECK-NEXT: ret82entry:83 %inc = add i8 %a, 184 %conv = sext i8 %inc to i3285 %shr = ashr i32 %conv, 486 ret i32 %shr87}88 89define i32 @extendedLeftShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {90; CHECK-LABEL: extendedLeftShiftcharTointBy8:91; CHECK: ; %bb.0: ; %entry92; CHECK-NEXT: add w8, w0, #193; CHECK-NEXT: sbfiz w0, w8, #8, #894; CHECK-NEXT: ret95entry:96 %inc = add i8 %a, 197 %conv = sext i8 %inc to i3298 %shl = shl nsw i32 %conv, 899 ret i32 %shl100}101 102define i32 @extendedRightShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {103; CHECK-LABEL: extendedRightShiftcharTointBy8:104; CHECK: ; %bb.0: ; %entry105; CHECK-NEXT: add w8, w0, #1106; CHECK-NEXT: sxtb w8, w8107; CHECK-NEXT: asr w0, w8, #8108; CHECK-NEXT: ret109entry:110 %inc = add i8 %a, 1111 %conv = sext i8 %inc to i32112 %shr = ashr i32 %conv, 8113 ret i32 %shr114}115 116define i64 @extendedLeftShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {117; CHECK-LABEL: extendedLeftShiftcharToint64By4:118; CHECK: ; %bb.0: ; %entry119; CHECK-NEXT: add w8, w0, #1120; CHECK-NEXT: sbfiz x0, x8, #4, #8121; CHECK-NEXT: ret122entry:123 %inc = add i8 %a, 1124 %conv = sext i8 %inc to i64125 %shl = shl nsw i64 %conv, 4126 ret i64 %shl127}128 129define i64 @extendedRightShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {130; CHECK-LABEL: extendedRightShiftcharToint64By4:131; CHECK: ; %bb.0: ; %entry132; CHECK-NEXT: add w8, w0, #1133; CHECK-NEXT: sbfx x0, x8, #4, #4134; CHECK-NEXT: ret135entry:136 %inc = add i8 %a, 1137 %conv = sext i8 %inc to i64138 %shr = ashr i64 %conv, 4139 ret i64 %shr140}141 142define i64 @extendedLeftShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {143; CHECK-LABEL: extendedLeftShiftcharToint64By8:144; CHECK: ; %bb.0: ; %entry145; CHECK-NEXT: add w8, w0, #1146; CHECK-NEXT: sbfiz x0, x8, #8, #8147; CHECK-NEXT: ret148entry:149 %inc = add i8 %a, 1150 %conv = sext i8 %inc to i64151 %shl = shl nsw i64 %conv, 8152 ret i64 %shl153}154 155define i64 @extendedRightShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {156; CHECK-LABEL: extendedRightShiftcharToint64By8:157; CHECK: ; %bb.0: ; %entry158; CHECK-NEXT: add w8, w0, #1159; CHECK-NEXT: sxtb x8, w8160; CHECK-NEXT: asr x0, x8, #8161; CHECK-NEXT: ret162entry:163 %inc = add i8 %a, 1164 %conv = sext i8 %inc to i64165 %shr = ashr i64 %conv, 8166 ret i64 %shr167}168 169define i32 @extendedLeftShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {170; CHECK-LABEL: extendedLeftShiftshortTointBy4:171; CHECK: ; %bb.0: ; %entry172; CHECK-NEXT: add w8, w0, #1173; CHECK-NEXT: sbfiz w0, w8, #4, #16174; CHECK-NEXT: ret175entry:176 %inc = add i16 %a, 1177 %conv = sext i16 %inc to i32178 %shl = shl nsw i32 %conv, 4179 ret i32 %shl180}181 182define i32 @extendedRightShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {183; CHECK-LABEL: extendedRightShiftshortTointBy4:184; CHECK: ; %bb.0: ; %entry185; CHECK-NEXT: add w8, w0, #1186; CHECK-NEXT: sbfx w0, w8, #4, #12187; CHECK-NEXT: ret188entry:189 %inc = add i16 %a, 1190 %conv = sext i16 %inc to i32191 %shr = ashr i32 %conv, 4192 ret i32 %shr193}194 195define i32 @extendedLeftShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {196; CHECK-LABEL: extendedLeftShiftshortTointBy16:197; CHECK: ; %bb.0: ; %entry198; CHECK-NEXT: lsl w8, w0, #16199; CHECK-NEXT: add w0, w8, #16, lsl #12 ; =65536200; CHECK-NEXT: ret201entry:202 %inc = add i16 %a, 1203 %conv2 = zext i16 %inc to i32204 %shl = shl nuw i32 %conv2, 16205 ret i32 %shl206}207 208define i32 @extendedRightShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {209; CHECK-LABEL: extendedRightShiftshortTointBy16:210; CHECK: ; %bb.0: ; %entry211; CHECK-NEXT: add w8, w0, #1212; CHECK-NEXT: sxth w8, w8213; CHECK-NEXT: asr w0, w8, #16214; CHECK-NEXT: ret215entry:216 %inc = add i16 %a, 1217 %conv = sext i16 %inc to i32218 %shr = ashr i32 %conv, 16219 ret i32 %shr220}221 222define i64 @extendedLeftShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {223; CHECK-LABEL: extendedLeftShiftshortToint64By4:224; CHECK: ; %bb.0: ; %entry225; CHECK-NEXT: add w8, w0, #1226; CHECK-NEXT: sbfiz x0, x8, #4, #16227; CHECK-NEXT: ret228entry:229 %inc = add i16 %a, 1230 %conv = sext i16 %inc to i64231 %shl = shl nsw i64 %conv, 4232 ret i64 %shl233}234 235define i64 @extendedRightShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {236; CHECK-LABEL: extendedRightShiftshortToint64By4:237; CHECK: ; %bb.0: ; %entry238; CHECK-NEXT: add w8, w0, #1239; CHECK-NEXT: sbfx x0, x8, #4, #12240; CHECK-NEXT: ret241entry:242 %inc = add i16 %a, 1243 %conv = sext i16 %inc to i64244 %shr = ashr i64 %conv, 4245 ret i64 %shr246}247 248define i64 @extendedLeftShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {249; CHECK-LABEL: extendedLeftShiftshortToint64By16:250; CHECK: ; %bb.0: ; %entry251; CHECK-NEXT: add w8, w0, #1252; CHECK-NEXT: sbfiz x0, x8, #16, #16253; CHECK-NEXT: ret254entry:255 %inc = add i16 %a, 1256 %conv = sext i16 %inc to i64257 %shl = shl nsw i64 %conv, 16258 ret i64 %shl259}260 261define i64 @extendedRightShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {262; CHECK-LABEL: extendedRightShiftshortToint64By16:263; CHECK: ; %bb.0: ; %entry264; CHECK-NEXT: add w8, w0, #1265; CHECK-NEXT: sxth x8, w8266; CHECK-NEXT: asr x0, x8, #16267; CHECK-NEXT: ret268entry:269 %inc = add i16 %a, 1270 %conv = sext i16 %inc to i64271 %shr = ashr i64 %conv, 16272 ret i64 %shr273}274 275define i64 @extendedLeftShiftintToint64By4(i32 %a) nounwind readnone ssp {276; CHECK-LABEL: extendedLeftShiftintToint64By4:277; CHECK: ; %bb.0: ; %entry278; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0279; CHECK-NEXT: sbfiz x8, x0, #4, #32280; CHECK-NEXT: add x0, x8, #16281; CHECK-NEXT: ret282entry:283 %inc = add nsw i32 %a, 1284 %conv = sext i32 %inc to i64285 %shl = shl nsw i64 %conv, 4286 ret i64 %shl287}288 289define i64 @extendedRightShiftintToint64By4(i32 %a) nounwind readnone ssp {290; CHECK-LABEL: extendedRightShiftintToint64By4:291; CHECK: ; %bb.0: ; %entry292; CHECK-NEXT: add w8, w0, #1293; CHECK-NEXT: sbfx x0, x8, #4, #28294; CHECK-NEXT: ret295entry:296 %inc = add nsw i32 %a, 1297 %conv = sext i32 %inc to i64298 %shr = ashr i64 %conv, 4299 ret i64 %shr300}301 302define i64 @extendedLeftShiftintToint64By32(i32 %a) nounwind readnone ssp {303; CHECK-LABEL: extendedLeftShiftintToint64By32:304; CHECK: ; %bb.0: ; %entry305; CHECK-NEXT: add w8, w0, #1306; CHECK-NEXT: lsl x0, x8, #32307; CHECK-NEXT: ret308entry:309 %inc = add nsw i32 %a, 1310 %conv2 = zext i32 %inc to i64311 %shl = shl nuw i64 %conv2, 32312 ret i64 %shl313}314 315define i64 @extendedRightShiftintToint64By32(i32 %a) nounwind readnone ssp {316; CHECK-LABEL: extendedRightShiftintToint64By32:317; CHECK: ; %bb.0: ; %entry318; CHECK-NEXT: add w8, w0, #1319; CHECK-NEXT: sxtw x8, w8320; CHECK-NEXT: asr x0, x8, #32321; CHECK-NEXT: ret322entry:323 %inc = add nsw i32 %a, 1324 %conv = sext i32 %inc to i64325 %shr = ashr i64 %conv, 32326 ret i64 %shr327}328 329define i64 @sign_extend_inreg_isdef32(i64) {330; CHECK-LABEL: sign_extend_inreg_isdef32:331; CHECK: ; %bb.0:332; CHECK-NEXT: sbfx x8, x0, #32, #16333; CHECK-NEXT: mov w0, w8334; CHECK-NEXT: ret335 %2 = lshr i64 %0, 32336 %3 = shl i64 %2, 16337 %4 = trunc i64 %3 to i32338 %5 = ashr exact i32 %4, 16339 %6 = zext i32 %5 to i64340 ret i64 %6341}342