llvm/llvm/test/CodeGen/AMDGPU/licm-regpressure.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass machinelicm -o - %s | FileCheck -check-prefix=GCN %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -passes machinelicm -o - %s | FileCheck -check-prefix=GCN %s

# MachineLICM shall limit hoisting of V_CVT instructions out of the loop keeping
# register pressure within the budget. VGPR budget at occupancy 10 is 24 vgprs.

---
name:            test
tracksRegLiveness: true
body:             |
  ; GCN-LABEL: name: test
  ; GCN: bb.0:
  ; GCN-NEXT:   successors: %bb.1(0x80000000)
  ; GCN-NEXT:   liveins: $vcc, $vgpr0
  ; GCN-NEXT: {{  $}}
  ; GCN-NEXT:   [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY4:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY5:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY7:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY8:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY9:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY10:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY11:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY12:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY13:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY14:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY15:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY16:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[COPY17:%[0-9]+]]:vgpr_32 = COPY $vgpr0
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_1:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY1]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_2:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY2]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_3:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY3]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_4:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY4]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_5:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY5]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_6:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY6]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_7:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY7]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_8:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY8]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_9:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY9]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_10:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY10]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_11:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY11]], implicit $mode, implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_12:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY12]], implicit $mode, implicit $exec
  ; GCN-NEXT: {{  $}}
  ; GCN-NEXT: bb.1:
  ; GCN-NEXT:   successors: %bb.2(0x04000000), %bb.1(0x7c000000)
  ; GCN-NEXT:   liveins: $vcc
  ; GCN-NEXT: {{  $}}
  ; GCN-NEXT:   $vcc = S_AND_B64 $exec, $vcc, implicit-def $scc
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_1]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_2]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_3]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_4]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_5]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_6]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_7]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_8]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_9]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_10]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_11]], implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, [[V_CVT_F64_I32_e32_12]], implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_13:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY13]], implicit $mode, implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, killed [[V_CVT_F64_I32_e32_13]], implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_14:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY14]], implicit $mode, implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, killed [[V_CVT_F64_I32_e32_14]], implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_15:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY15]], implicit $mode, implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, killed [[V_CVT_F64_I32_e32_15]], implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_16:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY16]], implicit $mode, implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, killed [[V_CVT_F64_I32_e32_16]], implicit $exec
  ; GCN-NEXT:   [[V_CVT_F64_I32_e32_17:%[0-9]+]]:vreg_64 = nofpexcept V_CVT_F64_I32_e32 [[COPY17]], implicit $mode, implicit $exec
  ; GCN-NEXT:   $vcc = V_CMP_EQ_U64_e64 $vcc, killed [[V_CVT_F64_I32_e32_17]], implicit $exec
  ; GCN-NEXT:   S_CBRANCH_VCCNZ %bb.1, implicit $vcc
  ; GCN-NEXT:   S_BRANCH %bb.2
  ; GCN-NEXT: {{  $}}
  ; GCN-NEXT: bb.2:
  ; GCN-NEXT:   S_ENDPGM 0
  bb.0:
    successors: %bb.1(0x80000000)
    liveins: $vcc, $vgpr0

    %0:vgpr_32 = COPY $vgpr0
    %1:vgpr_32 = COPY $vgpr0
    %2:vgpr_32 = COPY $vgpr0
    %3:vgpr_32 = COPY $vgpr0
    %4:vgpr_32 = COPY $vgpr0
    %5:vgpr_32 = COPY $vgpr0
    %6:vgpr_32 = COPY $vgpr0
    %7:vgpr_32 = COPY $vgpr0
    %8:vgpr_32 = COPY $vgpr0
    %9:vgpr_32 = COPY $vgpr0
    %10:vgpr_32 = COPY $vgpr0
    %11:vgpr_32 = COPY $vgpr0
    %12:vgpr_32 = COPY $vgpr0
    %13:vgpr_32 = COPY $vgpr0
    %14:vgpr_32 = COPY $vgpr0
    %15:vgpr_32 = COPY $vgpr0
    %16:vgpr_32 = COPY $vgpr0
    %17:vgpr_32 = COPY $vgpr0

  bb.1:
    successors: %bb.2(0x04000000), %bb.1(0x7c000000)
    liveins: $vcc

    $vcc = S_AND_B64 $exec, $vcc, implicit-def $scc
    %18:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %0, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %18, implicit $exec
    %19:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %1, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %19, implicit $exec
    %20:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %2, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %20, implicit $exec
    %21:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %3, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %21, implicit $exec
    %22:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %4, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %22, implicit $exec
    %23:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %5, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %23, implicit $exec
    %24:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %6, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %24, implicit $exec
    %25:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %7, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %25, implicit $exec
    %26:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %8, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %26, implicit $exec
    %27:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %9, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %27, implicit $exec
    %28:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %10, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %28, implicit $exec
    %29:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %11, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %29, implicit $exec
    %30:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %12, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %30, implicit $exec
    %31:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %13, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %31, implicit $exec
    %32:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %14, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %32, implicit $exec
    %33:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %15, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %33, implicit $exec
    %34:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %16, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %34, implicit $exec
    %35:vreg_64 = nofpexcept V_CVT_F64_I32_e32 %17, implicit $mode, implicit $exec
    $vcc = V_CMP_EQ_U64_e64 $vcc, killed %35, implicit $exec
    S_CBRANCH_VCCNZ %bb.1, implicit $vcc
    S_BRANCH %bb.2

  bb.2:
    S_ENDPGM 0

...