llvm/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-itofp-rv32.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -mattr=+d -run-pass=legalizer %s -o - \
# RUN: | FileCheck %s

---
name:            sitofp_s32_s1
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s32_s1
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s1) = G_TRUNC %1(s32)
    %2:_(s32) = G_SITOFP %0(s1)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            uitofp_s32_s1
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s32_s1
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s1) = G_TRUNC %1(s32)
    %2:_(s32) = G_UITOFP %0(s1)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            sitofp_s32_s8
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s32_s8
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s8) = G_TRUNC %1(s32)
    %2:_(s32) = G_SITOFP %0(s8)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            uitofp_s32_s8
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s32_s8
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s8) = G_TRUNC %1(s32)
    %2:_(s32) = G_UITOFP %0(s8)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            sitofp_s32_s16
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s32_s16
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s16) = G_TRUNC %1(s32)
    %2:_(s32) = G_SITOFP %0(s16)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            uitofp_s32_s16
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s32_s16
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %1:_(s32) = COPY $x10
    %0:_(s16) = G_TRUNC %1(s32)
    %2:_(s32) = G_UITOFP %0(s16)
    $f10_f = COPY %2(s32)
    PseudoRET implicit $f10_f

...
---
name:            sitofp_s32_s32
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s32_s32
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %0:_(s32) = COPY $x10
    %1:_(s32) = G_SITOFP %0(s32)
    $f10_f = COPY %1(s32)
    PseudoRET implicit $f10_f

...
---
name:            uitofp_s32_s32
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s32_s32
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s32)
    ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $f10_f
    %0:_(s32) = COPY $x10
    %1:_(s32) = G_UITOFP %0(s32)
    $f10_f = COPY %1(s32)
    PseudoRET implicit $f10_f

...
---
name:            sitofp_s64_s1
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s64_s1
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s1) = G_TRUNC %1(s32)
    %2:_(s64) = G_SITOFP %0(s1)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            uitofp_s64_s1
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s64_s1
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s1) = G_TRUNC %1(s32)
    %2:_(s64) = G_UITOFP %0(s1)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            sitofp_s64_s8
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s64_s8
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s8) = G_TRUNC %1(s32)
    %2:_(s64) = G_SITOFP %0(s8)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            uitofp_s64_s8
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s64_s8
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s8) = G_TRUNC %1(s32)
    %2:_(s64) = G_UITOFP %0(s8)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            sitofp_s64_s16
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s64_s16
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s16) = G_TRUNC %1(s32)
    %2:_(s64) = G_SITOFP %0(s16)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            uitofp_s64_s16
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s64_s16
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %1:_(s32) = COPY $x10
    %0:_(s16) = G_TRUNC %1(s32)
    %2:_(s64) = G_UITOFP %0(s16)
    $f10_d = COPY %2(s64)
    PseudoRET implicit $f10_d

...
---
name:            sitofp_s64_s32
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: sitofp_s64_s32
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %0:_(s32) = COPY $x10
    %1:_(s64) = G_SITOFP %0(s32)
    $f10_d = COPY %1(s64)
    PseudoRET implicit $f10_d

...
---
name:            uitofp_s64_s32
tracksRegLiveness: true
body:             |
  bb.1:
    liveins: $x10

    ; CHECK-LABEL: name: uitofp_s64_s32
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[COPY]](s32)
    ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
    ; CHECK-NEXT: PseudoRET implicit $f10_d
    %0:_(s32) = COPY $x10
    %1:_(s64) = G_UITOFP %0(s32)
    $f10_d = COPY %1(s64)
    PseudoRET implicit $f10_d

...