From 43bcdb17a1e9e826d51d515fe0d56327046fc59f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Fri, 19 Jul 2019 14:42:40 +0000 Subject: [PATCH] AMDGPU/GlobalISel: Selection for fminnum/fmaxnum v2f16 case doesn't work yet because the VOP3P complex patterns haven't been ported yet. llvm-svn: 366585 --- .../Target/GlobalISel/SelectionDAGCompat.td | 4 + lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp | 6 +- .../GlobalISel/inst-select-fmaxnum-ieee.mir | 308 ++++++++++++++++++ .../AMDGPU/GlobalISel/inst-select-fmaxnum.mir | 307 +++++++++++++++++ .../GlobalISel/inst-select-fminnum-ieee.mir | 308 ++++++++++++++++++ .../AMDGPU/GlobalISel/inst-select-fminnum.mir | 307 +++++++++++++++++ .../AMDGPU/GlobalISel/inst-select-maxnum.mir | 60 ---- .../AMDGPU/GlobalISel/inst-select-minnum.mir | 59 ---- .../GlobalISel/regbankselect-maxnum.mir | 66 ---- .../GlobalISel/regbankselect-minnum.mir | 66 ---- 10 files changed, 1238 insertions(+), 253 deletions(-) create mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum-ieee.mir create mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum.mir create mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum-ieee.mir create mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum.mir delete mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-maxnum.mir delete mode 100644 test/CodeGen/AMDGPU/GlobalISel/inst-select-minnum.mir delete mode 100644 test/CodeGen/AMDGPU/GlobalISel/regbankselect-maxnum.mir delete mode 100644 test/CodeGen/AMDGPU/GlobalISel/regbankselect-minnum.mir diff --git a/include/llvm/Target/GlobalISel/SelectionDAGCompat.td b/include/llvm/Target/GlobalISel/SelectionDAGCompat.td index 6cc58d6521d..5c7607168e1 100644 --- a/include/llvm/Target/GlobalISel/SelectionDAGCompat.td +++ b/include/llvm/Target/GlobalISel/SelectionDAGCompat.td @@ -104,6 +104,10 @@ def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; +def : GINodeEquiv; +def : GINodeEquiv; +def : GINodeEquiv; +def : GINodeEquiv; // Broadly speaking G_LOAD is equivalent to ISD::LOAD but there are some // complications that tablegen must take care of. For example, Predicates such diff --git a/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp b/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp index 815cbc5e26e..9b454665030 100644 --- a/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp +++ b/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp @@ -1699,6 +1699,10 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { case AMDGPU::G_FPEXT: case AMDGPU::G_FEXP2: case AMDGPU::G_FLOG2: + case AMDGPU::G_FMINNUM: + case AMDGPU::G_FMAXNUM: + case AMDGPU::G_FMINNUM_IEEE: + case AMDGPU::G_FMAXNUM_IEEE: case AMDGPU::G_FCANONICALIZE: case AMDGPU::G_INTRINSIC_TRUNC: case AMDGPU::G_INTRINSIC_ROUND: @@ -1906,8 +1910,6 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { switch (MI.getOperand(MI.getNumExplicitDefs()).getIntrinsicID()) { default: return getInvalidInstructionMapping(); - case Intrinsic::maxnum: - case Intrinsic::minnum: case Intrinsic::amdgcn_div_fmas: case Intrinsic::amdgcn_trig_preop: case Intrinsic::amdgcn_sin: diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum-ieee.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum-ieee.mir new file mode 100644 index 00000000000..a5f604479b5 --- /dev/null +++ b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum-ieee.mir @@ -0,0 +1,308 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s +# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX8 %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s + +--- + +name: fmaxnum_ieee_f32_f64_ieee_mode_on +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: true + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_on + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX8-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_on + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX9-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_on + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; maxnum_ieee vs + %4:vgpr(s32) = G_FMAXNUM_IEEE %1, %0 + + ; maxnum_ieee sv + %5:vgpr(s32) = G_FMAXNUM_IEEE %0, %1 + + ; maxnum_ieee vv + %6:vgpr(s32) = G_FMAXNUM_IEEE %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; maxnum_ieee vs + %14:vgpr(s64) = G_FMAXNUM_IEEE %10, %11 + + ; maxnum_ieee sv + %15:vgpr(s64) = G_FMAXNUM_IEEE %11, %10 + + ; maxnum_ieee vv + %16:vgpr(s64) = G_FMAXNUM_IEEE %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + + +# FIXME: Ideally this would fail to select with ieee mode disabled +--- + +name: fmaxnum_ieee_f32_f64_ieee_mode_off +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: false + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_off + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX8-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_off + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX9-LABEL: name: fmaxnum_ieee_f32_f64_ieee_mode_off + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; maxnum_ieee vs + %4:vgpr(s32) = G_FMAXNUM_IEEE %1, %0 + + ; maxnum_ieee sv + %5:vgpr(s32) = G_FMAXNUM_IEEE %0, %1 + + ; maxnum_ieee vv + %6:vgpr(s32) = G_FMAXNUM_IEEE %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; maxnum_ieee vs + %14:vgpr(s64) = G_FMAXNUM_IEEE %10, %11 + + ; maxnum_ieee sv + %15:vgpr(s64) = G_FMAXNUM_IEEE %11, %10 + + ; maxnum_ieee vv + %16:vgpr(s64) = G_FMAXNUM_IEEE %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- +name: fmaxnum_ieee_f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fmaxnum_ieee_f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FMAXNUM_IEEE:%[0-9]+]]:vgpr(s16) = G_FMAXNUM_IEEE [[TRUNC]], [[TRUNC1]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM_IEEE]](s16) + ; GFX8-LABEL: name: fmaxnum_ieee_f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + ; GFX9-LABEL: name: fmaxnum_ieee_f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FMAXNUM_IEEE %2, %3 + S_ENDPGM 0, implicit %4 +... + +--- +name: fmaxnum_ieee_v2f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0, $sgpr1 + + ; GFX7-LABEL: name: fmaxnum_ieee_v2f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX7: [[FMAXNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM_IEEE [[COPY]], [[COPY1]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM_IEEE]](<2 x s16>) + ; GFX8-LABEL: name: fmaxnum_ieee_v2f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX8: [[FMAXNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM_IEEE [[COPY]], [[COPY1]] + ; GFX8: S_ENDPGM 0, implicit [[FMAXNUM_IEEE]](<2 x s16>) + ; GFX9-LABEL: name: fmaxnum_ieee_v2f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX9: [[FMAXNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM_IEEE [[COPY]], [[COPY1]] + ; GFX9: S_ENDPGM 0, implicit [[FMAXNUM_IEEE]](<2 x s16>) + %0:vgpr(<2 x s16>) = COPY $vgpr0 + %1:vgpr(<2 x s16>) = COPY $vgpr1 + %2:vgpr(<2 x s16>) = G_FMAXNUM_IEEE %0, %1 + S_ENDPGM 0, implicit %2 +... + +--- +name: fmaxnum_ieee_f16_v_fneg_v +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fmaxnum_ieee_f16_v_fneg_v + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FNEG:%[0-9]+]]:vgpr(s16) = G_FNEG [[TRUNC1]] + ; GFX7: [[FMAXNUM_IEEE:%[0-9]+]]:vgpr(s16) = G_FMAXNUM_IEEE [[TRUNC]], [[FNEG]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM_IEEE]](s16) + ; GFX8-LABEL: name: fmaxnum_ieee_f16_v_fneg_v + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + ; GFX9-LABEL: name: fmaxnum_ieee_f16_v_fneg_v + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FNEG %3 + %5:vgpr(s16) = G_FMAXNUM_IEEE %2, %4 + S_ENDPGM 0, implicit %5 +... diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum.mir new file mode 100644 index 00000000000..4902ee35af2 --- /dev/null +++ b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fmaxnum.mir @@ -0,0 +1,307 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s +# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX8 %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s + +# FIXME: Ideally this would fail to select with ieee mode enabled. +--- + +name: fmaxnum_f32_f64_ieee_mode_on +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: true + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fmaxnum_f32_f64_ieee_mode_on + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX8-LABEL: name: fmaxnum_f32_f64_ieee_mode_on + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX9-LABEL: name: fmaxnum_f32_f64_ieee_mode_on + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; maxnum vs + %4:vgpr(s32) = G_FMAXNUM %1, %0 + + ; maxnum sv + %5:vgpr(s32) = G_FMAXNUM %0, %1 + + ; maxnum vv + %6:vgpr(s32) = G_FMAXNUM %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; maxnum vs + %14:vgpr(s64) = G_FMAXNUM %10, %11 + + ; maxnum sv + %15:vgpr(s64) = G_FMAXNUM %11, %10 + + ; maxnum vv + %16:vgpr(s64) = G_FMAXNUM %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- + +name: fmaxnum_f32_f64_ieee_mode_off +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: false + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fmaxnum_f32_f64_ieee_mode_off + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX8-LABEL: name: fmaxnum_f32_f64_ieee_mode_off + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + ; GFX9-LABEL: name: fmaxnum_f32_f64_ieee_mode_off + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MAX_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MAX_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MAX_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MAX_F64_:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_1:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MAX_F64_2:%[0-9]+]]:vreg_64 = V_MAX_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F64_]], implicit [[V_MAX_F64_1]], implicit [[V_MAX_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; maxnum vs + %4:vgpr(s32) = G_FMAXNUM %1, %0 + + ; maxnum sv + %5:vgpr(s32) = G_FMAXNUM %0, %1 + + ; maxnum vv + %6:vgpr(s32) = G_FMAXNUM %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; maxnum vs + %14:vgpr(s64) = G_FMAXNUM %10, %11 + + ; maxnum sv + %15:vgpr(s64) = G_FMAXNUM %11, %10 + + ; maxnum vv + %16:vgpr(s64) = G_FMAXNUM %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- +name: fmaxnum_f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fmaxnum_f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FMAXNUM:%[0-9]+]]:vgpr(s16) = G_FMAXNUM [[TRUNC]], [[TRUNC1]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM]](s16) + ; GFX8-LABEL: name: fmaxnum_f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + ; GFX9-LABEL: name: fmaxnum_f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FMAXNUM %2, %3 + S_ENDPGM 0, implicit %4 +... + +--- +name: fmaxnum_v2f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0, $sgpr1 + + ; GFX7-LABEL: name: fmaxnum_v2f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX7: [[FMAXNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM [[COPY]], [[COPY1]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM]](<2 x s16>) + ; GFX8-LABEL: name: fmaxnum_v2f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX8: [[FMAXNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM [[COPY]], [[COPY1]] + ; GFX8: S_ENDPGM 0, implicit [[FMAXNUM]](<2 x s16>) + ; GFX9-LABEL: name: fmaxnum_v2f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX9: [[FMAXNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMAXNUM [[COPY]], [[COPY1]] + ; GFX9: S_ENDPGM 0, implicit [[FMAXNUM]](<2 x s16>) + %0:vgpr(<2 x s16>) = COPY $vgpr0 + %1:vgpr(<2 x s16>) = COPY $vgpr1 + %2:vgpr(<2 x s16>) = G_FMAXNUM %0, %1 + S_ENDPGM 0, implicit %2 +... + +--- +name: fmaxnum_f16_v_fneg_v +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fmaxnum_f16_v_fneg_v + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FNEG:%[0-9]+]]:vgpr(s16) = G_FNEG [[TRUNC1]] + ; GFX7: [[FMAXNUM:%[0-9]+]]:vgpr(s16) = G_FMAXNUM [[TRUNC]], [[FNEG]] + ; GFX7: S_ENDPGM 0, implicit [[FMAXNUM]](s16) + ; GFX8-LABEL: name: fmaxnum_f16_v_fneg_v + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + ; GFX9-LABEL: name: fmaxnum_f16_v_fneg_v + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MAX_F16_e64_:%[0-9]+]]:vgpr_32 = V_MAX_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MAX_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FNEG %3 + %5:vgpr(s16) = G_FMAXNUM %2, %4 + S_ENDPGM 0, implicit %5 +... diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum-ieee.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum-ieee.mir new file mode 100644 index 00000000000..7cd2452ee78 --- /dev/null +++ b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum-ieee.mir @@ -0,0 +1,308 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s +# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX8 %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s + +--- + +name: fminnum_ieee_f32_f64_ieee_mode_on +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: true + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_on + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX8-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_on + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX9-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_on + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; minnum_ieee vs + %4:vgpr(s32) = G_FMINNUM_IEEE %1, %0 + + ; minnum_ieee sv + %5:vgpr(s32) = G_FMINNUM_IEEE %0, %1 + + ; minnum_ieee vv + %6:vgpr(s32) = G_FMINNUM_IEEE %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; minnum_ieee vs + %14:vgpr(s64) = G_FMINNUM_IEEE %10, %11 + + ; minnum_ieee sv + %15:vgpr(s64) = G_FMINNUM_IEEE %11, %10 + + ; minnum_ieee vv + %16:vgpr(s64) = G_FMINNUM_IEEE %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +# FIXME: Ideally this would fail to select with ieee mode disabled + +--- + +name: fminnum_ieee_f32_f64_ieee_mode_off +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: false + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_off + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX8-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_off + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX9-LABEL: name: fminnum_ieee_f32_f64_ieee_mode_off + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; minnum_ieee vs + %4:vgpr(s32) = G_FMINNUM_IEEE %1, %0 + + ; minnum_ieee sv + %5:vgpr(s32) = G_FMINNUM_IEEE %0, %1 + + ; minnum_ieee vv + %6:vgpr(s32) = G_FMINNUM_IEEE %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; minnum_ieee vs + %14:vgpr(s64) = G_FMINNUM_IEEE %10, %11 + + ; minnum_ieee sv + %15:vgpr(s64) = G_FMINNUM_IEEE %11, %10 + + ; minnum_ieee vv + %16:vgpr(s64) = G_FMINNUM_IEEE %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- +name: fminnum_ieee_f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fminnum_ieee_f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(s16) = G_FMINNUM_IEEE [[TRUNC]], [[TRUNC1]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM_IEEE]](s16) + ; GFX8-LABEL: name: fminnum_ieee_f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + ; GFX9-LABEL: name: fminnum_ieee_f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FMINNUM_IEEE %2, %3 + S_ENDPGM 0, implicit %4 +... + +--- +name: fminnum_ieee_v2f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0, $sgpr1 + + ; GFX7-LABEL: name: fminnum_ieee_v2f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX7: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM_IEEE [[COPY]], [[COPY1]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM_IEEE]](<2 x s16>) + ; GFX8-LABEL: name: fminnum_ieee_v2f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX8: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM_IEEE [[COPY]], [[COPY1]] + ; GFX8: S_ENDPGM 0, implicit [[FMINNUM_IEEE]](<2 x s16>) + ; GFX9-LABEL: name: fminnum_ieee_v2f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX9: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM_IEEE [[COPY]], [[COPY1]] + ; GFX9: S_ENDPGM 0, implicit [[FMINNUM_IEEE]](<2 x s16>) + %0:vgpr(<2 x s16>) = COPY $vgpr0 + %1:vgpr(<2 x s16>) = COPY $vgpr1 + %2:vgpr(<2 x s16>) = G_FMINNUM_IEEE %0, %1 + S_ENDPGM 0, implicit %2 +... + +--- +name: fminnum_ieee_f16_v_fneg_v +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fminnum_ieee_f16_v_fneg_v + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FNEG:%[0-9]+]]:vgpr(s16) = G_FNEG [[TRUNC1]] + ; GFX7: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(s16) = G_FMINNUM_IEEE [[TRUNC]], [[FNEG]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM_IEEE]](s16) + ; GFX8-LABEL: name: fminnum_ieee_f16_v_fneg_v + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + ; GFX9-LABEL: name: fminnum_ieee_f16_v_fneg_v + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FNEG %3 + %5:vgpr(s16) = G_FMINNUM_IEEE %2, %4 + S_ENDPGM 0, implicit %5 +... diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum.mir new file mode 100644 index 00000000000..e4e08cb6d7c --- /dev/null +++ b/test/CodeGen/AMDGPU/GlobalISel/inst-select-fminnum.mir @@ -0,0 +1,307 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s +# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX8 %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s + +# FIXME: Ideally this would fail to select with ieee mode enabled. +--- + +name: fminnum_f32_f64_ieee_mode_on +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: true + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fminnum_f32_f64_ieee_mode_on + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX8-LABEL: name: fminnum_f32_f64_ieee_mode_on + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX9-LABEL: name: fminnum_f32_f64_ieee_mode_on + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; minnum vs + %4:vgpr(s32) = G_FMINNUM %1, %0 + + ; minnum sv + %5:vgpr(s32) = G_FMINNUM %0, %1 + + ; minnum vv + %6:vgpr(s32) = G_FMINNUM %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; minnum vs + %14:vgpr(s64) = G_FMINNUM %10, %11 + + ; minnum sv + %15:vgpr(s64) = G_FMINNUM %11, %10 + + ; minnum vv + %16:vgpr(s64) = G_FMINNUM %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- + +name: fminnum_f32_f64_ieee_mode_off +legalized: true +regBankSelected: true +machineFunctionInfo: + mode: + ieee: false + +body: | + bb.0: + liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 + ; GFX7-LABEL: name: fminnum_f32_f64_ieee_mode_off + ; GFX7: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX7: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX7: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX7: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX7: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX7: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX7: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX7: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX7: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX7: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX8-LABEL: name: fminnum_f32_f64_ieee_mode_off + ; GFX8: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX8: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX8: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX8: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: FLAT_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4, addrspace 1) + ; GFX8: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX8: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + ; GFX9-LABEL: name: fminnum_f32_f64_ieee_mode_off + ; GFX9: [[COPY:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 + ; GFX9: [[COPY5:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 + ; GFX9: [[COPY6:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 + ; GFX9: [[V_MIN_F32_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_1:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F32_e64_2:%[0-9]+]]:vgpr_32 = V_MIN_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $exec + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_1]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: GLOBAL_STORE_DWORD [[COPY3]], [[V_MIN_F32_e64_2]], 0, 0, 0, 0, implicit $exec :: (store 4, addrspace 1) + ; GFX9: [[V_MIN_F64_:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY4]], 0, [[COPY5]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_1:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY4]], 0, 0, implicit $exec + ; GFX9: [[V_MIN_F64_2:%[0-9]+]]:vreg_64 = V_MIN_F64 0, [[COPY5]], 0, [[COPY6]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F64_]], implicit [[V_MIN_F64_1]], implicit [[V_MIN_F64_2]] + %0:sgpr(s32) = COPY $sgpr0 + %1:vgpr(s32) = COPY $vgpr0 + %2:vgpr(s32) = COPY $vgpr1 + %3:vgpr(p1) = COPY $vgpr3_vgpr4 + + %10:sgpr(s64) = COPY $sgpr10_sgpr11 + %11:vgpr(s64) = COPY $vgpr10_vgpr11 + %12:vgpr(s64) = COPY $vgpr12_vgpr13 + + ; minnum vs + %4:vgpr(s32) = G_FMINNUM %1, %0 + + ; minnum sv + %5:vgpr(s32) = G_FMINNUM %0, %1 + + ; minnum vv + %6:vgpr(s32) = G_FMINNUM %1, %2 + + G_STORE %4, %3 :: (store 4, addrspace 1) + G_STORE %5, %3 :: (store 4, addrspace 1) + G_STORE %6, %3 :: (store 4, addrspace 1) + + ; 64-bit + + ; minnum vs + %14:vgpr(s64) = G_FMINNUM %10, %11 + + ; minnum sv + %15:vgpr(s64) = G_FMINNUM %11, %10 + + ; minnum vv + %16:vgpr(s64) = G_FMINNUM %11, %12 + + S_ENDPGM 0, implicit %14, implicit %15, implicit %16 +... + +--- +name: fminnum_f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fminnum_f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FMINNUM:%[0-9]+]]:vgpr(s16) = G_FMINNUM [[TRUNC]], [[TRUNC1]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM]](s16) + ; GFX8-LABEL: name: fminnum_f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + ; GFX9-LABEL: name: fminnum_f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FMINNUM %2, %3 + S_ENDPGM 0, implicit %4 +... + +--- +name: fminnum_v2f16_vv +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0, $sgpr1 + + ; GFX7-LABEL: name: fminnum_v2f16_vv + ; GFX7: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX7: [[FMINNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM [[COPY]], [[COPY1]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM]](<2 x s16>) + ; GFX8-LABEL: name: fminnum_v2f16_vv + ; GFX8: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX8: [[FMINNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM [[COPY]], [[COPY1]] + ; GFX8: S_ENDPGM 0, implicit [[FMINNUM]](<2 x s16>) + ; GFX9-LABEL: name: fminnum_v2f16_vv + ; GFX9: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 + ; GFX9: [[FMINNUM:%[0-9]+]]:vgpr(<2 x s16>) = G_FMINNUM [[COPY]], [[COPY1]] + ; GFX9: S_ENDPGM 0, implicit [[FMINNUM]](<2 x s16>) + %0:vgpr(<2 x s16>) = COPY $vgpr0 + %1:vgpr(<2 x s16>) = COPY $vgpr1 + %2:vgpr(<2 x s16>) = G_FMINNUM %0, %1 + S_ENDPGM 0, implicit %2 +... + +--- +name: fminnum_f16_v_fneg_v +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + ; GFX7-LABEL: name: fminnum_f16_v_fneg_v + ; GFX7: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 + ; GFX7: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 + ; GFX7: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32) + ; GFX7: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32) + ; GFX7: [[FNEG:%[0-9]+]]:vgpr(s16) = G_FNEG [[TRUNC1]] + ; GFX7: [[FMINNUM:%[0-9]+]]:vgpr(s16) = G_FMINNUM [[TRUNC]], [[FNEG]] + ; GFX7: S_ENDPGM 0, implicit [[FMINNUM]](s16) + ; GFX8-LABEL: name: fminnum_f16_v_fneg_v + ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX8: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX8: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + ; GFX9-LABEL: name: fminnum_f16_v_fneg_v + ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 + ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 + ; GFX9: [[V_MIN_F16_e64_:%[0-9]+]]:vgpr_32 = V_MIN_F16_e64 0, [[COPY]], 1, [[COPY1]], 0, 0, implicit $exec + ; GFX9: S_ENDPGM 0, implicit [[V_MIN_F16_e64_]] + %0:vgpr(s32) = COPY $vgpr0 + %1:vgpr(s32) = COPY $vgpr1 + %2:vgpr(s16) = G_TRUNC %0 + %3:vgpr(s16) = G_TRUNC %1 + %4:vgpr(s16) = G_FNEG %3 + %5:vgpr(s16) = G_FMINNUM %2, %4 + S_ENDPGM 0, implicit %5 +... diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-maxnum.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-maxnum.mir deleted file mode 100644 index e8a3f6f0434..00000000000 --- a/test/CodeGen/AMDGPU/GlobalISel/inst-select-maxnum.mir +++ /dev/null @@ -1,60 +0,0 @@ -# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefixes=GCN - ---- - -name: maxnum -legalized: true -regBankSelected: true - -# GCN-LABEL: name: maxnum -body: | - bb.0: - liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 - ; GCN: [[SGPR0:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 - ; GCN: [[VGPR0:%[0-9]+]]:vgpr_32 = COPY $vgpr0 - ; GCN: [[VGPR1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 - %0:sgpr(s32) = COPY $sgpr0 - %1:vgpr(s32) = COPY $vgpr0 - %2:vgpr(s32) = COPY $vgpr1 - %3:vgpr(p1) = COPY $vgpr3_vgpr4 - - ; GCN: [[SGPR64_0:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 - ; GCN: [[VGPR64_0:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 - ; GCN: [[VGPR64_1:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 - %10:sgpr(s64) = COPY $sgpr10_sgpr11 - %11:vgpr(s64) = COPY $vgpr10_vgpr11 - %12:vgpr(s64) = COPY $vgpr12_vgpr13 - - ; maxnum vs - ; GCN: V_MAX_F32_e32 [[SGPR0]], [[VGPR0]] - %4:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %1, %0 - - ; maxnum sv - ; GCN: V_MAX_F32_e32 [[SGPR0]], [[VGPR0]] - %5:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %0, %1 - - ; maxnum vv - ; GCN: V_MAX_F32_e32 [[VGPR0]], [[VGPR1]] - %6:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %1, %2 - - G_STORE %4, %3 :: (store 4, addrspace 1) - G_STORE %5, %3 :: (store 4, addrspace 1) - G_STORE %6, %3 :: (store 4, addrspace 1) - - ; 64-bit - - ; maxnum vs - ; GCN: V_MAX_F64 0, [[SGPR64_0]], 0, [[VGPR64_0]], 0, 0 - %14:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.maxnum.f64), %10, %11 - - ; maxnum sv - ; GCN: V_MAX_F64 0, [[VGPR64_0]], 0, [[SGPR64_0]], 0, 0 - %15:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.maxnum.f64), %11, %10 - - ; maxnum vv - ; GCN: V_MAX_F64 0, [[VGPR64_0]], 0, [[VGPR64_1]], 0, 0 - %16:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.maxnum.f64), %11, %12 - - S_ENDPGM 0, implicit %14, implicit %15, implicit %16 - -... diff --git a/test/CodeGen/AMDGPU/GlobalISel/inst-select-minnum.mir b/test/CodeGen/AMDGPU/GlobalISel/inst-select-minnum.mir deleted file mode 100644 index 296888df8fb..00000000000 --- a/test/CodeGen/AMDGPU/GlobalISel/inst-select-minnum.mir +++ /dev/null @@ -1,59 +0,0 @@ -# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefixes=GCN - ---- - -name: minnum -legalized: true -regBankSelected: true - -# GCN-LABEL: name: minnum -body: | - bb.0: - liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4, $sgpr10_sgpr11, $vgpr10_vgpr11, $vgpr12_vgpr13 - ; GCN: [[SGPR0:%[0-9]+]]:sreg_32_xm0 = COPY $sgpr0 - ; GCN: [[VGPR0:%[0-9]+]]:vgpr_32 = COPY $vgpr0 - ; GCN: [[VGPR1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 - %0:sgpr(s32) = COPY $sgpr0 - %1:vgpr(s32) = COPY $vgpr0 - %2:vgpr(s32) = COPY $vgpr1 - %3:vgpr(p1) = COPY $vgpr3_vgpr4 - - ; GCN: [[SGPR64_0:%[0-9]+]]:sreg_64_xexec = COPY $sgpr10_sgpr11 - ; GCN: [[VGPR64_0:%[0-9]+]]:vreg_64 = COPY $vgpr10_vgpr11 - ; GCN: [[VGPR64_1:%[0-9]+]]:vreg_64 = COPY $vgpr12_vgpr13 - %10:sgpr(s64) = COPY $sgpr10_sgpr11 - %11:vgpr(s64) = COPY $vgpr10_vgpr11 - %12:vgpr(s64) = COPY $vgpr12_vgpr13 - - ; minnum vs - ; GCN: V_MIN_F32_e32 [[SGPR0]], [[VGPR0]] - %4:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %1, %0 - - ; minnum sv - ; GCN: V_MIN_F32_e32 [[SGPR0]], [[VGPR0]] - %5:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %0, %1 - - ; minnum vv - ; GCN: V_MIN_F32_e32 [[VGPR0]], [[VGPR1]] - %6:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %1, %2 - - G_STORE %4, %3 :: (store 4, addrspace 1) - G_STORE %5, %3 :: (store 4, addrspace 1) - G_STORE %6, %3 :: (store 4, addrspace 1) - - ; 64-bit - - ; minnum vs - ; GCN: V_MIN_F64 0, [[SGPR64_0]], 0, [[VGPR64_0]], 0, 0 - %14:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.minnum.f64), %10, %11 - - ; minnum sv - ; GCN: V_MIN_F64 0, [[VGPR64_0]], 0, [[SGPR64_0]], 0, 0 - %15:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.minnum.f64), %11, %10 - - ; minnum vv - ; GCN: V_MIN_F64 0, [[VGPR64_0]], 0, [[VGPR64_1]], 0, 0 - %16:vgpr(s64) = G_INTRINSIC intrinsic(@llvm.minnum.f64), %11, %12 - - S_ENDPGM 0, implicit %14, implicit %15, implicit %16 -... diff --git a/test/CodeGen/AMDGPU/GlobalISel/regbankselect-maxnum.mir b/test/CodeGen/AMDGPU/GlobalISel/regbankselect-maxnum.mir deleted file mode 100644 index 339ba6630dc..00000000000 --- a/test/CodeGen/AMDGPU/GlobalISel/regbankselect-maxnum.mir +++ /dev/null @@ -1,66 +0,0 @@ -# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s -# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s - ---- -name: maxnum_ss -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $sgpr1 - ; CHECK-LABEL: name: maxnum_ss - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 - ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32) - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum), [[COPY]](s32), [[COPY2]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $sgpr1 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %0, %1 -... ---- -name: maxnum_sv -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $vgpr0 - ; CHECK-LABEL: name: maxnum_sv - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum), [[COPY]](s32), [[COPY1]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $vgpr0 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %0, %1 -... ---- -name: maxnum_vs -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $vgpr0 - ; CHECK-LABEL: name: maxnum_vs - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32) - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum), [[COPY1]](s32), [[COPY2]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $vgpr0 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %1, %0 -... ---- -name: maxnum_vv -legalized: true - -body: | - bb.0: - liveins: $vgpr0, $vgpr1 - ; CHECK-LABEL: name: maxnum_vv - ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.maxnum), [[COPY]](s32), [[COPY1]](s32) - %0:_(s32) = COPY $vgpr0 - %1:_(s32) = COPY $vgpr1 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.maxnum.f32), %0, %1 -... diff --git a/test/CodeGen/AMDGPU/GlobalISel/regbankselect-minnum.mir b/test/CodeGen/AMDGPU/GlobalISel/regbankselect-minnum.mir deleted file mode 100644 index c39cfcfd035..00000000000 --- a/test/CodeGen/AMDGPU/GlobalISel/regbankselect-minnum.mir +++ /dev/null @@ -1,66 +0,0 @@ -# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s -# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s - ---- -name: minnum_ss -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $sgpr1 - ; CHECK-LABEL: name: minnum_ss - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 - ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32) - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum), [[COPY]](s32), [[COPY2]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $sgpr1 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %0, %1 -... ---- -name: minnum_sv -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $vgpr0 - ; CHECK-LABEL: name: minnum_sv - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum), [[COPY]](s32), [[COPY1]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $vgpr0 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %0, %1 -... ---- -name: minnum_vs -legalized: true - -body: | - bb.0: - liveins: $sgpr0, $vgpr0 - ; CHECK-LABEL: name: minnum_vs - ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32) - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum), [[COPY1]](s32), [[COPY2]](s32) - %0:_(s32) = COPY $sgpr0 - %1:_(s32) = COPY $vgpr0 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %1, %0 -... ---- -name: minnum_vv -legalized: true - -body: | - bb.0: - liveins: $vgpr0, $vgpr1 - ; CHECK-LABEL: name: minnum_vv - ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 - ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 - ; CHECK: [[INT:%[0-9]+]]:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.minnum), [[COPY]](s32), [[COPY1]](s32) - %0:_(s32) = COPY $vgpr0 - %1:_(s32) = COPY $vgpr1 - %2:_(s32) = G_INTRINSIC intrinsic(@llvm.minnum.f32), %0, %1 -...