1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -disable-gisel-legality-check -o - %s | FileCheck -check-prefix=GFX8 %s 3# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX9 %s 4 5--- 6 7name: fcanonicalize_f16_denorm 8legalized: true 9regBankSelected: true 10machineFunctionInfo: 11 mode: 12 fp64-fp16-input-denormals: true 13 fp64-fp16-output-denormals: true 14 15body: | 16 bb.0: 17 liveins: $vgpr0 18 ; GFX8-LABEL: name: fcanonicalize_f16_denorm 19 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 20 ; GFX8: %2:vgpr_32 = nofpexcept V_MAX_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 21 ; GFX8: S_ENDPGM 0, implicit %2 22 ; GFX9-LABEL: name: fcanonicalize_f16_denorm 23 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 24 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 25 ; GFX9: S_ENDPGM 0, implicit %2 26 %0:vgpr(s32) = COPY $vgpr0 27 %1:vgpr(s16) = G_TRUNC %0 28 %2:vgpr(s16) = G_FCANONICALIZE %1 29 S_ENDPGM 0, implicit %2 30... 31 32--- 33 34name: fcanonicalize_f16_flush 35legalized: true 36regBankSelected: true 37machineFunctionInfo: 38 mode: 39 fp64-fp16-input-denormals: false 40 fp64-fp16-output-denormals: false 41 42body: | 43 bb.0: 44 liveins: $vgpr0 45 ; GFX8-LABEL: name: fcanonicalize_f16_flush 46 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 47 ; GFX8: %2:vgpr_32 = nofpexcept V_MUL_F16_e64 0, 15360, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 48 ; GFX8: S_ENDPGM 0, implicit %2 49 ; GFX9-LABEL: name: fcanonicalize_f16_flush 50 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 51 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 52 ; GFX9: S_ENDPGM 0, implicit %2 53 %0:vgpr(s32) = COPY $vgpr0 54 %1:vgpr(s16) = G_TRUNC %0 55 %2:vgpr(s16) = G_FCANONICALIZE %1 56 S_ENDPGM 0, implicit %2 57... 58 59--- 60 61name: fcanonicalize_f32_denorm 62legalized: true 63regBankSelected: true 64machineFunctionInfo: 65 mode: 66 fp32-input-denormals: true 67 fp32-output-denormals: true 68 69body: | 70 bb.0: 71 liveins: $vgpr0 72 73 ; GFX8-LABEL: name: fcanonicalize_f32_denorm 74 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 75 ; GFX8: %1:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 76 ; GFX8: S_ENDPGM 0, implicit %1 77 ; GFX9-LABEL: name: fcanonicalize_f32_denorm 78 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 79 ; GFX9: %1:vgpr_32 = nofpexcept V_MAX_F32_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 80 ; GFX9: S_ENDPGM 0, implicit %1 81 %0:vgpr(s32) = COPY $vgpr0 82 %1:vgpr(s32) = G_FCANONICALIZE %0 83 S_ENDPGM 0, implicit %1 84... 85 86--- 87 88name: fcanonicalize_f32_flush 89legalized: true 90regBankSelected: true 91machineFunctionInfo: 92 mode: 93 fp32-input-denormals: false 94 fp32-output-denormals: false 95 96body: | 97 bb.0: 98 liveins: $vgpr0 99 100 ; GFX8-LABEL: name: fcanonicalize_f32_flush 101 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 102 ; GFX8: %1:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 103 ; GFX8: S_ENDPGM 0, implicit %1 104 ; GFX9-LABEL: name: fcanonicalize_f32_flush 105 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 106 ; GFX9: %1:vgpr_32 = nofpexcept V_MAX_F32_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 107 ; GFX9: S_ENDPGM 0, implicit %1 108 %0:vgpr(s32) = COPY $vgpr0 109 %1:vgpr(s32) = G_FCANONICALIZE %0 110 S_ENDPGM 0, implicit %1 111... 112 113--- 114 115name: fcanonicalize_v2f16_denorm 116legalized: true 117regBankSelected: true 118machineFunctionInfo: 119 mode: 120 fp64-fp16-input-denormals: true 121 fp64-fp16-output-denormals: true 122 123body: | 124 bb.0: 125 liveins: $vgpr0 126 127 ; GFX8-LABEL: name: fcanonicalize_v2f16_denorm 128 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 129 ; GFX8: %1:vgpr_32 = nofpexcept V_PK_MAX_F16 8, [[COPY]], 8, [[COPY]], 0, 0, 0, 0, 0, implicit $mode, implicit $exec 130 ; GFX8: S_ENDPGM 0, implicit %1 131 ; GFX9-LABEL: name: fcanonicalize_v2f16_denorm 132 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 133 ; GFX9: %1:vgpr_32 = nofpexcept V_PK_MAX_F16 8, [[COPY]], 8, [[COPY]], 0, 0, 0, 0, 0, implicit $mode, implicit $exec 134 ; GFX9: S_ENDPGM 0, implicit %1 135 %0:vgpr(<2 x s16>) = COPY $vgpr0 136 %1:vgpr(<2 x s16>) = G_FCANONICALIZE %0 137 S_ENDPGM 0, implicit %1 138... 139 140--- 141 142name: fcanonicalize_v2f16_flush 143legalized: true 144regBankSelected: true 145machineFunctionInfo: 146 mode: 147 fp64-fp16-input-denormals: false 148 fp64-fp16-output-denormals: false 149 150body: | 151 bb.0: 152 liveins: $vgpr0 153 154 ; GFX8-LABEL: name: fcanonicalize_v2f16_flush 155 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 156 ; GFX8: %1:vgpr_32 = nofpexcept V_PK_MUL_F16 0, 15360, 8, [[COPY]], 0, 0, 0, 0, 0, implicit $mode, implicit $exec 157 ; GFX8: S_ENDPGM 0, implicit %1 158 ; GFX9-LABEL: name: fcanonicalize_v2f16_flush 159 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 160 ; GFX9: %1:vgpr_32 = nofpexcept V_PK_MAX_F16 8, [[COPY]], 8, [[COPY]], 0, 0, 0, 0, 0, implicit $mode, implicit $exec 161 ; GFX9: S_ENDPGM 0, implicit %1 162 %0:vgpr(<2 x s16>) = COPY $vgpr0 163 %1:vgpr(<2 x s16>) = G_FCANONICALIZE %0 164 S_ENDPGM 0, implicit %1 165... 166 167--- 168 169name: fcanonicalize_f64_denorm 170legalized: true 171regBankSelected: true 172machineFunctionInfo: 173 mode: 174 fp64-fp16-input-denormals: true 175 fp64-fp16-output-denormals: true 176 177body: | 178 bb.0: 179 liveins: $vgpr0_vgpr1 180 181 ; GFX8-LABEL: name: fcanonicalize_f64_denorm 182 ; GFX8: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 183 ; GFX8: %1:vreg_64 = nofpexcept V_MAX_F64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 184 ; GFX8: S_ENDPGM 0, implicit %1 185 ; GFX9-LABEL: name: fcanonicalize_f64_denorm 186 ; GFX9: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 187 ; GFX9: %1:vreg_64 = nofpexcept V_MAX_F64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 188 ; GFX9: S_ENDPGM 0, implicit %1 189 %0:vgpr(s64) = COPY $vgpr0_vgpr1 190 %1:vgpr(s64) = G_FCANONICALIZE %0 191 S_ENDPGM 0, implicit %1 192... 193 194--- 195 196name: fcanonicalize_f64_flush 197legalized: true 198regBankSelected: true 199machineFunctionInfo: 200 mode: 201 fp64-fp16-input-denormals: false 202 fp64-fp16-output-denormals: false 203 204body: | 205 bb.0: 206 liveins: $vgpr0_vgpr1 207 208 ; GFX8-LABEL: name: fcanonicalize_f64_flush 209 ; GFX8: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 210 ; GFX8: %1:vreg_64 = nofpexcept V_MUL_F64 0, 4607182418800017408, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 211 ; GFX8: S_ENDPGM 0, implicit %1 212 ; GFX9-LABEL: name: fcanonicalize_f64_flush 213 ; GFX9: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 214 ; GFX9: %1:vreg_64 = nofpexcept V_MAX_F64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 215 ; GFX9: S_ENDPGM 0, implicit %1 216 %0:vgpr(s64) = COPY $vgpr0_vgpr1 217 %1:vgpr(s64) = G_FCANONICALIZE %0 218 S_ENDPGM 0, implicit %1 219... 220 221--- 222 223name: fcanonicalize_fabs_f32_denorm 224legalized: true 225regBankSelected: true 226machineFunctionInfo: 227 mode: 228 fp32-input-denormals: true 229 fp32-output-denormals: true 230 231body: | 232 bb.0: 233 liveins: $vgpr0 234 ; GFX8-LABEL: name: fcanonicalize_fabs_f32_denorm 235 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 236 ; GFX8: %2:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 2, [[COPY]], 0, 0, implicit $mode, implicit $exec 237 ; GFX8: S_ENDPGM 0, implicit %2 238 ; GFX9-LABEL: name: fcanonicalize_fabs_f32_denorm 239 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 240 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F32_e64 2, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec 241 ; GFX9: S_ENDPGM 0, implicit %2 242 %0:vgpr(s32) = COPY $vgpr0 243 %1:vgpr(s32) = G_FABS %0 244 %2:vgpr(s32) = G_FCANONICALIZE %1 245 S_ENDPGM 0, implicit %2 246... 247 248 249--- 250 251name: fcanonicalize_fabs_f32_flush 252legalized: true 253regBankSelected: true 254machineFunctionInfo: 255 mode: 256 fp32-input-denormals: false 257 fp32-output-denormals: false 258 259body: | 260 bb.0: 261 liveins: $vgpr0 262 ; GFX8-LABEL: name: fcanonicalize_fabs_f32_flush 263 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 264 ; GFX8: %2:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 2, [[COPY]], 0, 0, implicit $mode, implicit $exec 265 ; GFX8: S_ENDPGM 0, implicit %2 266 ; GFX9-LABEL: name: fcanonicalize_fabs_f32_flush 267 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 268 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F32_e64 2, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec 269 ; GFX9: S_ENDPGM 0, implicit %2 270 %0:vgpr(s32) = COPY $vgpr0 271 %1:vgpr(s32) = G_FABS %0 272 %2:vgpr(s32) = G_FCANONICALIZE %1 273 S_ENDPGM 0, implicit %2 274... 275 276--- 277 278name: fcanonicalize_fneg_f32_denorm 279legalized: true 280regBankSelected: true 281machineFunctionInfo: 282 mode: 283 fp32-input-denormals: true 284 fp32-output-denormals: true 285 286body: | 287 bb.0: 288 liveins: $vgpr0 289 ; GFX8-LABEL: name: fcanonicalize_fneg_f32_denorm 290 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 291 ; GFX8: %2:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 3212836864, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 292 ; GFX8: S_ENDPGM 0, implicit %2 293 ; GFX9-LABEL: name: fcanonicalize_fneg_f32_denorm 294 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 295 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F32_e64 1, [[COPY]], 1, [[COPY]], 0, 0, implicit $mode, implicit $exec 296 ; GFX9: S_ENDPGM 0, implicit %2 297 %0:vgpr(s32) = COPY $vgpr0 298 %1:vgpr(s32) = G_FNEG %0 299 %2:vgpr(s32) = G_FCANONICALIZE %1 300 S_ENDPGM 0, implicit %2 301... 302 303--- 304 305name: fcanonicalize_fneg_f32_flush 306legalized: true 307regBankSelected: true 308machineFunctionInfo: 309 mode: 310 fp32-input-denormals: false 311 fp32-output-denormals: false 312 313body: | 314 bb.0: 315 liveins: $vgpr0 316 ; GFX8-LABEL: name: fcanonicalize_fneg_f32_flush 317 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 318 ; GFX8: %2:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 3212836864, 0, [[COPY]], 0, 0, implicit $mode, implicit $exec 319 ; GFX8: S_ENDPGM 0, implicit %2 320 ; GFX9-LABEL: name: fcanonicalize_fneg_f32_flush 321 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 322 ; GFX9: %2:vgpr_32 = nofpexcept V_MAX_F32_e64 1, [[COPY]], 1, [[COPY]], 0, 0, implicit $mode, implicit $exec 323 ; GFX9: S_ENDPGM 0, implicit %2 324 %0:vgpr(s32) = COPY $vgpr0 325 %1:vgpr(s32) = G_FNEG %0 326 %2:vgpr(s32) = G_FCANONICALIZE %1 327 S_ENDPGM 0, implicit %2 328... 329 330--- 331 332name: fcanonicalize_fneg_fabs_f32_denorm 333legalized: true 334regBankSelected: true 335machineFunctionInfo: 336 mode: 337 fp32-input-denormals: true 338 fp32-output-denormals: true 339 340body: | 341 bb.0: 342 liveins: $vgpr0 343 ; GFX8-LABEL: name: fcanonicalize_fneg_fabs_f32_denorm 344 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 345 ; GFX8: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648 346 ; GFX8: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec 347 ; GFX8: %3:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 2, [[V_XOR_B32_e32_]], 0, 0, implicit $mode, implicit $exec 348 ; GFX8: S_ENDPGM 0, implicit %3 349 ; GFX9-LABEL: name: fcanonicalize_fneg_fabs_f32_denorm 350 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 351 ; GFX9: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648 352 ; GFX9: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec 353 ; GFX9: %3:vgpr_32 = nofpexcept V_MAX_F32_e64 2, [[V_XOR_B32_e32_]], 2, [[V_XOR_B32_e32_]], 0, 0, implicit $mode, implicit $exec 354 ; GFX9: S_ENDPGM 0, implicit %3 355 %0:vgpr(s32) = COPY $vgpr0 356 %1:vgpr(s32) = G_FNEG %0 357 %2:vgpr(s32) = G_FABS %1 358 %3:vgpr(s32) = G_FCANONICALIZE %2 359 S_ENDPGM 0, implicit %3 360... 361 362--- 363 364name: fcanonicalize_fneg_fabs_f32_flush 365legalized: true 366regBankSelected: true 367machineFunctionInfo: 368 mode: 369 fp32-input-denormals: false 370 fp32-output-denormals: false 371 372body: | 373 bb.0: 374 liveins: $vgpr0 375 ; GFX8-LABEL: name: fcanonicalize_fneg_fabs_f32_flush 376 ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 377 ; GFX8: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648 378 ; GFX8: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec 379 ; GFX8: %3:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 1065353216, 2, [[V_XOR_B32_e32_]], 0, 0, implicit $mode, implicit $exec 380 ; GFX8: S_ENDPGM 0, implicit %3 381 ; GFX9-LABEL: name: fcanonicalize_fneg_fabs_f32_flush 382 ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 383 ; GFX9: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648 384 ; GFX9: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec 385 ; GFX9: %3:vgpr_32 = nofpexcept V_MAX_F32_e64 2, [[V_XOR_B32_e32_]], 2, [[V_XOR_B32_e32_]], 0, 0, implicit $mode, implicit $exec 386 ; GFX9: S_ENDPGM 0, implicit %3 387 %0:vgpr(s32) = COPY $vgpr0 388 %1:vgpr(s32) = G_FNEG %0 389 %2:vgpr(s32) = G_FABS %1 390 %3:vgpr(s32) = G_FCANONICALIZE %2 391 S_ENDPGM 0, implicit %3 392... 393