1# RUN: llc -march=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s 2# RUN: llc -march=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s 3 4# GCN-LABEL: name: test_fmamk_reg_imm_f32 5# GCN: %2:vgpr_32 = IMPLICIT_DEF 6# GCN-NOT: V_MOV_B32 7# GCN: V_FMAMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 8--- 9name: test_fmamk_reg_imm_f32 10registers: 11 - { id: 0, class: vreg_64 } 12 - { id: 1, class: vgpr_32 } 13 - { id: 2, class: vgpr_32 } 14 - { id: 3, class: vgpr_32 } 15body: | 16 bb.0: 17 18 %0 = IMPLICIT_DEF 19 %1 = COPY %0.sub1 20 %2 = V_MOV_B32_e32 1078523331, implicit $exec 21 %3 = V_FMAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec 22 23... 24 25# GCN-LABEL: name: test_fmamk_imm_reg_f32 26# GCN: %2:vgpr_32 = IMPLICIT_DEF 27# GCN-NOT: V_MOV_B32 28# GCN: V_FMAMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 29--- 30name: test_fmamk_imm_reg_f32 31registers: 32 - { id: 0, class: vreg_64 } 33 - { id: 1, class: vgpr_32 } 34 - { id: 2, class: vgpr_32 } 35 - { id: 3, class: vgpr_32 } 36body: | 37 bb.0: 38 39 %0 = IMPLICIT_DEF 40 %1 = COPY %0.sub1 41 %2 = V_MOV_B32_e32 1078523331, implicit $exec 42 %3 = V_FMAC_F32_e32 %2, killed %0.sub0, killed %1, implicit $mode, implicit $exec 43 44... 45 46# GCN-LABEL: name: test_fmaak_f32 47# GCN: %1:vgpr_32 = IMPLICIT_DEF 48# GCN-NOT: V_MOV_B32 49# GCN: V_FMAAK_F32 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec 50--- 51name: test_fmaak_f32 52registers: 53 - { id: 0, class: vreg_64 } 54 - { id: 1, class: vgpr_32 } 55 - { id: 2, class: vgpr_32 } 56body: | 57 bb.0: 58 59 %0 = IMPLICIT_DEF 60 %1 = V_MOV_B32_e32 1078523331, implicit $exec 61 %2 = V_FMAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec 62 63... 64 65# GCN-LABEL: name: test_fmamk_reg_imm_f16 66# GCN: %2:vgpr_32 = IMPLICIT_DEF 67# GCN-NOT: V_MOV_B32 68# GCN: V_FMAMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 69--- 70name: test_fmamk_reg_imm_f16 71registers: 72 - { id: 0, class: vreg_64 } 73 - { id: 1, class: vgpr_32 } 74 - { id: 2, class: vgpr_32 } 75 - { id: 3, class: vgpr_32 } 76body: | 77 bb.0: 78 79 %0 = IMPLICIT_DEF 80 %1 = COPY %0.sub1 81 %2 = V_MOV_B32_e32 1078523331, implicit $exec 82 %3 = V_FMAC_F16_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec 83 84... 85 86# GCN-LABEL: name: test_fmamk_imm_reg_f16 87# GCN: %2:vgpr_32 = IMPLICIT_DEF 88# GCN-NOT: V_MOV_B32 89# GCN: V_FMAMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 90--- 91name: test_fmamk_imm_reg_f16 92registers: 93 - { id: 0, class: vreg_64 } 94 - { id: 1, class: vgpr_32 } 95 - { id: 2, class: vgpr_32 } 96 - { id: 3, class: vgpr_32 } 97body: | 98 bb.0: 99 100 %0 = IMPLICIT_DEF 101 %1 = COPY %0.sub1 102 %2 = V_MOV_B32_e32 1078523331, implicit $exec 103 %3 = V_FMAC_F16_e32 %2, killed %0.sub0, killed %1, implicit $mode, implicit $exec 104 105... 106 107# GCN-LABEL: name: test_fmaak_f16 108# GCN: %1:vgpr_32 = IMPLICIT_DEF 109# GCN-NOT: V_MOV_B32 110# GCN: V_FMAAK_F16 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec 111--- 112name: test_fmaak_f16 113registers: 114 - { id: 0, class: vreg_64 } 115 - { id: 1, class: vgpr_32 } 116 - { id: 2, class: vgpr_32 } 117body: | 118 bb.0: 119 120 %0 = IMPLICIT_DEF 121 %1 = V_MOV_B32_e32 1078523331, implicit $exec 122 %2 = V_FMAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec 123... 124 125# GCN-LABEL: name: test_fmaak_sgpr_src0_f32 126# GCN: %1:vgpr_32 = IMPLICIT_DEF 127# GCN-NOT: V_MOV_B32 128# GCN: %3:vgpr_32 = V_FMAMK_F32 killed %0, 1078523331, %2, implicit $mode, implicit $exec 129 130--- 131name: test_fmaak_sgpr_src0_f32 132registers: 133 - { id: 0, class: sreg_32_xm0 } 134 - { id: 1, class: vgpr_32} 135 - { id: 2, class: vgpr_32 } 136 - { id: 3, class: vgpr_32 } 137body: | 138 bb.0: 139 140 %0 = IMPLICIT_DEF 141 %1 = V_MOV_B32_e32 1078523331, implicit $exec 142 %2 = IMPLICIT_DEF 143 %3 = V_FMAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec 144 145... 146 147# GCN-LABEL: name: test_fmaak_inlineimm_src0_f32 148# GCN: %0:vgpr_32 = IMPLICIT_DEF 149# GCN-NOT: V_MOV_B32 150# GCN: %2:vgpr_32 = V_FMAMK_F32 1073741824, 1078523331, %1, implicit $mode, implicit $exec 151 152--- 153name: test_fmaak_inlineimm_src0_f32 154registers: 155 - { id: 0, class: vgpr_32} 156 - { id: 1, class: vgpr_32 } 157 - { id: 2, class: vgpr_32 } 158body: | 159 bb.0: 160 161 %0 = V_MOV_B32_e32 1078523331, implicit $exec 162 %1 = IMPLICIT_DEF 163 %2 = V_FMAC_F32_e32 1073741824, %0, %1, implicit $mode, implicit $exec 164 165... 166 167# GCN-LABEL: name: test_fmaak_otherimm_src0_f32 168# GCN: %2:vgpr_32 = V_FMAMK_F32 %0, 1120403456, %1, implicit $mode, implicit $exec 169 170--- 171name: test_fmaak_otherimm_src0_f32 172registers: 173 - { id: 0, class: vgpr_32} 174 - { id: 1, class: vgpr_32 } 175 - { id: 2, class: vgpr_32 } 176body: | 177 bb.0: 178 179 %0 = V_MOV_B32_e32 1078523331, implicit $exec 180 %1 = IMPLICIT_DEF 181 %2 = V_FMAC_F32_e32 1120403456, %0, %1, implicit $mode, implicit $exec 182 183... 184 185# GCN-LABEL: name: test_fmaak_other_constantlike_src0_f32 186# GCN: %2:vgpr_32 = COPY %1 187# GCN: %2:vgpr_32 = V_FMAC_F32_e32 %stack.0, %0, %2, implicit $mode, implicit $exec 188--- 189name: test_fmaak_other_constantlike_src0_f32 190tracksRegLiveness: true 191registers: 192 - { id: 0, class: vgpr_32 } 193 - { id: 1, class: vgpr_32 } 194 - { id: 2, class: vgpr_32 } 195machineFunctionInfo: 196 stackPtrOffsetReg: $sgpr32 197stack: 198 - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8, 199 callee-saved-register: '', local-offset: 0, debug-info-variable: '', 200 debug-info-expression: '', debug-info-location: '' } 201body: | 202 bb.0: 203 204 %0 = V_MOV_B32_e32 1078523331, implicit $exec 205 %1 = IMPLICIT_DEF 206 %2 = V_FMAC_F32_e32 %stack.0, %0, %1, implicit $mode, implicit $exec 207 208... 209 210# GCN-LABEL: name: test_fmaak_inline_literal_f16 211# GCN: %1:vgpr_32 = IMPLICIT_DEF 212# GCN-NOT: V_MOV_B32 213# GCN: %2:vgpr_32 = V_FMAAK_F16 16384, killed %0, 49664, implicit $mode, implicit $exec 214 215--- 216name: test_fmaak_inline_literal_f16 217tracksRegLiveness: true 218liveins: 219 - { reg: '$vgpr0', virtual-reg: '%0' } 220body: | 221 bb.0: 222 liveins: $vgpr0 223 224 %0:vgpr_32 = COPY killed $vgpr0 225 226 %1:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec 227 %2:vgpr_32 = V_FMAC_F16_e32 16384, killed %0, %1, implicit $mode, implicit $exec 228 S_ENDPGM 0 229 230... 231 232# GCN-LABEL: name: test_fmamk_reg_imm_f32_2_folds 233# GCN: %2:vgpr_32 = IMPLICIT_DEF 234# GCN-NOT: V_MOV_B32 235# GCN: V_FMAMK_F32 %0.sub0, 1078523331, %1, implicit $mode, implicit $exec 236# GCN: V_FMAMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 237--- 238name: test_fmamk_reg_imm_f32_2_folds 239registers: 240 - { id: 0, class: vreg_64 } 241 - { id: 1, class: vgpr_32 } 242 - { id: 2, class: vgpr_32 } 243 - { id: 3, class: vgpr_32 } 244 - { id: 4, class: vgpr_32 } 245body: | 246 bb.0: 247 248 %0 = IMPLICIT_DEF 249 %1 = COPY %0.sub1 250 %2 = V_MOV_B32_e32 1078523331, implicit $exec 251 %3 = V_FMAC_F32_e32 %0.sub0, %2, %1, implicit $mode, implicit $exec 252 %4 = V_FMAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec 253 254... 255 256# GCN-LABEL: name: test_fmamk_reg_imm_f32_used_imm 257# GCN: %2:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec 258# GCN: V_FMAMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec 259--- 260name: test_fmamk_reg_imm_f32_used_imm 261registers: 262 - { id: 0, class: vreg_64 } 263 - { id: 1, class: vgpr_32 } 264 - { id: 2, class: vgpr_32 } 265 - { id: 3, class: vgpr_32 } 266body: | 267 bb.0: 268 269 %0 = IMPLICIT_DEF 270 %1 = COPY %0.sub1 271 %2 = V_MOV_B32_e32 1078523331, implicit $exec 272 %3 = V_FMAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec 273 S_NOP 0, implicit %2 274 275... 276 277# GCN-LABEL: name: test_fma_src0mods 278# GCN: %3:vgpr_32 = V_FMA_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec 279--- 280name: test_fma_src0mods 281body: | 282 bb.0: 283 %0:vgpr_32 = IMPLICIT_DEF 284 %1:vgpr_32 = IMPLICIT_DEF 285 %2:vgpr_32 = IMPLICIT_DEF 286 %3:vgpr_32 = V_FMAC_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec 287... 288 289# GCN-LABEL: name: test_fma_src1mods 290# GCN: %3:vgpr_32 = V_FMA_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec 291--- 292name: test_fma_src1mods 293body: | 294 bb.0: 295 %0:vgpr_32 = IMPLICIT_DEF 296 %1:vgpr_32 = IMPLICIT_DEF 297 %2:vgpr_32 = IMPLICIT_DEF 298 %3:vgpr_32 = V_FMAC_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec 299... 300 301# GCN-LABEL: name: test_fma_src2mods 302# GCN: %3:vgpr_32 = V_FMA_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec 303--- 304name: test_fma_src2mods 305body: | 306 bb.0: 307 %0:vgpr_32 = IMPLICIT_DEF 308 %1:vgpr_32 = IMPLICIT_DEF 309 %2:vgpr_32 = IMPLICIT_DEF 310 %3:vgpr_32 = V_FMAC_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec 311... 312