llvm/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/ext-trunc-rv64.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv64 -run-pass=regbankselect \
# RUN:   -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s \
# RUN:   -o - | FileCheck -check-prefix=RV64I %s

---
name:            anyext_i32_i64
legalized:       true
body:             |
  bb.0.entry:
    liveins: $x10, $x11

    ; RV64I-LABEL: name: anyext_i32_i64
    ; RV64I: liveins: $x10, $x11
    ; RV64I-NEXT: {{  $}}
    ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
    ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY]](s64)
    ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11
    ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY1]](s64)
    ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[TRUNC]], [[TRUNC1]]
    ; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:gprb(s64) = G_ANYEXT [[ADD]](s32)
    ; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
    ; RV64I-NEXT: PseudoRET implicit $x10
    %2:_(s64) = COPY $x10
    %0:_(s32) = G_TRUNC %2(s64)
    %3:_(s64) = COPY $x11
    %1:_(s32) = G_TRUNC %3(s64)
    %4:_(s32) = G_ADD %0, %1
    %5:_(s64) = G_ANYEXT %4(s32)
    $x10 = COPY %5(s64)
    PseudoRET implicit $x10

...
---
name:            sext_i32_i64
legalized:       true
body:             |
  bb.0.entry:
    liveins: $x10, $x11

    ; RV64I-LABEL: name: sext_i32_i64
    ; RV64I: liveins: $x10, $x11
    ; RV64I-NEXT: {{  $}}
    ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
    ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY]](s64)
    ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11
    ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY1]](s64)
    ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[TRUNC]], [[TRUNC1]]
    ; RV64I-NEXT: [[SEXT:%[0-9]+]]:gprb(s64) = G_SEXT [[ADD]](s32)
    ; RV64I-NEXT: $x10 = COPY [[SEXT]](s64)
    ; RV64I-NEXT: PseudoRET implicit $x10
    %2:_(s64) = COPY $x10
    %0:_(s32) = G_TRUNC %2(s64)
    %3:_(s64) = COPY $x11
    %1:_(s32) = G_TRUNC %3(s64)
    %4:_(s32) = G_ADD %0, %1
    %5:_(s64) = G_SEXT %4(s32)
    $x10 = COPY %5(s64)
    PseudoRET implicit $x10

...
---
name:            zext_i32_i64
legalized:       true
body:             |
  bb.0.entry:
    liveins: $x10, $x11

    ; RV64I-LABEL: name: zext_i32_i64
    ; RV64I: liveins: $x10, $x11
    ; RV64I-NEXT: {{  $}}
    ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
    ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY]](s64)
    ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11
    ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY1]](s64)
    ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[TRUNC]], [[TRUNC1]]
    ; RV64I-NEXT: [[ZEXT:%[0-9]+]]:gprb(s64) = G_ZEXT [[ADD]](s32)
    ; RV64I-NEXT: $x10 = COPY [[ZEXT]](s64)
    ; RV64I-NEXT: PseudoRET implicit $x10
    %2:_(s64) = COPY $x10
    %0:_(s32) = G_TRUNC %2(s64)
    %3:_(s64) = COPY $x11
    %1:_(s32) = G_TRUNC %3(s64)
    %4:_(s32) = G_ADD %0, %1
    %5:_(s64) = G_ZEXT %4(s32)
    $x10 = COPY %5(s64)
    PseudoRET implicit $x10

...