Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Actually HW_REG_SH_MEM_BASES is available starting from Gfx9. Is it possible to make it unavailable for Gfx7/8?
lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp | ||
---|---|---|
71 ↗ | (On Diff #128307) | nullptr's seem to be unacceptable right away, look at lib\Target\AMDGPU\InstPrinter\AMDGPUInstPrinter.cpp line 1311: O << "hwreg("; if (ID_SYMBOLIC_FIRST_ <= Id && Id < ID_SYMBOLIC_LAST_) { O << IdSymbolic[Id]; } else { O << Id; } Also please consider lib\Target\AMDGPU\AsmParser\AMDGPUAsmParser.cpp, line 2950. |
Please also add some testcases to test\MC\AMDGPU\sopk.s and, possibly, to sopk-err.s.
Some style-related fixes are desirable, otherwise LGTM.
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
3168 ↗ | (On Diff #128459) | Just a recommendation: const int Last = (isSI() || isCI() || isVI()) ? ID_SYMBOLIC_LAST_PRIOR_GFX9_ : ID_SYMBOLIC_LAST_; Not ideal anyway, but const at least. Up to you. |
lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp | ||
1259 ↗ | (On Diff #128459) | Ditto. |
lib/Target/AMDGPU/SIDefines.h | ||
277 ↗ | (On Diff #128459) | Recommendation: I would rename ID_SYMBOLIC_FIRST_GFX9_ to ID_SYMBOLIC_LAST_PRIOR_GFX9_ or alike. |
277 ↗ | (On Diff #128459) | Value should be set to 8, as it was prior these changes. |
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
3168 ↗ | (On Diff #128459) | With more values added in the future this expression would become hardly readable. |
lib/Target/AMDGPU/SIDefines.h | ||
277 ↗ | (On Diff #128459) | If it will be 8 the patch would not work. We shall recognize sh_mem_bases on GFX9. |
277 ↗ | (On Diff #128459) |
To me that would be cryptic ;) |
Let's reach consensus.
lib/Target/AMDGPU/SIDefines.h | ||
---|---|---|
277 ↗ | (On Diff #128459) | I mean that ID_SYMBOLIC_LAST_PRIOR_GFX9_ shall be set to 8 (which is currently named ID_SYMBOLIC_FIRST_GFX9_). That enum member is not used on Gfx9, as far as I see, and does not prevent ID_MEM_BASES from being recognized. Am I wrong somewhere? |
277 ↗ | (On Diff #128459) |
To me, what is really cryptic is when ...FIRST... is assigned to Last in lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp#1259 and lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp#3168, like this: unsigned Last = ID_SYMBOLIC_LAST_; if (AMDGPU::isSI(STI) || AMDGPU::isCI(STI) || AMDGPU::isVI(STI)) Last = ID_SYMBOLIC_FIRST_GFX9_; |
I believe the source of inconsistency is the original definition of ID_SYMBOLIC_LAST_, which does not point to a last value in the enum, but a last + 1. This can be changed in a separate patch.
Yes, the names are not consistent with an original idea. However, I recommend renaming *FIRST*/*LAST* to *BEGIN*/*END* to better express iterator-like semantics. Thanks for catching this.