Page MenuHomePhabricator

[AMDGPU] Fix FoldImmediate for 16 bit operand

Authored by rampitec on May 4 2020, 12:52 PM.

Diff Detail

Event Timeline

rampitec created this revision.May 4 2020, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2020, 12:52 PM
arsenm added inline comments.May 4 2020, 1:45 PM

I think just checking op 0 is sufficient


Probably should generate these checks


Adding a use instruction for all of these wouldn't hurt in case peephole-opt ever decides to prune dead instructions


Needs test with skipped hi16

rampitec updated this revision to Diff 261949.May 4 2020, 3:45 PM
rampitec marked 5 inline comments as done.

Addressed review comments.
Added processing of hi16 src subreg, it is just an imm shift.

rampitec updated this revision to Diff 261952.May 4 2020, 4:16 PM

Always drop target flags on source operand. SubReg and TargetFlags share the same field changing the meaning depending on the operand type. If I do not drop it I get something like:

S_MOV_B32 target-flags(amdgpu-gotprel32-lo) 2048

Technically it could happen with 32 subregs as well, although does not seem to happen.

vpykhtin accepted this revision.May 5 2020, 1:46 AM


This revision is now accepted and ready to land.May 5 2020, 1:46 AM
This revision was automatically updated to reflect the committed changes.