llvm/llvm/test/CodeGen/AArch64/GlobalISel/select-uadde.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -verify-machineinstrs -mtriple aarch64-unknown-uknown -global-isel-abort=1 -run-pass=instruction-select %s -o - | FileCheck %s
...
---
name:            uadde_s64
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x0, $x1

    ; CHECK-LABEL: name: uadde_s64
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32common = MOVi32imm 1
    ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[MOVi32imm]], 1, 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSXr:%[0-9]+]]:gpr64 = ADCSXr [[COPY]], [[COPY1]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv
    ; CHECK-NEXT: $x0 = COPY [[ADCSXr]]
    ; CHECK-NEXT: $w1 = COPY [[CSINCWr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $w1
    %0:gpr(s64) = COPY $x0
    %1:gpr(s64) = COPY $x1
    %2:gpr(s32) = G_CONSTANT i32 1
    %3:gpr(s64), %4:gpr(s32) = G_UADDE %0, %1, %2
    $x0 = COPY %3(s64)
    $w1 = COPY %4(s32)
    RET_ReallyLR implicit $x0, implicit $w1
...
...
---
name:            uadde_s32
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $w0, $w1

    ; CHECK-LABEL: name: uadde_s32
    ; CHECK: liveins: $w0, $w1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
    ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32common = MOVi32imm 1
    ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[MOVi32imm]], 1, 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSWr:%[0-9]+]]:gpr32 = ADCSWr [[COPY]], [[COPY1]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv
    ; CHECK-NEXT: $w0 = COPY [[ADCSWr]]
    ; CHECK-NEXT: $w1 = COPY [[CSINCWr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $w0, implicit $w1
    %0:gpr(s32) = COPY $w0
    %1:gpr(s32) = COPY $w1
    %2:gpr(s32) = G_CONSTANT i32 1
    %3:gpr(s32), %4:gpr(s32) = G_UADDE %0, %1, %2
    $w0 = COPY %3(s32)
    $w1 = COPY %4(s32)
    RET_ReallyLR implicit $w0, implicit $w1
...
...
---
name:            uadde_opt_prev_uaddo
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x0, $x1, $x2, $x3

    ; CHECK-LABEL: name: uadde_opt_prev_uaddo
    ; CHECK: liveins: $x0, $x1, $x2, $x3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
    ; CHECK-NEXT: [[ADDSXrr:%[0-9]+]]:gpr64 = ADDSXrr [[COPY]], [[COPY2]], implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSXr:%[0-9]+]]:gpr64 = ADCSXr [[COPY1]], [[COPY3]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: $x0 = COPY [[ADDSXrr]]
    ; CHECK-NEXT: $x1 = COPY [[ADCSXr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1
    %0:gpr(s64) = COPY $x0
    %1:gpr(s64) = COPY $x1
    %2:gpr(s64) = COPY $x2
    %3:gpr(s64) = COPY $x3
    %8:gpr(s64), %12:gpr(s32) = G_UADDO %0, %2
    %9:gpr(s64), %13:gpr(s32) = G_UADDE %1, %3, %12
    $x0 = COPY %8(s64)
    $x1 = COPY %9(s64)
    RET_ReallyLR implicit $x0, implicit $x1
...
...
---
name:            uadde_opt_prev_uadde
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x0, $x1, $x2, $x3

    ; CHECK-LABEL: name: uadde_opt_prev_uadde
    ; CHECK: liveins: $x0, $x1, $x2, $x3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
    ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32common = MOVi32imm 1
    ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[MOVi32imm]], 1, 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSXr:%[0-9]+]]:gpr64 = ADCSXr [[COPY]], [[COPY2]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: [[ADCSXr1:%[0-9]+]]:gpr64 = ADCSXr [[COPY1]], [[COPY3]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: $x0 = COPY [[ADCSXr]]
    ; CHECK-NEXT: $x1 = COPY [[ADCSXr1]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1
    %0:gpr(s64) = COPY $x0
    %1:gpr(s64) = COPY $x1
    %2:gpr(s64) = COPY $x2
    %3:gpr(s64) = COPY $x3
    %6:gpr(s32) = G_CONSTANT i32 1
    %8:gpr(s64), %12:gpr(s32) = G_UADDE %0, %2, %6
    %9:gpr(s64), %13:gpr(s32) = G_UADDE %1, %3, %12
    $x0 = COPY %8(s64)
    $x1 = COPY %9(s64)
    RET_ReallyLR implicit $x0, implicit $x1
...
...
---
name:            uadde_opt_bail_clobber
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x0, $x1, $x2, $x4, $x5, $x6

    ; CHECK-LABEL: name: uadde_opt_bail_clobber
    ; CHECK: liveins: $x0, $x1, $x2, $x4, $x5, $x6
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x4
    ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr64 = COPY $x5
    ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr64 = COPY $x6
    ; CHECK-NEXT: [[ADDSXrr:%[0-9]+]]:gpr64 = ADDSXrr [[COPY]], [[COPY3]], implicit-def $nzcv
    ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 3, implicit $nzcv
    ; CHECK-NEXT: [[ADCSXr:%[0-9]+]]:gpr64 = ADCSXr [[COPY1]], [[COPY4]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[CSINCWr]], 1, 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSXr1:%[0-9]+]]:gpr64 = ADCSXr [[COPY2]], [[COPY5]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: $x0 = COPY [[ADDSXrr]]
    ; CHECK-NEXT: $x1 = COPY [[ADCSXr]]
    ; CHECK-NEXT: $x2 = COPY [[ADCSXr1]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1, implicit $x2
    %0:gpr(s64) = COPY $x0
    %1:gpr(s64) = COPY $x1
    %2:gpr(s64) = COPY $x2
    %4:gpr(s64) = COPY $x4
    %5:gpr(s64) = COPY $x5
    %6:gpr(s64) = COPY $x6
    %7:gpr(s64), %11:gpr(s32) = G_UADDO %0, %4
    %8:gpr(s64), %12:gpr(s32) = G_UADDE %1, %5, %11
    ; carry-in is not produced by previous instruction
    %9:gpr(s64), %13:gpr(s32) = G_UADDE %2, %6, %11
    $x0 = COPY %7(s64)
    $x1 = COPY %8(s64)
    $x2 = COPY %9(s64)
    RET_ReallyLR implicit $x0, implicit $x1, implicit $x2
...
...
---
name:            uadde_opt_prev_dead
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x0, $x1, $x2, $x3
    ; CHECK-LABEL: name: uadde_opt_prev_dead
    ; CHECK: liveins: $x0, $x1, $x2, $x3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
    ; CHECK-NEXT: [[ADDSXrr:%[0-9]+]]:gpr64 = ADDSXrr [[COPY]], [[COPY2]], implicit-def $nzcv
    ; CHECK-NEXT: [[ADCSXr:%[0-9]+]]:gpr64 = ADCSXr [[COPY1]], [[COPY3]], implicit-def $nzcv, implicit $nzcv
    ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv
    ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $w0
    %0:gpr(s64) = COPY $x0
    %1:gpr(s64) = COPY $x1
    %2:gpr(s64) = COPY $x2
    %3:gpr(s64) = COPY $x3
    %4:gpr(s64), %5:gpr(s32) = G_UADDO %0, %2
    %6:gpr(s64), %7:gpr(s32) = G_UADDE %1, %3, %5
    $w0 = COPY %7(s32)
    RET_ReallyLR implicit $w0
...