Skip to content

Conversation

RKSimon
Copy link
Collaborator

@RKSimon RKSimon commented Oct 7, 2025

Attempt to bring together self-additions, to help with folding to shift/mul/address patterns

Attempt to bring together self-additions, to help with folding to shift/mul/address patterns
; GFX10-DL-NEXT: global_store_dword v2, v0, s[6:7]
; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
; GFX10-DL-NEXT: v_add_nc_u32_e32 v0, v0, v0
; GFX10-DL-NEXT: v_mad_u32_u24 v0, v2, v1, v0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayfoad @arsenm It looks like we're missing demanded bits handling for MAD24 instructions - but I haven't found much in the DAG that handles the MAD24 opcodes at all - is this all currently done with isel patterns? Is it going to cause problems if I try to add MAD24 DAG lowering?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the code in front of me but I think it's mostly done in IR in AMDGPUCodeGenPrepare. We'd like to form mul24 when only the low 24 bits of a regular mul are demanded, but I don't think there's an easy way to implement a target-specific demanded bits optimization for a generic node like MUL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we handle both AMDGPUCodeGenPrepare and a dag combine. We appear to be missing SimplifyDemandedBitsForTargetNode

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fine plenty in CGP/DAG for MUL24 but not much for MAD24

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the mad24 case I think is just a td pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants