1# RUN: llc -march=amdgcn -run-pass peephole-opt -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s 2... 3# GCN-LABEL: name: no_fold_imm_madak_mac_clamp_f32 4# GCN: %23:vgpr_32 = V_MOV_B32_e32 1090519040, implicit $exec 5# GCN-NEXT: %24:vgpr_32 = nofpexcept V_MAC_F32_e64 0, killed %19, 0, killed %21, 0, %23, 1, 0, implicit $mode, implicit $exec 6 7name: no_fold_imm_madak_mac_clamp_f32 8tracksRegLiveness: true 9registers: 10 - { id: 0, class: sgpr_64 } 11 - { id: 1, class: sreg_32_xm0 } 12 - { id: 2, class: sgpr_32 } 13 - { id: 3, class: vgpr_32 } 14 - { id: 4, class: sreg_64_xexec } 15 - { id: 5, class: sreg_64_xexec } 16 - { id: 6, class: sreg_64_xexec } 17 - { id: 7, class: sreg_32 } 18 - { id: 8, class: sreg_32 } 19 - { id: 9, class: sreg_32_xm0 } 20 - { id: 10, class: sreg_64 } 21 - { id: 11, class: sreg_32_xm0 } 22 - { id: 12, class: sreg_32_xm0 } 23 - { id: 13, class: sgpr_64 } 24 - { id: 14, class: sgpr_128 } 25 - { id: 15, class: sreg_32_xm0 } 26 - { id: 16, class: sreg_64 } 27 - { id: 17, class: sgpr_128 } 28 - { id: 18, class: sgpr_128 } 29 - { id: 19, class: vgpr_32 } 30 - { id: 20, class: vreg_64 } 31 - { id: 21, class: vgpr_32 } 32 - { id: 22, class: vreg_64 } 33 - { id: 23, class: vgpr_32 } 34 - { id: 24, class: vgpr_32 } 35 - { id: 25, class: vgpr_32 } 36 - { id: 26, class: vreg_64 } 37 - { id: 27, class: vgpr_32 } 38 - { id: 28, class: vreg_64 } 39 - { id: 29, class: vreg_64 } 40liveins: 41 - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' } 42 - { reg: '$vgpr0', virtual-reg: '%3' } 43body: | 44 bb.0: 45 liveins: $sgpr0_sgpr1, $vgpr0 46 47 %3 = COPY $vgpr0 48 %0 = COPY $sgpr0_sgpr1 49 %4 = S_LOAD_DWORDX2_IMM %0, 9, 0, 0 50 %5 = S_LOAD_DWORDX2_IMM %0, 11, 0, 0 51 %6 = S_LOAD_DWORDX2_IMM %0, 13, 0, 0 52 %27 = V_ASHRREV_I32_e32 31, %3, implicit $exec 53 %28 = REG_SEQUENCE %3, 1, %27, 2 54 %11 = S_MOV_B32 61440 55 %12 = S_MOV_B32 0 56 %13 = REG_SEQUENCE killed %12, 1, killed %11, 2 57 %14 = REG_SEQUENCE killed %5, 17, %13, 18 58 %15 = S_MOV_B32 2 59 %29 = V_LSHL_B64 killed %28, killed %15, implicit $exec 60 %17 = REG_SEQUENCE killed %6, 17, %13, 18 61 %18 = REG_SEQUENCE killed %4, 17, %13, 18 62 %20 = COPY %29 63 %19 = BUFFER_LOAD_DWORD_ADDR64 %20, killed %14, 0, 0, 0, 0, 0, 0, 0, implicit $exec 64 %22 = COPY %29 65 %21 = BUFFER_LOAD_DWORD_ADDR64 %22, killed %17, 0, 0, 0, 0, 0, 0, 0, implicit $exec 66 %23 = V_MOV_B32_e32 1090519040, implicit $exec 67 %24 = nofpexcept V_MAC_F32_e64 0, killed %19, 0, killed %21, 0, %23, 1, 0, implicit $mode, implicit $exec 68 %26 = COPY %29 69 BUFFER_STORE_DWORD_ADDR64 killed %24, %26, killed %18, 0, 0, 0, 0, 0, 0, 0, implicit $exec 70 S_ENDPGM 0 71 72... 73--- 74# GCN-LABEL: name: no_fold_imm_madak_mac_omod_f32 75# GCN: %23:vgpr_32 = V_MOV_B32_e32 1090519040, implicit $exec 76# GCN: %24:vgpr_32 = nofpexcept V_MAC_F32_e64 0, killed %19, 0, killed %21, 0, %23, 0, 2, implicit $mode, implicit $exec 77 78name: no_fold_imm_madak_mac_omod_f32 79tracksRegLiveness: true 80registers: 81 - { id: 0, class: sgpr_64 } 82 - { id: 1, class: sreg_32_xm0 } 83 - { id: 2, class: sgpr_32 } 84 - { id: 3, class: vgpr_32 } 85 - { id: 4, class: sreg_64_xexec } 86 - { id: 5, class: sreg_64_xexec } 87 - { id: 6, class: sreg_64_xexec } 88 - { id: 7, class: sreg_32 } 89 - { id: 8, class: sreg_32 } 90 - { id: 9, class: sreg_32_xm0 } 91 - { id: 10, class: sreg_64 } 92 - { id: 11, class: sreg_32_xm0 } 93 - { id: 12, class: sreg_32_xm0 } 94 - { id: 13, class: sgpr_64 } 95 - { id: 14, class: sgpr_128 } 96 - { id: 15, class: sreg_32_xm0 } 97 - { id: 16, class: sreg_64 } 98 - { id: 17, class: sgpr_128 } 99 - { id: 18, class: sgpr_128 } 100 - { id: 19, class: vgpr_32 } 101 - { id: 20, class: vreg_64 } 102 - { id: 21, class: vgpr_32 } 103 - { id: 22, class: vreg_64 } 104 - { id: 23, class: vgpr_32 } 105 - { id: 24, class: vgpr_32 } 106 - { id: 25, class: vgpr_32 } 107 - { id: 26, class: vreg_64 } 108 - { id: 27, class: vgpr_32 } 109 - { id: 28, class: vreg_64 } 110 - { id: 29, class: vreg_64 } 111liveins: 112 - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' } 113 - { reg: '$vgpr0', virtual-reg: '%3' } 114body: | 115 bb.0: 116 liveins: $sgpr0_sgpr1, $vgpr0 117 118 %3 = COPY $vgpr0 119 %0 = COPY $sgpr0_sgpr1 120 %4 = S_LOAD_DWORDX2_IMM %0, 9, 0, 0 121 %5 = S_LOAD_DWORDX2_IMM %0, 11, 0, 0 122 %6 = S_LOAD_DWORDX2_IMM %0, 13, 0, 0 123 %27 = V_ASHRREV_I32_e32 31, %3, implicit $exec 124 %28 = REG_SEQUENCE %3, 1, %27, 2 125 %11 = S_MOV_B32 61440 126 %12 = S_MOV_B32 0 127 %13 = REG_SEQUENCE killed %12, 1, killed %11, 2 128 %14 = REG_SEQUENCE killed %5, 17, %13, 18 129 %15 = S_MOV_B32 2 130 %29 = V_LSHL_B64 killed %28, killed %15, implicit $exec 131 %17 = REG_SEQUENCE killed %6, 17, %13, 18 132 %18 = REG_SEQUENCE killed %4, 17, %13, 18 133 %20 = COPY %29 134 %19 = BUFFER_LOAD_DWORD_ADDR64 %20, killed %14, 0, 0, 0, 0, 0, 0, 0, implicit $exec 135 %22 = COPY %29 136 %21 = BUFFER_LOAD_DWORD_ADDR64 %22, killed %17, 0, 0, 0, 0, 0, 0, 0, implicit $exec 137 %23 = V_MOV_B32_e32 1090519040, implicit $exec 138 %24 = nofpexcept V_MAC_F32_e64 0, killed %19, 0, killed %21, 0, %23, 0, 2, implicit $mode, implicit $exec 139 %26 = COPY %29 140 BUFFER_STORE_DWORD_ADDR64 killed %24, %26, killed %18, 0, 0, 0, 0, 0, 0, 0, implicit $exec 141 S_ENDPGM 0 142 143... 144--- 145# GCN: name: no_fold_imm_madak_mad_clamp_f32 146# GCN: %23:vgpr_32 = V_MOV_B32_e32 1090519040, implicit $exec 147# GCN: %24:vgpr_32 = nofpexcept V_MAD_F32 0, killed %19, 0, killed %21, 0, %23, 1, 0, implicit $mode, implicit $exec 148 149name: no_fold_imm_madak_mad_clamp_f32 150tracksRegLiveness: true 151registers: 152 - { id: 0, class: sgpr_64 } 153 - { id: 1, class: sreg_32_xm0 } 154 - { id: 2, class: sgpr_32 } 155 - { id: 3, class: vgpr_32 } 156 - { id: 4, class: sreg_64_xexec } 157 - { id: 5, class: sreg_64_xexec } 158 - { id: 6, class: sreg_64_xexec } 159 - { id: 7, class: sreg_32 } 160 - { id: 8, class: sreg_32 } 161 - { id: 9, class: sreg_32_xm0 } 162 - { id: 10, class: sreg_64 } 163 - { id: 11, class: sreg_32_xm0 } 164 - { id: 12, class: sreg_32_xm0 } 165 - { id: 13, class: sgpr_64 } 166 - { id: 14, class: sgpr_128 } 167 - { id: 15, class: sreg_32_xm0 } 168 - { id: 16, class: sreg_64 } 169 - { id: 17, class: sgpr_128 } 170 - { id: 18, class: sgpr_128 } 171 - { id: 19, class: vgpr_32 } 172 - { id: 20, class: vreg_64 } 173 - { id: 21, class: vgpr_32 } 174 - { id: 22, class: vreg_64 } 175 - { id: 23, class: vgpr_32 } 176 - { id: 24, class: vgpr_32 } 177 - { id: 25, class: vgpr_32 } 178 - { id: 26, class: vreg_64 } 179 - { id: 27, class: vgpr_32 } 180 - { id: 28, class: vreg_64 } 181 - { id: 29, class: vreg_64 } 182liveins: 183 - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' } 184 - { reg: '$vgpr0', virtual-reg: '%3' } 185body: | 186 bb.0: 187 liveins: $sgpr0_sgpr1, $vgpr0 188 189 %3 = COPY $vgpr0 190 %0 = COPY $sgpr0_sgpr1 191 %4 = S_LOAD_DWORDX2_IMM %0, 9, 0, 0 192 %5 = S_LOAD_DWORDX2_IMM %0, 11, 0, 0 193 %6 = S_LOAD_DWORDX2_IMM %0, 13, 0, 0 194 %27 = V_ASHRREV_I32_e32 31, %3, implicit $exec 195 %28 = REG_SEQUENCE %3, 1, %27, 2 196 %11 = S_MOV_B32 61440 197 %12 = S_MOV_B32 0 198 %13 = REG_SEQUENCE killed %12, 1, killed %11, 2 199 %14 = REG_SEQUENCE killed %5, 17, %13, 18 200 %15 = S_MOV_B32 2 201 %29 = V_LSHL_B64 killed %28, killed %15, implicit $exec 202 %17 = REG_SEQUENCE killed %6, 17, %13, 18 203 %18 = REG_SEQUENCE killed %4, 17, %13, 18 204 %20 = COPY %29 205 %19 = BUFFER_LOAD_DWORD_ADDR64 %20, killed %14, 0, 0, 0, 0, 0, 0, 0, implicit $exec 206 %22 = COPY %29 207 %21 = BUFFER_LOAD_DWORD_ADDR64 %22, killed %17, 0, 0, 0, 0, 0, 0, 0, implicit $exec 208 %23 = V_MOV_B32_e32 1090519040, implicit $exec 209 %24 = nofpexcept V_MAD_F32 0, killed %19, 0, killed %21, 0, %23, 1, 0, implicit $mode, implicit $exec 210 %26 = COPY %29 211 BUFFER_STORE_DWORD_ADDR64 killed %24, %26, killed %18, 0, 0, 0, 0, 0, 0, 0, implicit $exec 212 S_ENDPGM 0 213 214... 215--- 216# GCN: name: no_fold_imm_madak_mad_omod_f32 217# GCN: %23:vgpr_32 = V_MOV_B32_e32 1090519040, implicit $exec 218# GCN: %24:vgpr_32 = nofpexcept V_MAD_F32 0, killed %19, 0, killed %21, 0, %23, 0, 1, implicit $mode, implicit $exec 219 220name: no_fold_imm_madak_mad_omod_f32 221tracksRegLiveness: true 222registers: 223 - { id: 0, class: sgpr_64 } 224 - { id: 1, class: sreg_32_xm0 } 225 - { id: 2, class: sgpr_32 } 226 - { id: 3, class: vgpr_32 } 227 - { id: 4, class: sreg_64_xexec } 228 - { id: 5, class: sreg_64_xexec } 229 - { id: 6, class: sreg_64_xexec } 230 - { id: 7, class: sreg_32 } 231 - { id: 8, class: sreg_32 } 232 - { id: 9, class: sreg_32_xm0 } 233 - { id: 10, class: sreg_64 } 234 - { id: 11, class: sreg_32_xm0 } 235 - { id: 12, class: sreg_32_xm0 } 236 - { id: 13, class: sgpr_64 } 237 - { id: 14, class: sgpr_128 } 238 - { id: 15, class: sreg_32_xm0 } 239 - { id: 16, class: sreg_64 } 240 - { id: 17, class: sgpr_128 } 241 - { id: 18, class: sgpr_128 } 242 - { id: 19, class: vgpr_32 } 243 - { id: 20, class: vreg_64 } 244 - { id: 21, class: vgpr_32 } 245 - { id: 22, class: vreg_64 } 246 - { id: 23, class: vgpr_32 } 247 - { id: 24, class: vgpr_32 } 248 - { id: 25, class: vgpr_32 } 249 - { id: 26, class: vreg_64 } 250 - { id: 27, class: vgpr_32 } 251 - { id: 28, class: vreg_64 } 252 - { id: 29, class: vreg_64 } 253liveins: 254 - { reg: '$sgpr0_sgpr1', virtual-reg: '%0' } 255 - { reg: '$vgpr0', virtual-reg: '%3' } 256body: | 257 bb.0: 258 liveins: $sgpr0_sgpr1, $vgpr0 259 260 %3 = COPY $vgpr0 261 %0 = COPY $sgpr0_sgpr1 262 %4 = S_LOAD_DWORDX2_IMM %0, 9, 0, 0 263 %5 = S_LOAD_DWORDX2_IMM %0, 11, 0, 0 264 %6 = S_LOAD_DWORDX2_IMM %0, 13, 0, 0 265 %27 = V_ASHRREV_I32_e32 31, %3, implicit $exec 266 %28 = REG_SEQUENCE %3, 1, %27, 2 267 %11 = S_MOV_B32 61440 268 %12 = S_MOV_B32 0 269 %13 = REG_SEQUENCE killed %12, 1, killed %11, 2 270 %14 = REG_SEQUENCE killed %5, 17, %13, 18 271 %15 = S_MOV_B32 2 272 %29 = V_LSHL_B64 killed %28, killed %15, implicit $exec 273 %17 = REG_SEQUENCE killed %6, 17, %13, 18 274 %18 = REG_SEQUENCE killed %4, 17, %13, 18 275 %20 = COPY %29 276 %19 = BUFFER_LOAD_DWORD_ADDR64 %20, killed %14, 0, 0, 0, 0, 0, 0, 0, implicit $exec 277 %22 = COPY %29 278 %21 = BUFFER_LOAD_DWORD_ADDR64 %22, killed %17, 0, 0, 0, 0, 0, 0, 0, implicit $exec 279 %23 = V_MOV_B32_e32 1090519040, implicit $exec 280 %24 = nofpexcept V_MAD_F32 0, killed %19, 0, killed %21, 0, %23, 0, 1, implicit $mode, implicit $exec 281 %26 = COPY %29 282 BUFFER_STORE_DWORD_ADDR64 killed %24, %26, killed %18, 0, 0, 0, 0, 0, 0, 0, implicit $exec 283 S_ENDPGM 0 284 285... 286