sub-of-not.ll 16.8 KB
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 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=armv6 < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM6
; RUN: llc -mtriple=armv7 < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM78,ARM7
; RUN: llc -mtriple=armv8a < %s | FileCheck %s --check-prefixes=CHECK,ARM,ARM78,ARM8
; RUN: llc -mtriple=thumbv6 < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB6
; RUN: llc -mtriple=thumbv7 < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB78,THUMB7
; RUN: llc -mtriple=thumbv8-eabi < %s | FileCheck %s --check-prefixes=CHECK,THUMB,THUMB78,THUMB8

; These two forms are equivalent:
;   sub %y, (xor %x, -1)
;   add (add %x, 1), %y
; Some targets may prefer one to the other.

define i8 @scalar_i8(i8 %x, i8 %y) nounwind {
; ARM-LABEL: scalar_i8:
; ARM:       @ %bb.0:
; ARM-NEXT:    add r0, r1, r0
; ARM-NEXT:    add r0, r0, #1
; ARM-NEXT:    bx lr
;
; THUMB6-LABEL: scalar_i8:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    adds r0, r1, r0
; THUMB6-NEXT:    adds r0, r0, #1
; THUMB6-NEXT:    bx lr
;
; THUMB78-LABEL: scalar_i8:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    add r0, r1
; THUMB78-NEXT:    adds r0, #1
; THUMB78-NEXT:    bx lr
  %t0 = xor i8 %x, -1
  %t1 = sub i8 %y, %t0
  ret i8 %t1
}

define i16 @scalar_i16(i16 %x, i16 %y) nounwind {
; ARM-LABEL: scalar_i16:
; ARM:       @ %bb.0:
; ARM-NEXT:    add r0, r1, r0
; ARM-NEXT:    add r0, r0, #1
; ARM-NEXT:    bx lr
;
; THUMB6-LABEL: scalar_i16:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    adds r0, r1, r0
; THUMB6-NEXT:    adds r0, r0, #1
; THUMB6-NEXT:    bx lr
;
; THUMB78-LABEL: scalar_i16:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    add r0, r1
; THUMB78-NEXT:    adds r0, #1
; THUMB78-NEXT:    bx lr
  %t0 = xor i16 %x, -1
  %t1 = sub i16 %y, %t0
  ret i16 %t1
}

define i32 @scalar_i32(i32 %x, i32 %y) nounwind {
; ARM-LABEL: scalar_i32:
; ARM:       @ %bb.0:
; ARM-NEXT:    add r0, r1, r0
; ARM-NEXT:    add r0, r0, #1
; ARM-NEXT:    bx lr
;
; THUMB6-LABEL: scalar_i32:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    adds r0, r1, r0
; THUMB6-NEXT:    adds r0, r0, #1
; THUMB6-NEXT:    bx lr
;
; THUMB78-LABEL: scalar_i32:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    add r0, r1
; THUMB78-NEXT:    adds r0, #1
; THUMB78-NEXT:    bx lr
  %t0 = xor i32 %x, -1
  %t1 = sub i32 %y, %t0
  ret i32 %t1
}

define i64 @scalar_i64(i64 %x, i64 %y) nounwind {
; ARM-LABEL: scalar_i64:
; ARM:       @ %bb.0:
; ARM-NEXT:    adds r0, r2, r0
; ARM-NEXT:    adc r1, r3, r1
; ARM-NEXT:    adds r0, r0, #1
; ARM-NEXT:    adc r1, r1, #0
; ARM-NEXT:    bx lr
;
; THUMB6-LABEL: scalar_i64:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    mvns r1, r1
; THUMB6-NEXT:    mvns r0, r0
; THUMB6-NEXT:    subs r0, r2, r0
; THUMB6-NEXT:    sbcs r3, r1
; THUMB6-NEXT:    mov r1, r3
; THUMB6-NEXT:    bx lr
;
; THUMB78-LABEL: scalar_i64:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    adds r0, r0, r2
; THUMB78-NEXT:    adcs r1, r3
; THUMB78-NEXT:    adds r0, #1
; THUMB78-NEXT:    adc r1, r1, #0
; THUMB78-NEXT:    bx lr
  %t0 = xor i64 %x, -1
  %t1 = sub i64 %y, %t0
  ret i64 %t1
}

