https://github.com/optimisan updated https://github.com/llvm/llvm-project/pull/109963
>From b86a822c6eb4c7080eb45cde7a71da76346e19c7 Mon Sep 17 00:00:00 2001 From: Akshat Oke <akshat....@amd.com> Date: Wed, 25 Sep 2024 11:21:04 +0000 Subject: [PATCH 1/2] [AMDGPU] Add tests for SIPreAllocateWWMRegs --- .../AMDGPU/si-pre-allocate-wwm-regs.mir | 26 +++++++++++++++++++ .../si-pre-allocate-wwm-sgpr-spills.mir | 21 +++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir create mode 100644 llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir new file mode 100644 index 00000000000000..f2db299f575f5e --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir @@ -0,0 +1,26 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s + +--- + +name: pre_allocate_wwm_regs_strict +tracksRegLiveness: true +body: | + bb.0: + liveins: $sgpr1 + ; CHECK-LABEL: name: pre_allocate_wwm_regs_strict + ; CHECK: liveins: $sgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF + ; CHECK-NEXT: renamable $sgpr4_sgpr5 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec + ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec + ; CHECK-NEXT: dead $vgpr0 = V_MOV_B32_dpp $vgpr0, [[DEF]], 323, 12, 15, 0, implicit $exec + ; CHECK-NEXT: $exec = EXIT_STRICT_WWM killed renamable $sgpr4_sgpr5 + ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]] + %0:vgpr_32 = IMPLICIT_DEF + renamable $sgpr4_sgpr5 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec + %24:vgpr_32 = V_MOV_B32_e32 0, implicit $exec + %25:vgpr_32 = V_MOV_B32_dpp %24:vgpr_32(tied-def 0), %0:vgpr_32, 323, 12, 15, 0, implicit $exec + $exec = EXIT_STRICT_WWM killed renamable $sgpr4_sgpr5 + %2:vgpr_32 = COPY %0:vgpr_32 +... diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir new file mode 100644 index 00000000000000..f0efe74878d831 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir @@ -0,0 +1,21 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple=amdgcn -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s + +--- + +name: pre_allocate_wwm_spill_to_vgpr +tracksRegLiveness: true +body: | + bb.0: + liveins: $sgpr1 + ; CHECK-LABEL: name: pre_allocate_wwm_spill_to_vgpr + ; CHECK: liveins: $sgpr1 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF + ; CHECK-NEXT: dead $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, [[DEF]] + ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]] + %0:vgpr_32 = IMPLICIT_DEF + %23:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0:vgpr_32 + %2:vgpr_32 = COPY %0:vgpr_32 +... + >From d2032b2fbe68d9d9cabb70c124a10ed6d0a35122 Mon Sep 17 00:00:00 2001 From: Akshat Oke <akshat....@amd.com> Date: Mon, 7 Oct 2024 09:13:04 +0000 Subject: [PATCH 2/2] Keep tests in one file --- .../AMDGPU/si-pre-allocate-wwm-regs.mir | 31 ++++++++++++++++--- .../si-pre-allocate-wwm-sgpr-spills.mir | 21 ------------- 2 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir index f2db299f575f5e..2ca275cf950564 100644 --- a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir +++ b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir @@ -1,6 +1,8 @@ # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 -# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s +# RUN: llc -mtriple=amdgcn -mcpu=tahiti -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - %s | FileCheck %s +# RUN: llc -mtriple=amdgcn -mcpu=tahiti -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - %s | FileCheck %s --check-prefix=CHECK2 +# COM: auto-generated updates might remove checks for MachineFunctionInfo reserved registers. --- name: pre_allocate_wwm_regs_strict @@ -9,6 +11,8 @@ body: | bb.0: liveins: $sgpr1 ; CHECK-LABEL: name: pre_allocate_wwm_regs_strict + ; CHECK: wwmReservedRegs: + ; CHECK-NEXT: - '$vgpr0' ; CHECK: liveins: $sgpr1 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF @@ -19,8 +23,27 @@ body: | ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]] %0:vgpr_32 = IMPLICIT_DEF renamable $sgpr4_sgpr5 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec - %24:vgpr_32 = V_MOV_B32_e32 0, implicit $exec - %25:vgpr_32 = V_MOV_B32_dpp %24:vgpr_32(tied-def 0), %0:vgpr_32, 323, 12, 15, 0, implicit $exec + %1:vgpr_32 = V_MOV_B32_e32 0, implicit $exec + %2:vgpr_32 = V_MOV_B32_dpp %1, %0, 323, 12, 15, 0, implicit $exec $exec = EXIT_STRICT_WWM killed renamable $sgpr4_sgpr5 - %2:vgpr_32 = COPY %0:vgpr_32 + %3:vgpr_32 = COPY %0 +... +--- + +name: pre_allocate_wwm_spill_to_vgpr +tracksRegLiveness: true +body: | + bb.0: + liveins: $sgpr1 + ; CHECK2-LABEL: name: pre_allocate_wwm_spill_to_vgpr + ; CHECK2: wwmReservedRegs: + ; CHECK2-NEXT: - '$vgpr0' + ; CHECK2: liveins: $sgpr1 + ; CHECK2-NEXT: {{ $}} + ; CHECK2-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF + ; CHECK2-NEXT: dead $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, [[DEF]] + ; CHECK2-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]] + %0:vgpr_32 = IMPLICIT_DEF + %1:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0 + %2:vgpr_32 = COPY %0 ... diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir deleted file mode 100644 index f0efe74878d831..00000000000000 --- a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir +++ /dev/null @@ -1,21 +0,0 @@ -# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 -# RUN: llc -mtriple=amdgcn -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s - ---- - -name: pre_allocate_wwm_spill_to_vgpr -tracksRegLiveness: true -body: | - bb.0: - liveins: $sgpr1 - ; CHECK-LABEL: name: pre_allocate_wwm_spill_to_vgpr - ; CHECK: liveins: $sgpr1 - ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF - ; CHECK-NEXT: dead $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, [[DEF]] - ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]] - %0:vgpr_32 = IMPLICIT_DEF - %23:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0:vgpr_32 - %2:vgpr_32 = COPY %0:vgpr_32 -... - _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits