[llvm] [AMDGPU][MC] update USER_SGPR_COUNT bits for GFX1250 (PR #192579)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 17:11:56 PDT 2026


================
@@ -136,17 +136,27 @@ static uint64_t getPGMRSrc1Reg(const SIProgramInfo &ProgInfo,
   return Reg;
 }
 
-static uint64_t getComputePGMRSrc2Reg(const SIProgramInfo &ProgInfo) {
-  uint64_t Reg = S_00B84C_USER_SGPR(ProgInfo.UserSGPR) |
-                 S_00B84C_TRAP_HANDLER(ProgInfo.TrapHandlerEnable) |
-                 S_00B84C_TGID_X_EN(ProgInfo.TGIdXEnable) |
-                 S_00B84C_TGID_Y_EN(ProgInfo.TGIdYEnable) |
-                 S_00B84C_TGID_Z_EN(ProgInfo.TGIdZEnable) |
-                 S_00B84C_TG_SIZE_EN(ProgInfo.TGSizeEnable) |
-                 S_00B84C_TIDIG_COMP_CNT(ProgInfo.TIdIGCompCount) |
-                 S_00B84C_EXCP_EN_MSB(ProgInfo.EXCPEnMSB) |
-                 S_00B84C_LDS_SIZE(ProgInfo.LdsSize) |
-                 S_00B84C_EXCP_EN(ProgInfo.EXCPEnable);
+static uint64_t getComputePGMRSrc2Reg(const GCNSubtarget &ST,
+                                      const SIProgramInfo &ProgInfo) {
+  uint64_t MaxNumerUserSGRPs = AMDGPU::getMaxNumUserSGPRs(ST);
+  uint64_t Reg = 0;
+  if (MaxNumerUserSGRPs == 32) {
+    Reg = S_00B84C_USER_SGPR_GFX1250(ProgInfo.UserSGPR);
+  } else if (MaxNumerUserSGRPs == 16) {
+    Reg = (S_00B84C_USER_SGPR(ProgInfo.UserSGPR) |
+           S_00B84C_TRAP_HANDLER(ProgInfo.TrapHandlerEnable));
+  } else {
+    report_fatal_error("Max Number of User SGPRs are either 32 or 16");
----------------
shiltian wrote:

```suggestion
    llvm_unreachable("max Number of User SGPRs are either 32 or 16");
```

Tt is not something really wrong, but just something that we don't foresee yet.

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


More information about the llvm-commits mailing list