[llvm] AMDGPU/GlobalISel: Add regbanklegalize rules for load and store (PR #153176)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 07:53:12 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.cpp llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.h llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp b/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp
index b2259ac78..87505ad60 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp
@@ -819,33 +819,46 @@ RegBankLegalizeRules::RegBankLegalizeRules(const GCNSubtarget &_ST,
   addRulesForGOpcs({G_STORE})
       // addrspace(0)
       .Any({{S16, P0}, {{}, {Vgpr16, VgprP0}}}, usesTrue16) // 16-bit store
-      .Any({{B32, P0}, {{}, {VgprB32, VgprP0}}}) // 32-bit store, 8-bit and 16-bit truncating store
+      .Any({{B32, P0},
+            {{},
+             {VgprB32,
+              VgprP0}}}) // 32-bit store, 8-bit and 16-bit truncating store
       .Any({{B64, P0}, {{}, {VgprB64, VgprP0}}})
       .Any({{B96, P0}, {{}, {VgprB96, VgprP0}}})
       .Any({{B128, P0}, {{}, {VgprB128, VgprP0}}})
 
-       // addrspace(1), there are no stores to addrspace(4)
-       // For targets:
-       // - with "+flat-for-global" - global_store
-       // - without(-flat-for-global) - buffer_store addr64
+      // addrspace(1), there are no stores to addrspace(4)
+      // For targets:
+      // - with "+flat-for-global" - global_store
+      // - without(-flat-for-global) - buffer_store addr64
       .Any({{S16, DivP1}, {{}, {Vgpr16, VgprP1}}}, usesTrue16) // 16-bit store
-      .Any({{B32, DivP1}, {{}, {VgprB32, VgprP1}}}) // 32-bit store, 8-bit and 16-bit truncating store
+      .Any({{B32, DivP1},
+            {{},
+             {VgprB32,
+              VgprP1}}}) // 32-bit store, 8-bit and 16-bit truncating store
       .Any({{B64, DivP1}, {{}, {VgprB64, VgprP1}}})
       .Any({{B96, DivP1}, {{}, {VgprB96, VgprP1}}})
       .Any({{B128, DivP1}, {{}, {VgprB128, VgprP1}}})
 
-       // For UniP1, use sgpr ptr to match flat-for-global patterns. Targets:
-       // - with "+flat-for-global" - global_store for both sgpr and vgpr ptr
-       // - without(-flat-for-global) - need sgpr ptr to select buffer_store
+      // For UniP1, use sgpr ptr to match flat-for-global patterns. Targets:
+      // - with "+flat-for-global" - global_store for both sgpr and vgpr ptr
+      // - without(-flat-for-global) - need sgpr ptr to select buffer_store
       .Any({{S16, UniP1}, {{}, {Vgpr16, SgprP1}}}, usesTrue16) // 16-bit store
-      .Any({{B32, UniP1}, {{}, {VgprB32, SgprP1}}}) // 32-bit store, 8-bit and 16-bit truncating store
+      .Any({{B32, UniP1},
+            {{},
+             {VgprB32,
+              SgprP1}}}) // 32-bit store, 8-bit and 16-bit truncating store
       .Any({{B64, UniP1}, {{}, {VgprB64, SgprP1}}})
       .Any({{B96, UniP1}, {{}, {VgprB96, SgprP1}}})
       .Any({{B128, UniP1}, {{}, {VgprB128, SgprP1}}})
 
       // addrspace(3) and addrspace(5)
-      .Any({{S16, Ptr32}, {{}, {Vgpr16, VgprPtr32}}}, usesTrue16) // 16-bit store
-      .Any({{B32, Ptr32}, {{}, {VgprB32, VgprPtr32}}}) // 32-bit store, 8-bit and 16-bit truncating store
+      .Any({{S16, Ptr32}, {{}, {Vgpr16, VgprPtr32}}},
+           usesTrue16) // 16-bit store
+      .Any({{B32, Ptr32},
+            {{},
+             {VgprB32,
+              VgprPtr32}}}) // 32-bit store, 8-bit and 16-bit truncating store
       .Any({{B64, Ptr32}, {{}, {VgprB64, VgprPtr32}}})
       .Any({{B96, Ptr32}, {{}, {VgprB96, VgprPtr32}}})
       .Any({{B128, Ptr32}, {{}, {VgprB128, VgprPtr32}}});

``````````

</details>


https://github.com/llvm/llvm-project/pull/153176


More information about the llvm-commits mailing list