define <16 x i8> @vector_i128_i8(<16 x i8> %x, <16 x i8> %y) nounwind {
; ARM6-LABEL: vector_i128_i8:
; ARM6:       @ %bb.0:
; ARM6-NEXT:    ldrb r12, [sp, #52]
; ARM6-NEXT:    ldrb r1, [sp, #116]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #48]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #15]
; ARM6-NEXT:    ldrb r1, [sp, #112]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #44]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #14]
; ARM6-NEXT:    ldrb r1, [sp, #108]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #40]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #13]
; ARM6-NEXT:    ldrb r1, [sp, #104]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #36]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #12]
; ARM6-NEXT:    ldrb r1, [sp, #100]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #32]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #11]
; ARM6-NEXT:    ldrb r1, [sp, #96]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #28]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #10]
; ARM6-NEXT:    ldrb r1, [sp, #92]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #24]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #9]
; ARM6-NEXT:    ldrb r1, [sp, #88]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #20]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #8]
; ARM6-NEXT:    ldrb r1, [sp, #84]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #16]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #7]
; ARM6-NEXT:    ldrb r1, [sp, #80]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #12]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #6]
; ARM6-NEXT:    ldrb r1, [sp, #76]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #8]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #5]
; ARM6-NEXT:    ldrb r1, [sp, #72]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp, #4]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #4]
; ARM6-NEXT:    ldrb r1, [sp, #68]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrb r12, [sp]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #3]
; ARM6-NEXT:    ldrb r1, [sp, #64]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #2]
; ARM6-NEXT:    ldrb r1, [sp, #60]
; ARM6-NEXT:    add r1, r1, r3
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0, #1]
; ARM6-NEXT:    ldrb r1, [sp, #56]
; ARM6-NEXT:    add r1, r1, r2
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strb r1, [r0]
; ARM6-NEXT:    bx lr
;
; ARM78-LABEL: vector_i128_i8:
; ARM78:       @ %bb.0:
; ARM78-NEXT:    vmov d17, r2, r3
; ARM78-NEXT:    vmov d16, r0, r1
; ARM78-NEXT:    mov r0, sp
; ARM78-NEXT:    vmvn q8, q8
; ARM78-NEXT:    vld1.64 {d18, d19}, [r0]
; ARM78-NEXT:    vsub.i8 q8, q9, q8
; ARM78-NEXT:    vmov r0, r1, d16
; ARM78-NEXT:    vmov r2, r3, d17
; ARM78-NEXT:    bx lr
;
; THUMB6-LABEL: vector_i128_i8:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    push {r4, lr}
; THUMB6-NEXT:    ldr r1, [sp, #60]
; THUMB6-NEXT:    ldr r4, [sp, #124]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #15]
; THUMB6-NEXT:    ldr r1, [sp, #56]
; THUMB6-NEXT:    ldr r4, [sp, #120]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #14]
; THUMB6-NEXT:    ldr r1, [sp, #52]
; THUMB6-NEXT:    ldr r4, [sp, #116]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #13]
; THUMB6-NEXT:    ldr r1, [sp, #48]
; THUMB6-NEXT:    ldr r4, [sp, #112]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #12]
; THUMB6-NEXT:    ldr r1, [sp, #44]
; THUMB6-NEXT:    ldr r4, [sp, #108]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #11]
; THUMB6-NEXT:    ldr r1, [sp, #40]
; THUMB6-NEXT:    ldr r4, [sp, #104]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #10]
; THUMB6-NEXT:    ldr r1, [sp, #36]
; THUMB6-NEXT:    ldr r4, [sp, #100]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #9]
; THUMB6-NEXT:    ldr r1, [sp, #32]
; THUMB6-NEXT:    ldr r4, [sp, #96]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #8]
; THUMB6-NEXT:    ldr r1, [sp, #28]
; THUMB6-NEXT:    ldr r4, [sp, #92]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #7]
; THUMB6-NEXT:    ldr r1, [sp, #24]
; THUMB6-NEXT:    ldr r4, [sp, #88]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #6]
; THUMB6-NEXT:    ldr r1, [sp, #20]
; THUMB6-NEXT:    ldr r4, [sp, #84]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #5]
; THUMB6-NEXT:    ldr r1, [sp, #16]
; THUMB6-NEXT:    ldr r4, [sp, #80]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #4]
; THUMB6-NEXT:    ldr r1, [sp, #12]
; THUMB6-NEXT:    ldr r4, [sp, #76]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #3]
; THUMB6-NEXT:    ldr r1, [sp, #8]
; THUMB6-NEXT:    ldr r4, [sp, #72]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #2]
; THUMB6-NEXT:    ldr r1, [sp, #68]
; THUMB6-NEXT:    adds r1, r1, r3
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0, #1]
; THUMB6-NEXT:    ldr r1, [sp, #64]
; THUMB6-NEXT:    adds r1, r1, r2
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strb r1, [r0]
; THUMB6-NEXT:    pop {r4, pc}
;
; THUMB78-LABEL: vector_i128_i8:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    vmov d17, r2, r3
; THUMB78-NEXT:    vmov d16, r0, r1
; THUMB78-NEXT:    mov r0, sp
; THUMB78-NEXT:    vmvn q8, q8
; THUMB78-NEXT:    vld1.64 {d18, d19}, [r0]
; THUMB78-NEXT:    vsub.i8 q8, q9, q8
; THUMB78-NEXT:    vmov r0, r1, d16
; THUMB78-NEXT:    vmov r2, r3, d17
; THUMB78-NEXT:    bx lr
  %t0 = xor <16 x i8> %x, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
  %t1 = sub <16 x i8> %y, %t0
  ret <16 x i8> %t1
}

define <8 x i16> @vector_i128_i16(<8 x i16> %x, <8 x i16> %y) nounwind {
; ARM6-LABEL: vector_i128_i16:
; ARM6:       @ %bb.0:
; ARM6-NEXT:    ldrh r12, [sp, #20]
; ARM6-NEXT:    ldrh r1, [sp, #52]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrh r12, [sp, #16]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #14]
; ARM6-NEXT:    ldrh r1, [sp, #48]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrh r12, [sp, #12]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #12]
; ARM6-NEXT:    ldrh r1, [sp, #44]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrh r12, [sp, #8]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #10]
; ARM6-NEXT:    ldrh r1, [sp, #40]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrh r12, [sp, #4]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #8]
; ARM6-NEXT:    ldrh r1, [sp, #36]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    ldrh r12, [sp]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #6]
; ARM6-NEXT:    ldrh r1, [sp, #32]
; ARM6-NEXT:    add r1, r1, r12
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #4]
; ARM6-NEXT:    ldrh r1, [sp, #28]
; ARM6-NEXT:    add r1, r1, r3
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0, #2]
; ARM6-NEXT:    ldrh r1, [sp, #24]
; ARM6-NEXT:    add r1, r1, r2
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    strh r1, [r0]
; ARM6-NEXT:    bx lr
;
; ARM78-LABEL: vector_i128_i16:
; ARM78:       @ %bb.0:
; ARM78-NEXT:    vmov d17, r2, r3
; ARM78-NEXT:    vmov d16, r0, r1
; ARM78-NEXT:    mov r0, sp
; ARM78-NEXT:    vmvn q8, q8
; ARM78-NEXT:    vld1.64 {d18, d19}, [r0]
; ARM78-NEXT:    vsub.i16 q8, q9, q8
; ARM78-NEXT:    vmov r0, r1, d16
; ARM78-NEXT:    vmov r2, r3, d17
; ARM78-NEXT:    bx lr
;
; THUMB6-LABEL: vector_i128_i16:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    push {r4, lr}
; THUMB6-NEXT:    ldr r1, [sp, #28]
; THUMB6-NEXT:    ldr r4, [sp, #60]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #14]
; THUMB6-NEXT:    ldr r1, [sp, #24]
; THUMB6-NEXT:    ldr r4, [sp, #56]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #12]
; THUMB6-NEXT:    ldr r1, [sp, #20]
; THUMB6-NEXT:    ldr r4, [sp, #52]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #10]
; THUMB6-NEXT:    ldr r1, [sp, #16]
; THUMB6-NEXT:    ldr r4, [sp, #48]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #8]
; THUMB6-NEXT:    ldr r1, [sp, #12]
; THUMB6-NEXT:    ldr r4, [sp, #44]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #6]
; THUMB6-NEXT:    ldr r1, [sp, #8]
; THUMB6-NEXT:    ldr r4, [sp, #40]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #4]
; THUMB6-NEXT:    ldr r1, [sp, #36]
; THUMB6-NEXT:    adds r1, r1, r3
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0, #2]
; THUMB6-NEXT:    ldr r1, [sp, #32]
; THUMB6-NEXT:    adds r1, r1, r2
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    strh r1, [r0]
; THUMB6-NEXT:    pop {r4, pc}
;
; THUMB78-LABEL: vector_i128_i16:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    vmov d17, r2, r3
; THUMB78-NEXT:    vmov d16, r0, r1
; THUMB78-NEXT:    mov r0, sp
; THUMB78-NEXT:    vmvn q8, q8
; THUMB78-NEXT:    vld1.64 {d18, d19}, [r0]
; THUMB78-NEXT:    vsub.i16 q8, q9, q8
; THUMB78-NEXT:    vmov r0, r1, d16
; THUMB78-NEXT:    vmov r2, r3, d17
; THUMB78-NEXT:    bx lr
  %t0 = xor <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
  %t1 = sub <8 x i16> %y, %t0
  ret <8 x i16> %t1
}

define <4 x i32> @vector_i128_i32(<4 x i32> %x, <4 x i32> %y) nounwind {
; ARM6-LABEL: vector_i128_i32:
; ARM6:       @ %bb.0:
; ARM6-NEXT:    ldr r12, [sp]
; ARM6-NEXT:    add r0, r12, r0
; ARM6-NEXT:    ldr r12, [sp, #4]
; ARM6-NEXT:    add r0, r0, #1
; ARM6-NEXT:    add r1, r12, r1
; ARM6-NEXT:    ldr r12, [sp, #8]
; ARM6-NEXT:    add r1, r1, #1
; ARM6-NEXT:    add r2, r12, r2
; ARM6-NEXT:    ldr r12, [sp, #12]
; ARM6-NEXT:    add r2, r2, #1
; ARM6-NEXT:    add r3, r12, r3
; ARM6-NEXT:    add r3, r3, #1
; ARM6-NEXT:    bx lr
;
; ARM78-LABEL: vector_i128_i32:
; ARM78:       @ %bb.0:
; ARM78-NEXT:    vmov d17, r2, r3
; ARM78-NEXT:    vmov d16, r0, r1
; ARM78-NEXT:    mov r0, sp
; ARM78-NEXT:    vmvn q8, q8
; ARM78-NEXT:    vld1.64 {d18, d19}, [r0]
; ARM78-NEXT:    vsub.i32 q8, q9, q8
; ARM78-NEXT:    vmov r0, r1, d16
; ARM78-NEXT:    vmov r2, r3, d17
; ARM78-NEXT:    bx lr
;
; THUMB6-LABEL: vector_i128_i32:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    push {r4, lr}
; THUMB6-NEXT:    ldr r4, [sp, #8]
; THUMB6-NEXT:    adds r0, r4, r0
; THUMB6-NEXT:    adds r0, r0, #1
; THUMB6-NEXT:    ldr r4, [sp, #12]
; THUMB6-NEXT:    adds r1, r4, r1
; THUMB6-NEXT:    adds r1, r1, #1
; THUMB6-NEXT:    ldr r4, [sp, #16]
; THUMB6-NEXT:    adds r2, r4, r2
; THUMB6-NEXT:    adds r2, r2, #1
; THUMB6-NEXT:    ldr r4, [sp, #20]
; THUMB6-NEXT:    adds r3, r4, r3
; THUMB6-NEXT:    adds r3, r3, #1
; THUMB6-NEXT:    pop {r4, pc}
;
; THUMB78-LABEL: vector_i128_i32:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    vmov d17, r2, r3
; THUMB78-NEXT:    vmov d16, r0, r1
; THUMB78-NEXT:    mov r0, sp
; THUMB78-NEXT:    vmvn q8, q8
; THUMB78-NEXT:    vld1.64 {d18, d19}, [r0]
; THUMB78-NEXT:    vsub.i32 q8, q9, q8
; THUMB78-NEXT:    vmov r0, r1, d16
; THUMB78-NEXT:    vmov r2, r3, d17
; THUMB78-NEXT:    bx lr
  %t0 = xor <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
  %t1 = sub <4 x i32> %y, %t0
  ret <4 x i32> %t1
}

define <2 x i64> @vector_i128_i64(<2 x i64> %x, <2 x i64> %y) nounwind {
; ARM6-LABEL: vector_i128_i64:
; ARM6:       @ %bb.0:
; ARM6-NEXT:    push {r11, lr}
; ARM6-NEXT:    ldr lr, [sp, #8]
; ARM6-NEXT:    ldr r12, [sp, #12]
; ARM6-NEXT:    adds r0, lr, r0
; ARM6-NEXT:    ldr lr, [sp, #16]
; ARM6-NEXT:    adc r1, r12, r1
; ARM6-NEXT:    adds r0, r0, #1
; ARM6-NEXT:    ldr r12, [sp, #20]
; ARM6-NEXT:    adc r1, r1, #0
; ARM6-NEXT:    adds r2, lr, r2
; ARM6-NEXT:    adc r3, r12, r3
; ARM6-NEXT:    adds r2, r2, #1
; ARM6-NEXT:    adc r3, r3, #0
; ARM6-NEXT:    pop {r11, pc}
;
; ARM78-LABEL: vector_i128_i64:
; ARM78:       @ %bb.0:
; ARM78-NEXT:    vmov d17, r2, r3
; ARM78-NEXT:    vmov d16, r0, r1
; ARM78-NEXT:    mov r0, sp
; ARM78-NEXT:    vmvn q8, q8
; ARM78-NEXT:    vld1.64 {d18, d19}, [r0]
; ARM78-NEXT:    vsub.i64 q8, q9, q8
; ARM78-NEXT:    vmov r0, r1, d16
; ARM78-NEXT:    vmov r2, r3, d17
; ARM78-NEXT:    bx lr
;
; THUMB6-LABEL: vector_i128_i64:
; THUMB6:       @ %bb.0:
; THUMB6-NEXT:    push {r4, r5, r7, lr}
; THUMB6-NEXT:    mvns r4, r1
; THUMB6-NEXT:    mvns r0, r0
; THUMB6-NEXT:    ldr r1, [sp, #20]
; THUMB6-NEXT:    ldr r5, [sp, #16]
; THUMB6-NEXT:    subs r0, r5, r0
; THUMB6-NEXT:    sbcs r1, r4
; THUMB6-NEXT:    mvns r4, r3
; THUMB6-NEXT:    mvns r2, r2
; THUMB6-NEXT:    ldr r3, [sp, #28]
; THUMB6-NEXT:    ldr r5, [sp, #24]
; THUMB6-NEXT:    subs r2, r5, r2
; THUMB6-NEXT:    sbcs r3, r4
; THUMB6-NEXT:    pop {r4, r5, r7, pc}
;
; THUMB78-LABEL: vector_i128_i64:
; THUMB78:       @ %bb.0:
; THUMB78-NEXT:    vmov d17, r2, r3
; THUMB78-NEXT:    vmov d16, r0, r1
; THUMB78-NEXT:    mov r0, sp
; THUMB78-NEXT:    vmvn q8, q8
; THUMB78-NEXT:    vld1.64 {d18, d19}, [r0]
; THUMB78-NEXT:    vsub.i64 q8, q9, q8
; THUMB78-NEXT:    vmov r0, r1, d16
; THUMB78-NEXT:    vmov r2, r3, d17
; THUMB78-NEXT:    bx lr
  %t0 = xor <2 x i64> %x, <i64 -1, i64 -1>
  %t1 = sub <2 x i64> %y, %t0
  ret <2 x i64> %t1
}