Home | History | Annotate | Download | only in AMDGPU
      1 # RUN: llc -march=amdgcn -run-pass simple-register-coalescing -verify-machineinstrs -o - %s | FileCheck --check-prefix=GCN %s
      2 #
      3 # See bug http://llvm.org/PR33152 for details of the bug this test is checking
      4 # for.
      5 # This test will provoke a subrange join during simple register
      6 # coalescing. Withough a fix for PR33152 this causes an unreachable in SubRange
      7 # Join
      8 #
      9 # The lines where the problem exhibits are the last 2 copy instructions in the
     10 # BB (bb.25)
     11 #
     12 # GCN-LABEL: bb.6:
     13 # GCN: successors: %bb.7(0x{{[0-9]+}}), %bb.18(0x{{[0-9]+}})
     14 # GCN: %{{[0-9]+}}:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET %{{[0-9]+}}, 0, 0, 0, 0, 0, implicit $exec
     15 #
     16 
     17 --- |
     18   target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
     19   target triple = "amdgcn--amdpal"
     20 
     21   define amdgpu_ps void @main() #0 {
     22     ret void
     23   }
     24 
     25   attributes #0 = { "target-cpu"="gfx803" }
     26 ...
     27 
     28 ---
     29 name:            main
     30 tracksRegLiveness: true
     31 body: |
     32   bb.0:
     33     successors: %bb.2(0x40000000), %bb.1(0x40000000)
     34     S_CBRANCH_SCC0 %bb.2, implicit undef $scc
     35 
     36   bb.1:
     37     successors: %bb.9(0x80000000)
     38     %0:vreg_128 = IMPLICIT_DEF
     39     S_BRANCH %bb.9
     40 
     41   bb.2:
     42     successors: %bb.4(0x40000000), %bb.3(0x40000000)
     43     S_CBRANCH_SCC0 %bb.4, implicit undef $scc
     44 
     45   bb.3:
     46     successors: %bb.5(0x80000000)
     47     %1:vreg_128 = IMPLICIT_DEF
     48     S_BRANCH %bb.5
     49 
     50   bb.4:
     51     successors: %bb.6(0x80000000)
     52     %2:sreg_64 = S_MOV_B64 0
     53     %3:sreg_32_xm0 = S_MOV_B32 61440
     54     %4:sreg_32_xm0 = S_MOV_B32 -1
     55     %5:sreg_64 = COPY killed %2
     56     %6:vreg_128 = IMPLICIT_DEF
     57     S_BRANCH %bb.6
     58 
     59   bb.5:
     60     successors: %bb.9(0x80000000)
     61     %7:vreg_128 = COPY killed %1
     62     %8:vreg_128 = COPY killed %7
     63     %0:vreg_128 = COPY killed %8
     64     S_BRANCH %bb.9
     65 
     66   bb.6:
     67     successors: %bb.7(0x40000000), %bb.18(0x40000000)
     68     %9:vreg_128 = COPY killed %6
     69     %10:sreg_64 = COPY killed %5
     70     undef %11.sub2:sreg_128 = COPY %4
     71     %11.sub3:sreg_128 = COPY %3
     72     %12:vreg_128 = BUFFER_LOAD_DWORDX4_OFFSET killed %11, 0, 0, 0, 0, 0, implicit $exec
     73     undef %13.sub1:vreg_128 = COPY %9.sub1
     74     %13.sub2:vreg_128 = COPY %9.sub2
     75     %14:sreg_64 = V_CMP_GT_F32_e64 0, target-flags(amdgpu-rel32-lo) 0, 0, killed %12.sub3, 0, implicit $exec
     76     %15:vgpr_32 = V_ADD_F32_e32 1065353216, undef %16:vgpr_32, implicit $exec
     77     %17:sreg_64 = V_CMP_GT_F32_e64 0, 0, 0, killed %15, 0, implicit $exec
     78     %18:sreg_64 = S_AND_B64 killed %17, killed %14, implicit-def dead $scc
     79     %19:sreg_64 = COPY %10
     80     %20:vreg_128 = COPY %13
     81     %21:vreg_128 = IMPLICIT_DEF
     82     %22:sreg_64 = COPY $exec, implicit-def $exec
     83     %23:sreg_64 = S_AND_B64 %22, %18, implicit-def dead $scc
     84     %24:sreg_64 = S_XOR_B64 %23, %22, implicit-def dead $scc
     85     $exec = S_MOV_B64_term killed %23
     86     SI_MASK_BRANCH %bb.7, implicit $exec
     87     S_BRANCH %bb.18
     88 
     89   bb.7:
     90     successors: %bb.6(0x40000000), %bb.8(0x40000000)
     91     $exec = S_OR_B64 $exec, %24, implicit-def $scc
     92     %25:vreg_128 = COPY killed %21
     93     %26:vreg_128 = COPY killed %20
     94     %27:sreg_64 = COPY killed %19
     95     %28:sreg_64 = S_OR_B64 %24, killed %27, implicit-def dead $scc
     96     %5:sreg_64 = COPY %28
     97     %6:vreg_128 = COPY killed %25
     98     $exec = S_ANDN2_B64_term $exec, %28
     99     S_CBRANCH_EXECNZ %bb.6, implicit $exec
    100     S_BRANCH %bb.8
    101 
    102   bb.8:
    103     successors: %bb.5(0x80000000)
    104     $exec = S_OR_B64 $exec, killed %28, implicit-def $scc
    105     %29:vreg_128 = COPY killed %26
    106     %1:vreg_128 = COPY killed %29
    107     S_BRANCH %bb.5
    108 
    109   bb.9:
    110     successors: %bb.10(0x80000000)
    111     %30:vreg_128 = COPY killed %0
    112     S_BRANCH %bb.10
    113 
    114   bb.10:
    115     successors: %bb.12(0x40000000), %bb.11(0x40000000)
    116     S_CBRANCH_SCC0 %bb.12, implicit undef $scc
    117 
    118   bb.11:
    119     successors: %bb.14(0x80000000)
    120     %31:vreg_128 = IMPLICIT_DEF
    121     S_BRANCH %bb.14
    122 
    123   bb.12:
    124     successors: %bb.13(0x80000000)
    125     S_CBRANCH_SCC1 %bb.13, implicit undef $scc
    126     S_BRANCH %bb.13
    127 
    128   bb.13:
    129     successors: %bb.14(0x80000000)
    130     %32:vgpr_32 = V_MUL_F32_e32 undef %33:vgpr_32, killed %30.sub1, implicit $exec
    131     %34:vgpr_32 = V_MUL_F32_e32 undef %35:vgpr_32, killed %32, implicit $exec
    132     undef %36.sub0:vreg_128 = COPY %34
    133     %31:vreg_128 = COPY killed %36
    134 
    135   bb.14:
    136     successors: %bb.16(0x40000000), %bb.15(0x40000000)
    137     %37:vreg_128 = COPY killed %31
    138     S_CBRANCH_SCC0 %bb.16, implicit undef $scc
    139 
    140   bb.15:
    141     successors: %bb.17(0x80000000)
    142     %38:vreg_128 = IMPLICIT_DEF
    143     S_BRANCH %bb.17
    144 
    145   bb.16:
    146     successors: %bb.17(0x80000000)
    147     %39:vgpr_32 = V_FMA_F32 0, undef %40:vgpr_32, 0, killed %37.sub0, 0, undef %41:vgpr_32, 0, 0, implicit $exec
    148     %42:vgpr_32 = V_FMA_F32 0, undef %43:vgpr_32, 0, undef %44:vgpr_32, 0, killed %39, 0, 0, implicit $exec
    149     %45:vgpr_32 = V_FMA_F32 0, undef %46:vgpr_32, 0, undef %47:vgpr_32, 0, killed %42, 0, 0, implicit $exec
    150     dead %48:vgpr_32 = V_MUL_F32_e32 undef %49:vgpr_32, killed %45, implicit $exec
    151     %50:vgpr_32 = V_MUL_F32_e32 undef %51:vgpr_32, undef %52:vgpr_32, implicit $exec
    152     undef %53.sub1:vreg_128 = COPY %50
    153     %38:vreg_128 = COPY killed %53
    154 
    155   bb.17:
    156     %54:vreg_128 = COPY killed %38
    157     %55:vgpr_32 = V_FMA_F32 0, killed %54.sub1, 0, target-flags(amdgpu-gotprel32-lo) 1056964608, 0, 1056964608, 0, 0, implicit $exec
    158     EXP 1, undef %56:vgpr_32, killed %55, undef %57:vgpr_32, undef %58:vgpr_32, -1, 0, 15, implicit $exec
    159     S_ENDPGM
    160 
    161   bb.18:
    162     successors: %bb.7(0x80000000)
    163     dead %59:vgpr_32 = V_FMA_F32 0, killed %9.sub2, 0, undef %60:vgpr_32, 0, undef %61:vgpr_32, 0, 0, implicit $exec
    164     dead %62:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN undef %63:vgpr_32, undef %64:sreg_128, undef %65:sreg_32, 0, 0, 0, 0, implicit $exec
    165     undef %66.sub1:vreg_128 = COPY %13.sub1
    166     %66.sub2:vreg_128 = COPY %13.sub2
    167     %67:sreg_64 = V_CMP_NGT_F32_e64 0, 0, 0, undef %68:vgpr_32, 0, implicit $exec
    168     %69:vgpr_32 = V_ADD_F32_e32 1065353216, undef %70:vgpr_32, implicit $exec
    169     %71:vgpr_32 = V_ADD_F32_e32 1065353216, killed %69, implicit $exec
    170     %72:sreg_64 = V_CMP_NGT_F32_e64 0, 0, 0, killed %71, 0, implicit $exec
    171     %73:sreg_64 = S_OR_B64 killed %72, killed %67, implicit-def dead $scc
    172     %74:sreg_64 = S_OR_B64 killed %73, killed %10, implicit-def dead $scc
    173     %19:sreg_64 = COPY killed %74
    174     %20:vreg_128 = COPY %66
    175     %21:vreg_128 = COPY killed %66
    176     S_BRANCH %bb.7
    177 ...
    178