llvm/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/fp-load-store.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -mattr=+d -run-pass=regbankselect \
# RUN:   -simplify-mir -verify-machineinstrs %s \
# RUN:   -o - | FileCheck %s --check-prefixes=CHECK
# RUN: llc -mtriple=riscv64 -mattr=+d -run-pass=regbankselect \
# RUN:   -simplify-mir -verify-machineinstrs %s \
# RUN:   -o - | FileCheck %s --check-prefixes=CHECK

---
name:            fp_store_fp_def_f32
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_f, $f11_f

    ; CHECK-LABEL: name: fp_store_fp_def_f32
    ; CHECK: liveins: $x10, $f10_f, $f11_f
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
    ; CHECK-NEXT: [[FADD:%[0-9]+]]:fprb(s32) = G_FADD [[COPY1]], [[COPY2]]
    ; CHECK-NEXT: G_STORE [[FADD]](s32), [[COPY]](p0) :: (store (s32))
    ; CHECK-NEXT: PseudoRET
    %0:_(p0) = COPY $x10
    %1:_(s32) = COPY $f10_f
    %2:_(s32) = COPY $f11_f
    %3:_(s32) = G_FADD %1, %2
    G_STORE %3(s32), %0(p0) :: (store (s32))
    PseudoRET

...
---
name:            fp_store_fp_def_f64
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_d, $f11_d

    ; CHECK-LABEL: name: fp_store_fp_def_f64
    ; CHECK: liveins: $x10, $f10_d, $f11_d
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $f11_d
    ; CHECK-NEXT: [[FADD:%[0-9]+]]:fprb(s64) = G_FADD [[COPY1]], [[COPY2]]
    ; CHECK-NEXT: G_STORE [[FADD]](s64), [[COPY]](p0) :: (store (s64))
    ; CHECK-NEXT: PseudoRET
    %0:_(p0) = COPY $x10
    %1:_(s64) = COPY $f10_d
    %2:_(s64) = COPY $f11_d
    %3:_(s64) = G_FADD %1, %2
    G_STORE %3(s64), %0(p0) :: (store (s64))
    PseudoRET

...
---
name:            fp_store_no_def_f64
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_d

    ; CHECK-LABEL: name: fp_store_no_def_f64
    ; CHECK: liveins: $x10, $f10_d
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
    ; CHECK-NEXT: G_STORE [[COPY1]](s64), [[COPY]](p0) :: (store (s64))
    ; CHECK-NEXT: PseudoRET
    %0:_(p0) = COPY $x10
    %1:_(s64) = COPY $f10_d
    G_STORE %1(s64), %0(p0) :: (store (s64))
    PseudoRET

...
---
name:            fp_load_fp_use_f32
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_f

    ; CHECK-LABEL: name: fp_load_fp_use_f32
    ; CHECK: liveins: $x10, $f10_f
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:fprb(s32) = G_LOAD [[COPY]](p0) :: (load (s32))
    ; CHECK-NEXT: [[FADD:%[0-9]+]]:fprb(s32) = G_FADD [[LOAD]], [[COPY1]]
    ; CHECK-NEXT: $f10_f = COPY [[FADD]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %0:_(p0) = COPY $x10
    %1:_(s32) = COPY $f10_f
    %2:_(s32) = G_LOAD %0(p0) :: (load (s32))
    %3:_(s32) = G_FADD %2, %1
    $f10_f = COPY %3(s32)
    PseudoRET implicit $f10_f

...
---
name:            fp_load_fp_use_f64
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_d

    ; CHECK-LABEL: name: fp_load_fp_use_f64
    ; CHECK: liveins: $x10, $f10_d
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY]](p0) :: (load (s64))
    ; CHECK-NEXT: [[FADD:%[0-9]+]]:fprb(s64) = G_FADD [[LOAD]], [[COPY1]]
    ; CHECK-NEXT: $f10_d = COPY [[FADD]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %0:_(p0) = COPY $x10
    %1:_(s64) = COPY $f10_d
    %2:_(s64) = G_LOAD %0(p0) :: (load (s64))
    %3:_(s64) = G_FADD %2, %1
    $f10_d = COPY %3(s64)
    PseudoRET implicit $f10_d

...
---
name:            fp_load_no_use_f64
legalized:       true
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10, $f10_d

    ; CHECK-LABEL: name: fp_load_no_use_f64
    ; CHECK: liveins: $x10, $f10_d
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY]](p0) :: (load (s64))
    ; CHECK-NEXT: $f10_d = COPY [[LOAD]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %0:_(p0) = COPY $x10
    %1:_(s64) = COPY $f10_d
    %2:_(s64) = G_LOAD %0(p0) :: (load (s64))
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...