1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=arm64-apple-ios | FileCheck %s
;
; <rdar://problem/13820218>
define signext i16 @extendedLeftShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharToshortBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz w0, w8, #4, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv1 = sext i8 %inc to i32
%shl = shl nsw i32 %conv1, 4
%conv2 = trunc i32 %shl to i16
ret i16 %conv2
}
define signext i16 @extendedRightShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharToshortBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx w0, w8, #4, #4
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv1 = sext i8 %inc to i32
%shr4 = lshr i32 %conv1, 4
%conv2 = trunc i32 %shr4 to i16
ret i16 %conv2
}
define signext i16 @extendedLeftShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharToshortBy8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz w0, w8, #8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv1 = sext i8 %inc to i32
%shl = shl nsw i32 %conv1, 8
%conv2 = trunc i32 %shl to i16
ret i16 %conv2
}
define signext i16 @extendedRightShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharToshortBy8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxtb w8, w8
; CHECK-NEXT: asr w0, w8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv1 = sext i8 %inc to i32
%shr4 = lshr i32 %conv1, 8
%conv2 = trunc i32 %shr4 to i16
ret i16 %conv2
}
define i32 @extendedLeftShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharTointBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz w0, w8, #4, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i32
%shl = shl nsw i32 %conv, 4
ret i32 %shl
}
define i32 @extendedRightShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharTointBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx w0, w8, #4, #4
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i32
%shr = ashr i32 %conv, 4
ret i32 %shr
}
define i32 @extendedLeftShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharTointBy8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz w0, w8, #8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i32
%shl = shl nsw i32 %conv, 8
ret i32 %shl
}
define i32 @extendedRightShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharTointBy8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxtb w8, w8
; CHECK-NEXT: asr w0, w8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i32
%shr = ashr i32 %conv, 8
ret i32 %shr
}
define i64 @extendedLeftShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz x0, x8, #4, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i64
%shl = shl nsw i64 %conv, 4
ret i64 %shl
}
define i64 @extendedRightShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx x0, x8, #4, #4
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i64
%shr = ashr i64 %conv, 4
ret i64 %shr
}
define i64 @extendedLeftShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftcharToint64By8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz x0, x8, #8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i64
%shl = shl nsw i64 %conv, 8
ret i64 %shl
}
define i64 @extendedRightShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftcharToint64By8:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxtb x8, w8
; CHECK-NEXT: asr x0, x8, #8
; CHECK-NEXT: ret
entry:
%inc = add i8 %a, 1
%conv = sext i8 %inc to i64
%shr = ashr i64 %conv, 8
ret i64 %shr
}
define i32 @extendedLeftShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftshortTointBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz w0, w8, #4, #16
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i32
%shl = shl nsw i32 %conv, 4
ret i32 %shl
}
define i32 @extendedRightShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftshortTointBy4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx w0, w8, #4, #12
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i32
%shr = ashr i32 %conv, 4
ret i32 %shr
}
define i32 @extendedLeftShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftshortTointBy16:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: lsl w8, w0, #16
; CHECK-NEXT: add w0, w8, #16, lsl #12 ; =65536
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv2 = zext i16 %inc to i32
%shl = shl nuw i32 %conv2, 16
ret i32 %shl
}
define i32 @extendedRightShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftshortTointBy16:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxth w8, w8
; CHECK-NEXT: asr w0, w8, #16
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i32
%shr = ashr i32 %conv, 16
ret i32 %shr
}
define i64 @extendedLeftShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftshortToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz x0, x8, #4, #16
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i64
%shl = shl nsw i64 %conv, 4
ret i64 %shl
}
define i64 @extendedRightShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftshortToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx x0, x8, #4, #12
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i64
%shr = ashr i64 %conv, 4
ret i64 %shr
}
define i64 @extendedLeftShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftshortToint64By16:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz x0, x8, #16, #16
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i64
%shl = shl nsw i64 %conv, 16
ret i64 %shl
}
define i64 @extendedRightShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftshortToint64By16:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxth x8, w8
; CHECK-NEXT: asr x0, x8, #16
; CHECK-NEXT: ret
entry:
%inc = add i16 %a, 1
%conv = sext i16 %inc to i64
%shr = ashr i64 %conv, 16
ret i64 %shr
}
define i64 @extendedLeftShiftintToint64By4(i32 %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftintToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfiz x0, x8, #4, #32
; CHECK-NEXT: ret
entry:
%inc = add nsw i32 %a, 1
%conv = sext i32 %inc to i64
%shl = shl nsw i64 %conv, 4
ret i64 %shl
}
define i64 @extendedRightShiftintToint64By4(i32 %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftintToint64By4:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sbfx x0, x8, #4, #28
; CHECK-NEXT: ret
entry:
%inc = add nsw i32 %a, 1
%conv = sext i32 %inc to i64
%shr = ashr i64 %conv, 4
ret i64 %shr
}
define i64 @extendedLeftShiftintToint64By32(i32 %a) nounwind readnone ssp {
; CHECK-LABEL: extendedLeftShiftintToint64By32:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: lsl x0, x8, #32
; CHECK-NEXT: ret
entry:
%inc = add nsw i32 %a, 1
%conv2 = zext i32 %inc to i64
%shl = shl nuw i64 %conv2, 32
ret i64 %shl
}
define i64 @extendedRightShiftintToint64By32(i32 %a) nounwind readnone ssp {
; CHECK-LABEL: extendedRightShiftintToint64By32:
; CHECK: ; %bb.0: ; %entry
; CHECK-NEXT: add w8, w0, #1
; CHECK-NEXT: sxtw x8, w8
; CHECK-NEXT: asr x0, x8, #32
; CHECK-NEXT: ret
entry:
%inc = add nsw i32 %a, 1
%conv = sext i32 %inc to i64
%shr = ashr i64 %conv, 32
ret i64 %shr
}
define i64 @sign_extend_inreg_isdef32(i64) {
; CHECK-LABEL: sign_extend_inreg_isdef32:
; CHECK: ; %bb.0:
; CHECK-NEXT: sbfx x8, x0, #32, #16
; CHECK-NEXT: mov w0, w8
; CHECK-NEXT: ret
%2 = lshr i64 %0, 32
%3 = shl i64 %2, 16
%4 = trunc i64 %3 to i32
%5 = ashr exact i32 %4, 16
%6 = zext i32 %5 to i64
ret i64 %6
}
|