Home | History | Annotate | Download | only in AMDGPU
      1 # RUN: llc -march=amdgcn -verify-machineinstrs -run-pass=simple-register-coalescing,rename-independent-subregs -o - %s | FileCheck -check-prefix=GCN %s
      2 ---
      3 
      4 # GCN-LABEL: name: mac_invalid_operands
      5 # GCN: undef %18.sub0:vreg_128 = V_MAC_F32_e32 undef %3:vgpr_32, undef %9:vgpr_32, undef %18.sub0, implicit $exec
      6 
      7 name:            mac_invalid_operands
      8 alignment:       0
      9 exposesReturnsTwice: false
     10 legalized:       false
     11 regBankSelected: false
     12 selected:        false
     13 tracksRegLiveness: true
     14 registers:
     15   - { id: 0, class: vreg_128 }
     16   - { id: 1, class: vreg_128 }
     17   - { id: 2, class: sgpr_64 }
     18   - { id: 3, class: vgpr_32 }
     19   - { id: 4, class: vgpr_32 }
     20   - { id: 5, class: vgpr_32 }
     21   - { id: 6, class: vgpr_32 }
     22   - { id: 7, class: sreg_64 }
     23   - { id: 8, class: vgpr_32 }
     24   - { id: 9, class: vgpr_32 }
     25   - { id: 10, class: vreg_64 }
     26   - { id: 11, class: vreg_64 }
     27   - { id: 12, class: vreg_128 }
     28   - { id: 13, class: vreg_128 }
     29   - { id: 14, class: vgpr_32 }
     30   - { id: 15, class: vreg_64 }
     31   - { id: 16, class: vgpr_32 }
     32   - { id: 17, class: vreg_128 }
     33 body:             |
     34   bb.0:
     35     successors: %bb.2, %bb.1
     36 
     37     %7 = V_CMP_NEQ_F32_e64 0, 0, 0, undef %3, 0, implicit $exec
     38     $vcc = COPY killed %7
     39     S_CBRANCH_VCCZ %bb.2, implicit killed $vcc
     40 
     41   bb.1:
     42     successors: %bb.3
     43 
     44     %4 = V_ADD_F32_e32 undef %6, undef %5, implicit $exec
     45     undef %12.sub0 = COPY killed %4
     46     %17 = COPY killed %12
     47     S_BRANCH %bb.3
     48 
     49   bb.2:
     50     successors: %bb.3
     51 
     52     %8 = V_MAC_F32_e32 undef %3, undef %9, undef %8, implicit $exec
     53     undef %13.sub0 = COPY %8
     54     %13.sub1 = COPY %8
     55     %13.sub2 = COPY killed %8
     56     %0 = COPY killed %13
     57     %17 = COPY killed %0
     58 
     59   bb.3:
     60     %1 = COPY killed %17
     61     FLAT_STORE_DWORD undef %10, %1.sub2, 0, 0, 0, implicit $exec, implicit $flat_scr
     62     %14 = COPY %1.sub1
     63     %16 = COPY killed %1.sub0
     64     undef %15.sub0 = COPY killed %16
     65     %15.sub1 = COPY killed %14
     66     FLAT_STORE_DWORDX2 undef %11, killed %15, 0, 0, 0, implicit $exec, implicit $flat_scr
     67     S_ENDPGM
     68 
     69 ...
     70 ---
     71 # Make sure others uses after the mac are properly handled and not
     72 # left unreplaced due to iterator issues from substituteRegister.
     73 
     74 # GCN-LABEL: name: vreg_does_not_dominate
     75 
     76 # GCN: undef %8.sub1:vreg_128 = V_MAC_F32_e32 undef %2:vgpr_32, undef %1:vgpr_32, undef %8.sub1, implicit $exec
     77 # GCN: undef %7.sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
     78 # GCN: undef %9.sub2:vreg_128 = COPY %7.sub0
     79 
     80 # GCN: undef %6.sub3:vreg_128 = V_ADD_F32_e32 undef %3:vgpr_32, undef %3:vgpr_32, implicit $exec
     81 # GCN: undef %7.sub0:vreg_128 = V_ADD_F32_e64 0, 0, 0, 0, 0, 0, implicit $exec
     82 # GCN: %8.sub1:vreg_128 = V_ADD_F32_e32 %8.sub1, %8.sub1, implicit $exec
     83 
     84 # GCN: BUFFER_STORE_DWORD_OFFEN %6.sub3, %0,
     85 # GCN: BUFFER_STORE_DWORD_OFFEN %9.sub2, %0,
     86 # GCN: BUFFER_STORE_DWORD_OFFEN %8.sub1, %0,
     87 # GCN: BUFFER_STORE_DWORD_OFFEN %7.sub0, %0,
     88 name:            vreg_does_not_dominate
     89 alignment:       0
     90 exposesReturnsTwice: false
     91 legalized:       false
     92 regBankSelected: false
     93 selected:        false
     94 tracksRegLiveness: true
     95 registers:
     96   - { id: 0, class: vgpr_32, preferred-register: '' }
     97   - { id: 1, class: vgpr_32, preferred-register: '' }
     98   - { id: 2, class: vgpr_32, preferred-register: '' }
     99   - { id: 3, class: vgpr_32, preferred-register: '' }
    100   - { id: 4, class: vgpr_32, preferred-register: '' }
    101   - { id: 5, class: sreg_64, preferred-register: '' }
    102   - { id: 6, class: vreg_128, preferred-register: '' }
    103 liveins:
    104   - { reg: '$vgpr0', virtual-reg: '%0' }
    105   - { reg: '$sgpr30_sgpr31', virtual-reg: '%5' }
    106 body:             |
    107   bb.0:
    108     successors: %bb.2, %bb.1
    109     liveins: $vgpr0, $sgpr30_sgpr31, $sgpr5
    110 
    111     %5 = COPY $sgpr30_sgpr31
    112     %0 = COPY $vgpr0
    113     undef %6.sub1 = V_MAC_F32_e32 undef %2, undef %1, undef %6.sub1, implicit $exec
    114     %6.sub0 = V_MOV_B32_e32 0, implicit $exec
    115     %6.sub2 = COPY %6.sub0
    116     S_CBRANCH_VCCNZ %bb.2, implicit undef $vcc
    117     S_BRANCH %bb.1
    118 
    119   bb.1:
    120     successors: %bb.2
    121 
    122     %6.sub3 = V_ADD_F32_e32 undef %3, undef %3, implicit $exec
    123     %6.sub0 = V_ADD_F32_e64 0, 0, 0, 0, 0, 0, implicit $exec
    124     %6.sub1 = V_ADD_F32_e32 %6.sub1, %6.sub1, implicit $exec
    125     %6.sub2 = COPY %6.sub0
    126 
    127   bb.2:
    128     BUFFER_STORE_DWORD_OFFEN %6.sub3, %0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 12, 0, 0, 0, implicit $exec
    129     BUFFER_STORE_DWORD_OFFEN %6.sub2, %0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 8, 0, 0, 0, implicit $exec
    130     BUFFER_STORE_DWORD_OFFEN %6.sub1, %0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 4, 0, 0, 0, implicit $exec
    131     BUFFER_STORE_DWORD_OFFEN %6.sub0, %0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, implicit $exec
    132     $sgpr30_sgpr31 = COPY %5
    133     $sgpr5 = COPY $sgpr5
    134     S_SETPC_B64_return $sgpr30_sgpr31, implicit $sgpr5
    135 
    136 ...
    137 
    138 # GCN-LABEL: name: inf_loop_tied_operand
    139 # GCN: bb.0:
    140 # GCN-NEXT: undef %2.sub0:vreg_128 = V_MAC_F32_e32 1073741824, undef %0:vgpr_32, undef %2.sub0, implicit $exec
    141 # GCN-NEXT: dead undef %3.sub1:vreg_128 = COPY %2.sub0
    142 
    143 name:            inf_loop_tied_operand
    144 tracksRegLiveness: true
    145 registers:
    146   - { id: 0, class: vgpr_32, preferred-register: '' }
    147   - { id: 1, class: vgpr_32, preferred-register: '' }
    148   - { id: 2, class: vreg_128, preferred-register: '' }
    149 body:             |
    150   bb.0:
    151     %1 = V_MAC_F32_e32 1073741824, undef %0, undef %1, implicit $exec
    152     undef %2.sub0 = COPY %1
    153     %2.sub1 = COPY %1
    154 
    155 ...
    156