Home | History | Annotate | Download | only in AMDGPU
      1 # RUN: llc -mtriple=amdgcn--amdhsa -mcpu=hawaii -verify-machineinstrs -run-pass si-fold-operands,dead-mi-elimination -o - %s | FileCheck -check-prefix=GCN %s
      2 ...
      3 
      4 # GCN-LABEL: name: s_fold_and_imm_regimm_32{{$}}
      5 # GCN: %10:vgpr_32 = V_MOV_B32_e32 1543, implicit $exec
      6 # GCN: BUFFER_STORE_DWORD_OFFSET killed %10,
      7 name:            s_fold_and_imm_regimm_32
      8 alignment:       0
      9 exposesReturnsTwice: false
     10 legalized:       false
     11 regBankSelected: false
     12 selected:        false
     13 tracksRegLiveness: true
     14 registers:
     15   - { id: 0, class: sgpr_64 }
     16   - { id: 1, class: sreg_64_xexec }
     17   - { id: 2, class: sreg_32_xm0 }
     18   - { id: 3, class: sreg_32_xm0 }
     19   - { id: 4, class: sreg_32_xm0 }
     20   - { id: 5, class: sreg_32_xm0 }
     21   - { id: 6, class: sreg_128 }
     22   - { id: 7, class: sreg_32_xm0 }
     23   - { id: 8, class: sreg_32_xm0 }
     24   - { id: 9, class: sreg_32_xm0 }
     25   - { id: 10, class: vgpr_32 }
     26 liveins:
     27   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
     28 frameInfo:
     29   isFrameAddressTaken: false
     30   isReturnAddressTaken: false
     31   hasStackMap:     false
     32   hasPatchPoint:   false
     33   stackSize:       0
     34   offsetAdjustment: 0
     35   maxAlignment:    0
     36   adjustsStack:    false
     37   hasCalls:        false
     38   maxCallFrameSize: 0
     39   hasOpaqueSPAdjustment: false
     40   hasVAStart:      false
     41   hasMustTailInVarArgFunc: false
     42 body:             |
     43   bb.0:
     44     liveins: $sgpr0_sgpr1
     45 
     46     %0 = COPY $sgpr0_sgpr1
     47     %1 = S_LOAD_DWORDX2_IMM %0, 36, 0
     48     %2 = COPY %1.sub1
     49     %3 = COPY %1.sub0
     50     %4 = S_MOV_B32 61440
     51     %5 = S_MOV_B32 -1
     52     %6 = REG_SEQUENCE killed %2, 1, killed %3, 2, killed %4, 3, killed %5, 4
     53     %7 = S_MOV_B32 1234567
     54     %8 = S_MOV_B32 9999
     55     %9 = S_AND_B32 killed %7, killed %8, implicit-def dead $scc
     56     %10 = COPY %9
     57     BUFFER_STORE_DWORD_OFFSET killed %10, killed %6, 0, 0, 0, 0, 0, implicit $exec
     58     S_ENDPGM
     59 
     60 ...
     61 ---
     62 
     63 # GCN-LABEL: name: v_fold_and_imm_regimm_32{{$}}
     64 
     65 # GCN: %9:vgpr_32 = V_MOV_B32_e32 646, implicit $exec
     66 # GCN: FLAT_STORE_DWORD %19, %9,
     67 
     68 # GCN: %10:vgpr_32 = V_MOV_B32_e32 646, implicit $exec
     69 # GCN: FLAT_STORE_DWORD %19, %10
     70 
     71 # GCN: %11:vgpr_32 = V_MOV_B32_e32 646, implicit $exec
     72 # GCN: FLAT_STORE_DWORD %19, %11,
     73 
     74 # GCN: %12:vgpr_32 = V_MOV_B32_e32 1234567, implicit $exec
     75 # GCN: FLAT_STORE_DWORD %19, %12,
     76 
     77 # GCN: %13:vgpr_32 = V_MOV_B32_e32 63, implicit $exec
     78 # GCN: FLAT_STORE_DWORD %19, %13,
     79 
     80 name:            v_fold_and_imm_regimm_32
     81 alignment:       0
     82 exposesReturnsTwice: false
     83 legalized:       false
     84 regBankSelected: false
     85 selected:        false
     86 tracksRegLiveness: true
     87 registers:
     88   - { id: 0, class: sgpr_64 }
     89   - { id: 1, class: sreg_32_xm0 }
     90   - { id: 2, class: sgpr_32 }
     91   - { id: 3, class: vgpr_32 }
     92   - { id: 4, class: sreg_64_xexec }
     93   - { id: 20, class: sreg_32_xm0 }
     94   - { id: 24, class: vgpr_32 }
     95   - { id: 25, class: vreg_64 }
     96   - { id: 26, class: sreg_32_xm0 }
     97   - { id: 27, class: vgpr_32 }
     98   - { id: 28, class: vgpr_32 }
     99   - { id: 29, class: vgpr_32 }
    100   - { id: 30, class: vgpr_32 }
    101   - { id: 31, class: vgpr_32 }
    102   - { id: 32, class: vreg_64 }
    103   - { id: 33, class: vreg_64 }
    104   - { id: 34, class: vgpr_32 }
    105   - { id: 35, class: vgpr_32 }
    106   - { id: 36, class: vgpr_32 }
    107   - { id: 37, class: vreg_64 }
    108   - { id: 44, class: vgpr_32 }
    109 
    110 liveins:
    111   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    112   - { reg: '$vgpr0', virtual-reg: '%3' }
    113 frameInfo:
    114   isFrameAddressTaken: false
    115   isReturnAddressTaken: false
    116   hasStackMap:     false
    117   hasPatchPoint:   false
    118   stackSize:       0
    119   offsetAdjustment: 0
    120   maxAlignment:    0
    121   adjustsStack:    false
    122   hasCalls:        false
    123   maxCallFrameSize: 0
    124   hasOpaqueSPAdjustment: false
    125   hasVAStart:      false
    126   hasMustTailInVarArgFunc: false
    127 body:             |
    128   bb.0:
    129     liveins: $sgpr0_sgpr1, $vgpr0
    130 
    131     %3 = COPY $vgpr0
    132     %0 = COPY $sgpr0_sgpr1
    133     %4 = S_LOAD_DWORDX2_IMM %0, 36, 0
    134     %31 = V_ASHRREV_I32_e64 31, %3, implicit $exec
    135     %32 = REG_SEQUENCE %3, 1, %31, 2
    136     %33 = V_LSHLREV_B64 2, killed %32, implicit $exec
    137     %20 = COPY %4.sub1
    138     %44 = V_ADD_I32_e32 %4.sub0, %33.sub0, implicit-def $vcc, implicit $exec
    139     %36 = COPY killed %20
    140     %35 = V_ADDC_U32_e32 %33.sub1, %36, implicit-def $vcc, implicit $vcc, implicit $exec
    141     %37 = REG_SEQUENCE %44, 1, killed %35, 2
    142     %24 = V_MOV_B32_e32 982, implicit $exec
    143     %26 = S_MOV_B32 1234567
    144     %34 = V_MOV_B32_e32 63, implicit $exec
    145 
    146     %27 = V_AND_B32_e64 %26, %24, implicit $exec
    147     FLAT_STORE_DWORD %37, %27, 0, 0, 0, implicit $exec, implicit $flat_scr
    148 
    149     %28 = V_AND_B32_e64 %24, %26, implicit $exec
    150     FLAT_STORE_DWORD %37, %28, 0, 0, 0, implicit $exec, implicit $flat_scr
    151 
    152     %29 = V_AND_B32_e32 %26, %24, implicit $exec
    153     FLAT_STORE_DWORD %37, %29, 0, 0, 0, implicit $exec, implicit $flat_scr
    154 
    155     %30 = V_AND_B32_e64 %26, %26, implicit $exec
    156     FLAT_STORE_DWORD %37, %30, 0, 0, 0, implicit $exec, implicit $flat_scr
    157 
    158     %31 = V_AND_B32_e64 %34, %34, implicit $exec
    159     FLAT_STORE_DWORD %37, %31, 0, 0, 0, implicit $exec, implicit $flat_scr
    160 
    161     S_ENDPGM
    162 
    163 ...
    164 ---
    165 
    166 # GCN-LABEL: name: s_fold_shl_imm_regimm_32{{$}}
    167 # GC1: %13 = V_MOV_B32_e32 4096, implicit $exec
    168 # GCN: BUFFER_STORE_DWORD_OFFSET killed %13,
    169 
    170 name:            s_fold_shl_imm_regimm_32
    171 alignment:       0
    172 exposesReturnsTwice: false
    173 legalized:       false
    174 regBankSelected: false
    175 selected:        false
    176 tracksRegLiveness: true
    177 registers:
    178   - { id: 0, class: sgpr_64 }
    179   - { id: 1, class: sreg_32_xm0 }
    180   - { id: 2, class: sgpr_32 }
    181   - { id: 3, class: vgpr_32 }
    182   - { id: 4, class: sreg_64_xexec }
    183   - { id: 5, class: sreg_32_xm0_xexec }
    184   - { id: 6, class: sreg_32_xm0 }
    185   - { id: 7, class: sreg_32_xm0 }
    186   - { id: 8, class: sreg_32_xm0 }
    187   - { id: 9, class: sreg_32_xm0 }
    188   - { id: 10, class: sreg_128 }
    189   - { id: 11, class: sreg_32_xm0 }
    190   - { id: 12, class: sreg_32_xm0 }
    191   - { id: 13, class: vgpr_32 }
    192 liveins:
    193   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    194 frameInfo:
    195   isFrameAddressTaken: false
    196   isReturnAddressTaken: false
    197   hasStackMap:     false
    198   hasPatchPoint:   false
    199   stackSize:       0
    200   offsetAdjustment: 0
    201   maxAlignment:    0
    202   adjustsStack:    false
    203   hasCalls:        false
    204   maxCallFrameSize: 0
    205   hasOpaqueSPAdjustment: false
    206   hasVAStart:      false
    207   hasMustTailInVarArgFunc: false
    208 body:             |
    209   bb.0:
    210     liveins: $sgpr0_sgpr1
    211 
    212     %0 = COPY $sgpr0_sgpr1
    213     %4 = S_LOAD_DWORDX2_IMM %0, 36, 0
    214     %5 = S_MOV_B32 1
    215     %6 = COPY %4.sub1
    216     %7 = COPY %4.sub0
    217     %8 = S_MOV_B32 61440
    218     %9 = S_MOV_B32 -1
    219     %10 = REG_SEQUENCE killed %7, 1, killed %6, 2, killed %9, 3, killed %8, 4
    220     %12 = S_LSHL_B32 killed %5, 12, implicit-def dead $scc
    221     %13 = COPY %12
    222     BUFFER_STORE_DWORD_OFFSET killed %13, killed %10, 0, 0, 0, 0, 0, implicit $exec
    223     S_ENDPGM
    224 
    225 ...
    226 ---
    227 # GCN-LABEL: name: v_fold_shl_imm_regimm_32{{$}}
    228 
    229 # GCN: %11:vgpr_32 = V_MOV_B32_e32 40955904, implicit $exec
    230 # GCN: FLAT_STORE_DWORD %20, %11,
    231 
    232 # GCN: %12:vgpr_32 = V_MOV_B32_e32 24, implicit $exec
    233 # GCN: FLAT_STORE_DWORD %20, %12,
    234 
    235 # GCN: %13:vgpr_32 = V_MOV_B32_e32 4096, implicit $exec
    236 # GCN: FLAT_STORE_DWORD %20, %13,
    237 
    238 # GCN: %14:vgpr_32 = V_MOV_B32_e32 24, implicit $exec
    239 # GCN: FLAT_STORE_DWORD %20, %14,
    240 
    241 # GCN: %15:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
    242 # GCN: FLAT_STORE_DWORD %20, %15,
    243 
    244 # GCN: %22:vgpr_32 = V_MOV_B32_e32 4096, implicit $exec
    245 # GCN: FLAT_STORE_DWORD %20, %22,
    246 
    247 # GCN: %23:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
    248 # GCN: FLAT_STORE_DWORD %20, %23,
    249 
    250 # GCN: %25:vgpr_32 = V_MOV_B32_e32 2, implicit $exec
    251 # GCN: FLAT_STORE_DWORD %20, %25,
    252 
    253 # GCN: %26:vgpr_32 = V_MOV_B32_e32 7927808, implicit $exec
    254 # GCN: FLAT_STORE_DWORD %20, %26,
    255 
    256 # GCN: %28:vgpr_32 = V_MOV_B32_e32 -8, implicit $exec
    257 # GCN: FLAT_STORE_DWORD %20, %28,
    258 
    259 name:            v_fold_shl_imm_regimm_32
    260 alignment:       0
    261 exposesReturnsTwice: false
    262 legalized:       false
    263 regBankSelected: false
    264 selected:        false
    265 tracksRegLiveness: true
    266 registers:
    267   - { id: 0, class: sgpr_64 }
    268   - { id: 1, class: sreg_32_xm0 }
    269   - { id: 2, class: vgpr_32 }
    270   - { id: 3, class: sreg_64_xexec }
    271   - { id: 4, class: sreg_64_xexec }
    272   - { id: 5, class: sreg_32_xm0 }
    273   - { id: 6, class: vgpr_32 }
    274   - { id: 7, class: sreg_32_xm0 }
    275   - { id: 8, class: sreg_64 }
    276   - { id: 9, class: sreg_32_xm0 }
    277   - { id: 10, class: vgpr_32 }
    278   - { id: 11, class: vgpr_32 }
    279   - { id: 12, class: vgpr_32 }
    280   - { id: 13, class: vgpr_32 }
    281   - { id: 14, class: vgpr_32 }
    282   - { id: 15, class: vgpr_32 }
    283   - { id: 16, class: vreg_64 }
    284   - { id: 17, class: vreg_64 }
    285   - { id: 18, class: vgpr_32 }
    286   - { id: 19, class: vgpr_32 }
    287   - { id: 20, class: vreg_64 }
    288   - { id: 21, class: vgpr_32 }
    289   - { id: 22, class: vgpr_32 }
    290   - { id: 23, class: vgpr_32 }
    291   - { id: 24, class: vgpr_32 }
    292   - { id: 25, class: vgpr_32 }
    293   - { id: 26, class: vgpr_32 }
    294   - { id: 27, class: sreg_32_xm0 }
    295   - { id: 28, class: vgpr_32 }
    296 liveins:
    297   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    298   - { reg: '$vgpr0', virtual-reg: '%2' }
    299 frameInfo:
    300   isFrameAddressTaken: false
    301   isReturnAddressTaken: false
    302   hasStackMap:     false
    303   hasPatchPoint:   false
    304   stackSize:       0
    305   offsetAdjustment: 0
    306   maxAlignment:    0
    307   adjustsStack:    false
    308   hasCalls:        false
    309   maxCallFrameSize: 0
    310   hasOpaqueSPAdjustment: false
    311   hasVAStart:      false
    312   hasMustTailInVarArgFunc: false
    313 body:             |
    314   bb.0:
    315     liveins: $sgpr0_sgpr1, $vgpr0
    316 
    317     %2 = COPY $vgpr0
    318     %0 = COPY $sgpr0_sgpr1
    319     %3 = S_LOAD_DWORDX2_IMM %0, 36, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
    320     %15 = V_ASHRREV_I32_e64 31, %2, implicit $exec
    321     %16 = REG_SEQUENCE %2, 1, %15, 2
    322     %17 = V_LSHLREV_B64 2, killed %16, implicit $exec
    323     %9 = COPY %3.sub1
    324     %21 = V_ADD_I32_e32 %3.sub0, %17.sub0, implicit-def $vcc, implicit $exec
    325     %19 = COPY killed %9
    326     %18 = V_ADDC_U32_e32 %17.sub1, %19, implicit-def $vcc, implicit $vcc, implicit $exec
    327     %20 = REG_SEQUENCE %21, 1, killed %18, 2
    328     %10 = V_MOV_B32_e32 9999, implicit $exec
    329     %24 = V_MOV_B32_e32 3871, implicit $exec
    330     %6 = V_MOV_B32_e32 1, implicit $exec
    331     %7 = S_MOV_B32 1
    332     %27 = S_MOV_B32 -4
    333 
    334     %11 = V_LSHLREV_B32_e64 12, %10, implicit $exec
    335     FLAT_STORE_DWORD %20, %11, 0, 0, 0, implicit $exec, implicit $flat_scr
    336 
    337     %12 = V_LSHLREV_B32_e64 %7, 12, implicit $exec
    338     FLAT_STORE_DWORD %20, %12, 0, 0, 0, implicit $exec, implicit $flat_scr
    339 
    340     %13 = V_LSHL_B32_e64 %7, 12, implicit $exec
    341     FLAT_STORE_DWORD %20, %13, 0, 0, 0, implicit $exec, implicit $flat_scr
    342 
    343     %14 = V_LSHL_B32_e64 12, %7, implicit $exec
    344     FLAT_STORE_DWORD %20, %14, 0, 0, 0, implicit $exec, implicit $flat_scr
    345 
    346     %15 = V_LSHL_B32_e64 12, %24, implicit $exec
    347     FLAT_STORE_DWORD %20, %15, 0, 0, 0, implicit $exec, implicit $flat_scr
    348 
    349     %22 = V_LSHL_B32_e64 %6, 12, implicit $exec
    350     FLAT_STORE_DWORD %20, %22, 0, 0, 0, implicit $exec, implicit $flat_scr
    351 
    352     %23 = V_LSHL_B32_e64 %6, 32, implicit $exec
    353     FLAT_STORE_DWORD %20, %23, 0, 0, 0, implicit $exec, implicit $flat_scr
    354 
    355     %25 = V_LSHL_B32_e32 %6, %6, implicit $exec
    356     FLAT_STORE_DWORD %20, %25, 0, 0, 0, implicit $exec, implicit $flat_scr
    357 
    358     %26 = V_LSHLREV_B32_e32 11, %24, implicit $exec
    359     FLAT_STORE_DWORD %20, %26, 0, 0, 0, implicit $exec, implicit $flat_scr
    360 
    361     %28 = V_LSHL_B32_e32 %27, %6, implicit $exec
    362     FLAT_STORE_DWORD %20, %28, 0, 0, 0, implicit $exec, implicit $flat_scr
    363 
    364     S_ENDPGM
    365 
    366 ...
    367 ---
    368 
    369 # GCN-LABEL: name: s_fold_ashr_imm_regimm_32{{$}}
    370 # GCN: %11:vgpr_32 = V_MOV_B32_e32 243, implicit $exec
    371 # GCN: BUFFER_STORE_DWORD_OFFSET killed %11, killed %8,
    372 name:            s_fold_ashr_imm_regimm_32
    373 alignment:       0
    374 exposesReturnsTwice: false
    375 legalized:       false
    376 regBankSelected: false
    377 selected:        false
    378 tracksRegLiveness: true
    379 registers:
    380   - { id: 0, class: sgpr_64 }
    381   - { id: 1, class: sreg_32_xm0 }
    382   - { id: 4, class: sreg_64_xexec }
    383   - { id: 5, class: sreg_32_xm0_xexec }
    384   - { id: 6, class: sreg_32_xm0 }
    385   - { id: 7, class: sreg_32_xm0 }
    386   - { id: 8, class: sreg_32_xm0 }
    387   - { id: 9, class: sreg_32_xm0 }
    388   - { id: 10, class: sreg_128 }
    389   - { id: 11, class: sreg_32_xm0 }
    390   - { id: 12, class: sreg_32_xm0 }
    391   - { id: 13, class: vgpr_32 }
    392 liveins:
    393   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    394 frameInfo:
    395   isFrameAddressTaken: false
    396   isReturnAddressTaken: false
    397   hasStackMap:     false
    398   hasPatchPoint:   false
    399   stackSize:       0
    400   offsetAdjustment: 0
    401   maxAlignment:    0
    402   adjustsStack:    false
    403   hasCalls:        false
    404   maxCallFrameSize: 0
    405   hasOpaqueSPAdjustment: false
    406   hasVAStart:      false
    407   hasMustTailInVarArgFunc: false
    408 body:             |
    409   bb.0:
    410     liveins: $sgpr0_sgpr1
    411 
    412     %0 = COPY $sgpr0_sgpr1
    413     %4 = S_LOAD_DWORDX2_IMM %0, 36, 0
    414     %5 = S_MOV_B32 999123
    415     %6 = COPY %4.sub1
    416     %7 = COPY %4.sub0
    417     %8 = S_MOV_B32 61440
    418     %9 = S_MOV_B32 -1
    419     %10 = REG_SEQUENCE killed %7, 1, killed %6, 2, killed %9, 3, killed %8, 4
    420     %12 = S_ASHR_I32 killed %5, 12, implicit-def dead $scc
    421     %13 = COPY %12
    422     BUFFER_STORE_DWORD_OFFSET killed %13, killed %10, 0, 0, 0, 0, 0, implicit $exec
    423     S_ENDPGM
    424 
    425 ...
    426 
    427 # GCN-LABEL: name: v_fold_ashr_imm_regimm_32{{$}}
    428 # GCN: %11:vgpr_32 = V_MOV_B32_e32 3903258, implicit $exec
    429 # GCN: FLAT_STORE_DWORD %20, %11,
    430 
    431 # GCN: %12:vgpr_32 = V_MOV_B32_e32 62452139, implicit $exec
    432 # GCN: FLAT_STORE_DWORD %20, %12,
    433 
    434 # GCN: %13:vgpr_32 = V_MOV_B32_e32 1678031, implicit $exec
    435 # GCN: FLAT_STORE_DWORD %20, %13,
    436 
    437 # GCN: %14:vgpr_32 = V_MOV_B32_e32 3, implicit $exec
    438 # GCN: FLAT_STORE_DWORD %20, %14,
    439 
    440 # GCN: %15:vgpr_32 = V_MOV_B32_e32 -1, implicit $exec
    441 # GCN: FLAT_STORE_DWORD %20, %15,
    442 
    443 # GCN: %22:vgpr_32 = V_MOV_B32_e32 62500, implicit $exec
    444 # GCN: FLAT_STORE_DWORD %20, %22,
    445 
    446 # GCN: %23:vgpr_32 = V_MOV_B32_e32 500000, implicit $exec
    447 # GCN: FLAT_STORE_DWORD %20, %23,
    448 
    449 # GCN: %25:vgpr_32 = V_MOV_B32_e32 1920, implicit $exec
    450 # GCN: FLAT_STORE_DWORD %20, %25,
    451 
    452 # GCN: %26:vgpr_32 = V_MOV_B32_e32 487907, implicit $exec
    453 # GCN: FLAT_STORE_DWORD %20, %26,
    454 
    455 # GCN: %28:vgpr_32 = V_MOV_B32_e32 -1, implicit $exec
    456 # GCN: FLAT_STORE_DWORD %20, %28,
    457 
    458 name:            v_fold_ashr_imm_regimm_32
    459 alignment:       0
    460 exposesReturnsTwice: false
    461 legalized:       false
    462 regBankSelected: false
    463 selected:        false
    464 tracksRegLiveness: true
    465 registers:
    466   - { id: 0, class: sgpr_64 }
    467   - { id: 1, class: sreg_32_xm0 }
    468   - { id: 2, class: vgpr_32 }
    469   - { id: 3, class: sreg_64_xexec }
    470   - { id: 4, class: sreg_64_xexec }
    471   - { id: 5, class: sreg_32_xm0 }
    472   - { id: 6, class: vgpr_32 }
    473   - { id: 7, class: sreg_32_xm0 }
    474   - { id: 8, class: sreg_32_xm0 }
    475   - { id: 9, class: sreg_32_xm0 }
    476   - { id: 10, class: vgpr_32 }
    477   - { id: 11, class: vgpr_32 }
    478   - { id: 12, class: vgpr_32 }
    479   - { id: 13, class: vgpr_32 }
    480   - { id: 14, class: vgpr_32 }
    481   - { id: 15, class: vgpr_32 }
    482   - { id: 16, class: vreg_64 }
    483   - { id: 17, class: vreg_64 }
    484   - { id: 18, class: vgpr_32 }
    485   - { id: 19, class: vgpr_32 }
    486   - { id: 20, class: vreg_64 }
    487   - { id: 21, class: vgpr_32 }
    488   - { id: 22, class: vgpr_32 }
    489   - { id: 23, class: vgpr_32 }
    490   - { id: 24, class: vgpr_32 }
    491   - { id: 25, class: vgpr_32 }
    492   - { id: 26, class: vgpr_32 }
    493   - { id: 27, class: sreg_32_xm0 }
    494   - { id: 28, class: vgpr_32 }
    495   - { id: 32, class: sreg_32_xm0 }
    496   - { id: 33, class: sreg_32_xm0 }
    497   - { id: 34, class: vgpr_32 }
    498   - { id: 35, class: vgpr_32 }
    499 liveins:
    500   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    501   - { reg: '$vgpr0', virtual-reg: '%2' }
    502 frameInfo:
    503   isFrameAddressTaken: false
    504   isReturnAddressTaken: false
    505   hasStackMap:     false
    506   hasPatchPoint:   false
    507   stackSize:       0
    508   offsetAdjustment: 0
    509   maxAlignment:    0
    510   adjustsStack:    false
    511   hasCalls:        false
    512   maxCallFrameSize: 0
    513   hasOpaqueSPAdjustment: false
    514   hasVAStart:      false
    515   hasMustTailInVarArgFunc: false
    516 body:             |
    517   bb.0:
    518     liveins: $sgpr0_sgpr1, $vgpr0
    519 
    520     %2 = COPY $vgpr0
    521     %0 = COPY $sgpr0_sgpr1
    522     %3 = S_LOAD_DWORDX2_IMM %0, 36, 0
    523     %15 = V_ASHRREV_I32_e64 31, %2, implicit $exec
    524     %16 = REG_SEQUENCE %2, 1, %15, 2
    525     %17 = V_LSHLREV_B64 2, killed %16, implicit $exec
    526     %9 = COPY %3.sub1
    527     %21 = V_ADD_I32_e32 %3.sub0, %17.sub0, implicit-def $vcc, implicit $exec
    528     %19 = COPY killed %9
    529     %18 = V_ADDC_U32_e32 %17.sub1, %19, implicit-def $vcc, implicit $vcc, implicit $exec
    530     %20 = REG_SEQUENCE %21, 1, killed %18, 2
    531     %10 = V_MOV_B32_e32 999234234, implicit $exec
    532     %24 = V_MOV_B32_e32 3871, implicit $exec
    533     %6 = V_MOV_B32_e32 1000000, implicit $exec
    534     %7 = S_MOV_B32 13424252
    535     %8 = S_MOV_B32 4
    536     %27 = S_MOV_B32 -4
    537     %32 = S_MOV_B32 1
    538     %33 = S_MOV_B32 3841
    539     %34 = V_MOV_B32_e32 3841, implicit $exec
    540     %35 = V_MOV_B32_e32 2, implicit $exec
    541 
    542     %11 = V_ASHRREV_I32_e64 8, %10, implicit $exec
    543     FLAT_STORE_DWORD %20, %11, 0, 0, 0, implicit $exec, implicit $flat_scr
    544 
    545     %12 = V_ASHRREV_I32_e64 %8, %10, implicit $exec
    546     FLAT_STORE_DWORD %20, %12, 0, 0, 0, implicit $exec, implicit $flat_scr
    547 
    548     %13 = V_ASHR_I32_e64 %7, 3, implicit $exec
    549     FLAT_STORE_DWORD %20, %13, 0, 0, 0, implicit $exec, implicit $flat_scr
    550 
    551     %14 = V_ASHR_I32_e64 7, %32, implicit $exec
    552     FLAT_STORE_DWORD %20, %14, 0, 0, 0, implicit $exec, implicit $flat_scr
    553 
    554     %15 = V_ASHR_I32_e64 %27, %24, implicit $exec
    555     FLAT_STORE_DWORD %20, %15, 0, 0, 0, implicit $exec, implicit $flat_scr
    556 
    557     %22 = V_ASHR_I32_e64 %6, 4, implicit $exec
    558     FLAT_STORE_DWORD %20, %22, 0, 0, 0, implicit $exec, implicit $flat_scr
    559 
    560     %23 = V_ASHR_I32_e64 %6, %33, implicit $exec
    561     FLAT_STORE_DWORD %20, %23, 0, 0, 0, implicit $exec, implicit $flat_scr
    562 
    563     %25 = V_ASHR_I32_e32 %34, %34, implicit $exec
    564     FLAT_STORE_DWORD %20, %25, 0, 0, 0, implicit $exec, implicit $flat_scr
    565 
    566     %26 = V_ASHRREV_I32_e32 11, %10, implicit $exec
    567     FLAT_STORE_DWORD %20, %26, 0, 0, 0, implicit $exec, implicit $flat_scr
    568 
    569     %28 = V_ASHR_I32_e32 %27, %35, implicit $exec
    570     FLAT_STORE_DWORD %20, %28, 0, 0, 0, implicit $exec, implicit $flat_scr
    571 
    572     S_ENDPGM
    573 
    574 ...
    575 ---
    576 
    577 # GCN-LABEL: name: s_fold_lshr_imm_regimm_32{{$}}
    578 # GCN: %11:vgpr_32 = V_MOV_B32_e32 1048332, implicit $exec
    579 # GCN: BUFFER_STORE_DWORD_OFFSET killed %11, killed %8,
    580 name:            s_fold_lshr_imm_regimm_32
    581 alignment:       0
    582 exposesReturnsTwice: false
    583 legalized:       false
    584 regBankSelected: false
    585 selected:        false
    586 tracksRegLiveness: true
    587 registers:
    588   - { id: 0, class: sgpr_64 }
    589   - { id: 1, class: sreg_32_xm0 }
    590   - { id: 4, class: sreg_64_xexec }
    591   - { id: 5, class: sreg_32_xm0_xexec }
    592   - { id: 6, class: sreg_32_xm0 }
    593   - { id: 7, class: sreg_32_xm0 }
    594   - { id: 8, class: sreg_32_xm0 }
    595   - { id: 9, class: sreg_32_xm0 }
    596   - { id: 10, class: sreg_128 }
    597   - { id: 11, class: sreg_32_xm0 }
    598   - { id: 12, class: sreg_32_xm0 }
    599   - { id: 13, class: vgpr_32 }
    600 liveins:
    601   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    602 frameInfo:
    603   isFrameAddressTaken: false
    604   isReturnAddressTaken: false
    605   hasStackMap:     false
    606   hasPatchPoint:   false
    607   stackSize:       0
    608   offsetAdjustment: 0
    609   maxAlignment:    0
    610   adjustsStack:    false
    611   hasCalls:        false
    612   maxCallFrameSize: 0
    613   hasOpaqueSPAdjustment: false
    614   hasVAStart:      false
    615   hasMustTailInVarArgFunc: false
    616 body:             |
    617   bb.0:
    618     liveins: $sgpr0_sgpr1
    619 
    620     %0 = COPY $sgpr0_sgpr1
    621     %4 = S_LOAD_DWORDX2_IMM %0, 36, 0
    622     %5 = S_MOV_B32 -999123
    623     %6 = COPY %4.sub1
    624     %7 = COPY %4.sub0
    625     %8 = S_MOV_B32 61440
    626     %9 = S_MOV_B32 -1
    627     %10 = REG_SEQUENCE killed %7, 1, killed %6, 2, killed %9, 3, killed %8, 4
    628     %12 = S_LSHR_B32 killed %5, 12, implicit-def dead $scc
    629     %13 = COPY %12
    630     BUFFER_STORE_DWORD_OFFSET killed %13, killed %10, 0, 0, 0, 0, 0, implicit $exec
    631     S_ENDPGM
    632 
    633 ...
    634 ---
    635 
    636 # GCN-LABEL: name: v_fold_lshr_imm_regimm_32{{$}}
    637 # GCN: %11:vgpr_32 = V_MOV_B32_e32 3903258, implicit $exec
    638 # GCN: FLAT_STORE_DWORD %20, %11,
    639 
    640 # GCN: %12:vgpr_32 = V_MOV_B32_e32 62452139, implicit $exec
    641 # GCN: FLAT_STORE_DWORD %20, %12,
    642 
    643 # GCN: %13:vgpr_32 = V_MOV_B32_e32 1678031, implicit $exec
    644 # GCN: FLAT_STORE_DWORD %20, %13,
    645 
    646 # GCN: %14:vgpr_32 = V_MOV_B32_e32 3, implicit $exec
    647 # GCN: FLAT_STORE_DWORD %20, %14,
    648 
    649 # GCN: %15:vgpr_32 = V_MOV_B32_e32 1, implicit $exec
    650 # GCN: FLAT_STORE_DWORD %20, %15,
    651 
    652 # GCN: %22:vgpr_32 = V_MOV_B32_e32 62500, implicit $exec
    653 # GCN: FLAT_STORE_DWORD %20, %22,
    654 
    655 # GCN: %23:vgpr_32 = V_MOV_B32_e32 500000, implicit $exec
    656 # GCN: FLAT_STORE_DWORD %20, %23,
    657 
    658 # GCN: %25:vgpr_32 = V_MOV_B32_e32 1920, implicit $exec
    659 # GCN: FLAT_STORE_DWORD %20, %25,
    660 
    661 # GCN: %26:vgpr_32 = V_MOV_B32_e32 487907, implicit $exec
    662 # GCN: FLAT_STORE_DWORD %20, %26,
    663 
    664 # GCN: %28:vgpr_32 = V_MOV_B32_e32 1073741823, implicit $exec
    665 # GCN: FLAT_STORE_DWORD %20, %28,
    666 
    667 name:            v_fold_lshr_imm_regimm_32
    668 alignment:       0
    669 exposesReturnsTwice: false
    670 legalized:       false
    671 regBankSelected: false
    672 selected:        false
    673 tracksRegLiveness: true
    674 registers:
    675   - { id: 0, class: sgpr_64 }
    676   - { id: 1, class: sreg_32_xm0 }
    677   - { id: 2, class: vgpr_32 }
    678   - { id: 3, class: sreg_64_xexec }
    679   - { id: 4, class: sreg_64_xexec }
    680   - { id: 5, class: sreg_32_xm0 }
    681   - { id: 6, class: vgpr_32 }
    682   - { id: 7, class: sreg_32_xm0 }
    683   - { id: 8, class: sreg_32_xm0 }
    684   - { id: 9, class: sreg_32_xm0 }
    685   - { id: 10, class: vgpr_32 }
    686   - { id: 11, class: vgpr_32 }
    687   - { id: 12, class: vgpr_32 }
    688   - { id: 13, class: vgpr_32 }
    689   - { id: 14, class: vgpr_32 }
    690   - { id: 15, class: vgpr_32 }
    691   - { id: 16, class: vreg_64 }
    692   - { id: 17, class: vreg_64 }
    693   - { id: 18, class: vgpr_32 }
    694   - { id: 19, class: vgpr_32 }
    695   - { id: 20, class: vreg_64 }
    696   - { id: 21, class: vgpr_32 }
    697   - { id: 22, class: vgpr_32 }
    698   - { id: 23, class: vgpr_32 }
    699   - { id: 24, class: vgpr_32 }
    700   - { id: 25, class: vgpr_32 }
    701   - { id: 26, class: vgpr_32 }
    702   - { id: 27, class: sreg_32_xm0 }
    703   - { id: 28, class: vgpr_32 }
    704   - { id: 32, class: sreg_32_xm0 }
    705   - { id: 33, class: sreg_32_xm0 }
    706   - { id: 34, class: vgpr_32 }
    707   - { id: 35, class: vgpr_32 }
    708 liveins:
    709   - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' }
    710   - { reg: '$vgpr0', virtual-reg: '%2' }
    711 frameInfo:
    712   isFrameAddressTaken: false
    713   isReturnAddressTaken: false
    714   hasStackMap:     false
    715   hasPatchPoint:   false
    716   stackSize:       0
    717   offsetAdjustment: 0
    718   maxAlignment:    0
    719   adjustsStack:    false
    720   hasCalls:        false
    721   maxCallFrameSize: 0
    722   hasOpaqueSPAdjustment: false
    723   hasVAStart:      false
    724   hasMustTailInVarArgFunc: false
    725 body:             |
    726   bb.0:
    727     liveins: $sgpr0_sgpr1, $vgpr0
    728 
    729     %2 = COPY $vgpr0
    730     %0 = COPY $sgpr0_sgpr1
    731     %3 = S_LOAD_DWORDX2_IMM %0, 36, 0
    732     %15 = V_ASHRREV_I32_e64 31, %2, implicit $exec
    733     %16 = REG_SEQUENCE %2, 1, %15, 2
    734     %17 = V_LSHLREV_B64 2, killed %16, implicit $exec
    735     %9 = COPY %3.sub1
    736     %21 = V_ADD_I32_e32 %3.sub0, %17.sub0, implicit-def $vcc, implicit $exec
    737     %19 = COPY killed %9
    738     %18 = V_ADDC_U32_e32 %17.sub1, %19, implicit-def $vcc, implicit $vcc, implicit $exec
    739     %20 = REG_SEQUENCE %21, 1, killed %18, 2
    740     %10 = V_MOV_B32_e32 999234234, implicit $exec
    741     %24 = V_MOV_B32_e32 3871, implicit $exec
    742     %6 = V_MOV_B32_e32 1000000, implicit $exec
    743     %7 = S_MOV_B32 13424252
    744     %8 = S_MOV_B32 4
    745     %27 = S_MOV_B32 -4
    746     %32 = S_MOV_B32 1
    747     %33 = S_MOV_B32 3841
    748     %34 = V_MOV_B32_e32 3841, implicit $exec
    749     %35 = V_MOV_B32_e32 2, implicit $exec
    750 
    751     %11 = V_LSHRREV_B32_e64 8, %10, implicit $exec
    752     FLAT_STORE_DWORD %20, %11, 0, 0, 0, implicit $exec, implicit $flat_scr
    753 
    754     %12 = V_LSHRREV_B32_e64 %8, %10, implicit $exec
    755     FLAT_STORE_DWORD %20, %12, 0, 0, 0, implicit $exec, implicit $flat_scr
    756 
    757     %13 = V_LSHR_B32_e64 %7, 3, implicit $exec
    758     FLAT_STORE_DWORD %20, %13, 0, 0, 0, implicit $exec, implicit $flat_scr
    759 
    760     %14 = V_LSHR_B32_e64 7, %32, implicit $exec
    761     FLAT_STORE_DWORD %20, %14, 0, 0, 0, implicit $exec, implicit $flat_scr
    762 
    763     %15 = V_LSHR_B32_e64 %27, %24, implicit $exec
    764     FLAT_STORE_DWORD %20, %15, 0, 0, 0, implicit $exec, implicit $flat_scr
    765 
    766     %22 = V_LSHR_B32_e64 %6, 4, implicit $exec
    767     FLAT_STORE_DWORD %20, %22, 0, 0, 0, implicit $exec, implicit $flat_scr
    768 
    769     %23 = V_LSHR_B32_e64 %6, %33, implicit $exec
    770     FLAT_STORE_DWORD %20, %23, 0, 0, 0, implicit $exec, implicit $flat_scr
    771 
    772     %25 = V_LSHR_B32_e32 %34, %34, implicit $exec
    773     FLAT_STORE_DWORD %20, %25, 0, 0, 0, implicit $exec, implicit $flat_scr
    774 
    775     %26 = V_LSHRREV_B32_e32 11, %10, implicit $exec
    776     FLAT_STORE_DWORD %20, %26, 0, 0, 0, implicit $exec, implicit $flat_scr
    777 
    778     %28 = V_LSHR_B32_e32 %27, %35, implicit $exec
    779     FLAT_STORE_DWORD %20, %28, 0, 0, 0, implicit $exec, implicit $flat_scr
    780 
    781     S_ENDPGM
    782 
    783 ...
    784 ---
    785 # There is only an undef use operand for %1, so there is no
    786 # corresponding defining instruction
    787 
    788 # GCN-LABEL: name: undefined_vreg_operand{{$}}
    789 # GCN: bb.0
    790 # GCN-NEXT: FLAT_STORE_DWORD undef %3:vreg_64, undef %1:vgpr_32,
    791 # GCN-NEXT: S_ENDPGM
    792 name: undefined_vreg_operand
    793 tracksRegLiveness: true
    794 registers:
    795   - { id: 0, class: vgpr_32, preferred-register: '' }
    796   - { id: 1, class: vgpr_32, preferred-register: '' }
    797   - { id: 2, class: vgpr_32, preferred-register: '' }
    798   - { id: 3, class: vreg_64, preferred-register: '' }
    799 body:             |
    800   bb.0:
    801     %0 = V_MOV_B32_e32 0, implicit $exec
    802     %2 = V_XOR_B32_e64 killed %0, undef %1, implicit $exec
    803     FLAT_STORE_DWORD undef %3, %2, 0, 0, 0, implicit $exec, implicit $flat_scr
    804     S_ENDPGM
    805 
    806 ...
    807 ---
    808 # Make sure there is no crash if one of the operands is a physical register
    809 # GCN-LABEL: name: constant_fold_physreg_op{{$}}
    810 # GCN: %3:sreg_64 = S_AND_B64 $exec, 0, implicit-def dead $scc
    811 
    812 name: constant_fold_physreg_op
    813 tracksRegLiveness: true
    814 body:             |
    815   bb.0:
    816     successors: %bb.1, %bb.3
    817     liveins: $vgpr0, $sgpr4_sgpr5
    818 
    819     %19:sreg_64 = IMPLICIT_DEF
    820     %0:sreg_64 = SI_IF killed %19, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
    821     S_BRANCH %bb.1
    822 
    823   bb.1:
    824     %6:sreg_64 = S_MOV_B64 0
    825     %7:sreg_64 = S_AND_B64 $exec, killed %6, implicit-def dead $scc
    826     $vcc = COPY %7
    827 
    828   bb.3:
    829     liveins: $vcc
    830     SI_END_CF %0, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
    831     S_ENDPGM implicit $vcc
    832 
    833 ...
    834