Home | History | Annotate | Download | only in AMDGPU
      1 # RUN: llc -march=amdgcn %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
      2 
      3 # GCN-LABEL: name: test_madmk_reg_imm_f32
      4 # GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $exec
      5 ---
      6 name:            test_madmk_reg_imm_f32
      7 registers:
      8   - { id: 0, class: vreg_64 }
      9   - { id: 1, class: vgpr_32 }
     10   - { id: 2, class: vgpr_32 }
     11   - { id: 3, class: vgpr_32 }
     12 body:             |
     13   bb.0:
     14 
     15     %0 = IMPLICIT_DEF
     16     %1 = COPY %0.sub1
     17     %2 = V_MOV_B32_e32 1078523331, implicit $exec
     18     %3 = V_MAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $exec
     19 
     20 ...
     21 
     22 # GCN-LABEL: name: test_madmk_imm_reg_f32
     23 # GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $exec
     24 ---
     25 name:            test_madmk_imm_reg_f32
     26 registers:
     27   - { id: 0, class: vreg_64 }
     28   - { id: 1, class: vgpr_32 }
     29   - { id: 2, class: vgpr_32 }
     30   - { id: 3, class: vgpr_32 }
     31 body:             |
     32   bb.0:
     33 
     34     %0 = IMPLICIT_DEF
     35     %1 = COPY %0.sub1
     36     %2 = V_MOV_B32_e32 1078523331, implicit $exec
     37     %3 = V_MAC_F32_e32 %2, killed %0.sub0, killed %1, implicit $exec
     38 
     39 ...
     40 
     41 # GCN-LABEL: name: test_madak_f32
     42 # GCN: V_MADAK_F32 killed %0.sub0, %0.sub1, 1078523331, implicit $exec
     43 ---
     44 name:            test_madak_f32
     45 registers:
     46   - { id: 0, class: vreg_64 }
     47   - { id: 1, class: vgpr_32 }
     48   - { id: 2, class: vgpr_32 }
     49 body:             |
     50   bb.0:
     51 
     52     %0 = IMPLICIT_DEF
     53     %1 = V_MOV_B32_e32 1078523331, implicit $exec
     54     %2 = V_MAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $exec
     55 
     56 ...
     57 
     58 # GCN-LABEL: name: test_madmk_reg_imm_f16
     59 # GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $exec
     60 ---
     61 name:            test_madmk_reg_imm_f16
     62 registers:
     63   - { id: 0, class: vreg_64 }
     64   - { id: 1, class: vgpr_32 }
     65   - { id: 2, class: vgpr_32 }
     66   - { id: 3, class: vgpr_32 }
     67 body:             |
     68   bb.0:
     69 
     70     %0 = IMPLICIT_DEF
     71     %1 = COPY %0.sub1
     72     %2 = V_MOV_B32_e32 1078523331, implicit $exec
     73     %3 = V_MAC_F16_e32 killed %0.sub0, %2, killed %1, implicit $exec
     74 
     75 ...
     76 
     77 # GCN-LABEL: name: test_madmk_imm_reg_f16
     78 # GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $exec
     79 ---
     80 name:            test_madmk_imm_reg_f16
     81 registers:
     82   - { id: 0, class: vreg_64 }
     83   - { id: 1, class: vgpr_32 }
     84   - { id: 2, class: vgpr_32 }
     85   - { id: 3, class: vgpr_32 }
     86 body:             |
     87   bb.0:
     88 
     89     %0 = IMPLICIT_DEF
     90     %1 = COPY %0.sub1
     91     %2 = V_MOV_B32_e32 1078523331, implicit $exec
     92     %3 = V_MAC_F16_e32 %2, killed %0.sub0, killed %1, implicit $exec
     93 
     94 ...
     95 
     96 # GCN-LABEL: name: test_madak_f16
     97 # GCN: V_MADAK_F16 killed %0.sub0, %0.sub1, 1078523331, implicit $exec
     98 ---
     99 name:            test_madak_f16
    100 registers:
    101   - { id: 0, class: vreg_64 }
    102   - { id: 1, class: vgpr_32 }
    103   - { id: 2, class: vgpr_32 }
    104 body:             |
    105   bb.0:
    106 
    107     %0 = IMPLICIT_DEF
    108     %1 = V_MOV_B32_e32 1078523331, implicit $exec
    109     %2 = V_MAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $exec
    110 ...
    111 
    112 # Make sure constant bus restriction isn't violated if src0 is an SGPR.
    113 
    114 # GCN-LABEL: name: test_madak_sgpr_src0_f32
    115 # GCN: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
    116 # GCN: %2:vgpr_32 = V_MAD_F32 0, killed %0, 0, %1, 0, %3:vgpr_32, 0, 0, implicit $exec
    117 
    118 ---
    119 name:            test_madak_sgpr_src0_f32
    120 registers:
    121   - { id: 0, class: sreg_32_xm0 }
    122   - { id: 1, class: vgpr_32}
    123   - { id: 2, class: vgpr_32 }
    124   - { id: 3, class: vgpr_32 }
    125 body:             |
    126   bb.0:
    127 
    128     %0 = IMPLICIT_DEF
    129     %1 = V_MOV_B32_e32 1078523331, implicit $exec
    130     %2 = V_MAC_F32_e32 killed %0, %1, %3, implicit $exec
    131 
    132 ...
    133 
    134 # This can still fold if this is an inline immediate.
    135 
    136 # GCN-LABEL: name: test_madak_inlineimm_src0_f32
    137 # GCN: %1:vgpr_32 = V_MADMK_F32 1073741824, 1078523331, %2:vgpr_32, implicit $exec
    138 
    139 ---
    140 name:            test_madak_inlineimm_src0_f32
    141 registers:
    142   - { id: 0, class: vgpr_32}
    143   - { id: 1, class: vgpr_32 }
    144   - { id: 2, class: vgpr_32 }
    145 body:             |
    146   bb.0:
    147 
    148     %0 = V_MOV_B32_e32 1078523331, implicit $exec
    149     %1 = V_MAC_F32_e32 1073741824, %0, %2, implicit $exec
    150 
    151 ...
    152 # Non-inline immediate uses constant bus already.
    153 
    154 # GCN-LABEL: name: test_madak_otherimm_src0_f32
    155 # GCN: %1:vgpr_32 = V_MAC_F32_e32 1120403456, %0, %1, implicit $exec
    156 
    157 ---
    158 name:            test_madak_otherimm_src0_f32
    159 registers:
    160   - { id: 0, class: vgpr_32}
    161   - { id: 1, class: vgpr_32 }
    162   - { id: 2, class: vgpr_32 }
    163 body:             |
    164   bb.0:
    165 
    166     %0 = V_MOV_B32_e32 1078523331, implicit $exec
    167     %1 = V_MAC_F32_e32 1120403456, %0, %2, implicit $exec
    168 
    169 ...
    170 # Non-inline immediate uses constant bus already.
    171 
    172 # GCN-LABEL: name: test_madak_other_constantlike_src0_f32
    173 # GCN: %1:vgpr_32 = V_MAC_F32_e32 %stack.0, %0, %1, implicit $exec
    174 ---
    175 name:            test_madak_other_constantlike_src0_f32
    176 registers:
    177   - { id: 0, class: vgpr_32}
    178   - { id: 1, class: vgpr_32 }
    179   - { id: 2, class: vgpr_32 }
    180 stack:
    181   - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
    182       callee-saved-register: '', local-offset: 0, debug-info-variable: '',
    183       debug-info-expression: '', debug-info-location: '' }
    184 body:             |
    185   bb.0:
    186 
    187     %0 = V_MOV_B32_e32 1078523331, implicit $exec
    188     %1 = V_MAC_F32_e32 %stack.0, %0, %2, implicit $exec
    189 
    190 ...
    191