[asm] Replace RawOp string hacks with typed SALUPhys ops for physical…#1080
Open
harsh-nod wants to merge 1 commit intoiree-org:mainfrom
Open
[asm] Replace RawOp string hacks with typed SALUPhys ops for physical…#1080harsh-nod wants to merge 1 commit intoiree-org:mainfrom
harsh-nod wants to merge 1 commit intoiree-org:mainfrom
Conversation
… register writes RawOp was used to emit s_mov_b32/s_mov_b64/s_and_b32/s_or_b32 as raw assembly strings because the Pure trait on SALUUnaryOp/SALUBinaryOp causes DCE to eliminate ops whose SSA results have no consumer — which is exactly the case for SRD setup writes to physical registers. Introduce SALUPhysUnaryOp and SALUPhysBinaryOp base classes that use the SpecialRegOp trait (non-Pure, prevents DCE/CSE) and take the destination physical register as an input operand rather than an SSA result. Add four concrete ops: S_MOV_B32_PHYS, S_MOV_B64_PHYS, S_AND_B32_PHYS, S_OR_B32_PHYS. Replace 15 RawOp::create calls across emitSRDPrologue(), handleVectorStore() SRD adjustment, and handleFatRawBufferCast() with the new typed ops. Assembly output is identical — same mnemonics, operands, and instruction count. Three RawOps remain for s_branch, .p2align, and label directives which have no typed op equivalent. Add lit test verifying SALUPhys ops survive CSE while Pure variants are still eliminated. Signed-off-by: Harsh Menon <harsh.menon@amd.com>
Contributor
|
Actually, you can just introduce something like |
Contributor
|
So, I looked into this more, we have
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… register writes
RawOp was used to emit s_mov_b32/s_mov_b64/s_and_b32/s_or_b32 as raw assembly strings because the Pure trait on SALUUnaryOp/SALUBinaryOp causes DCE to eliminate ops whose SSA results have no consumer — which is exactly the case for SRD setup writes to physical registers.
Introduce SALUPhysUnaryOp and SALUPhysBinaryOp base classes that use the SpecialRegOp trait (non-Pure, prevents DCE/CSE) and take the destination physical register as an input operand rather than an SSA result. Add four concrete ops: S_MOV_B32_PHYS, S_MOV_B64_PHYS, S_AND_B32_PHYS, S_OR_B32_PHYS.
Replace 15 RawOp::create calls across emitSRDPrologue(), handleVectorStore() SRD adjustment, and handleFatRawBufferCast() with the new typed ops. Assembly output is identical — same mnemonics, operands, and instruction count.
Three RawOps remain for s_branch, .p2align, and label directives which have no typed op equivalent.
Add lit test verifying SALUPhys ops survive CSE while Pure variants are still eliminated.