This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations
ClosedPublic

Authored by tstellarAMD on Sep 16 2016, 8:35 AM.

Details

Summary

We are using this helper for our 24-bit arithmetic combines, so we are now able to eliminate multi-use operations that mask the high-bits of 24-bit inputs (e.g. and x, 0xffffff)

Diff Detail

Event Timeline

tstellarAMD retitled this revision from to AMDGPU/SI: Eliminate more instructions that truncate inputs to 24-bit ops.
tstellarAMD updated this object.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Sep 16 2016, 8:45 AM
lib/Target/AMDGPU/AMDGPUISelLowering.cpp
2441–2449

This looks like an overly specific version of computeKnownBits. I was trying to figure out how to factor SimplifyDemandedBits to allow checking multiple uses but never got around to trying it

2444

unchecked dyn_cast

2459–2462

This can early exit if the first one failed

arsenm added inline comments.Sep 16 2016, 8:57 AM
lib/Target/AMDGPU/AMDGPUISelLowering.cpp
2441–2449

For and this could also be >= 8

lib/Target/AMDGPU/AMDGPUISelLowering.cpp
2441–2449

I looked into it, but I thought the cost of doing that would be too high. One idea I had ws to add an extra parameter for when you wanted to consider multiple uses.

Use new SimplifyDemandedBits helper to handle multiple uses.

tstellarAMD retitled this revision from AMDGPU/SI: Eliminate more instructions that truncate inputs to 24-bit ops to AMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations .Sep 27 2016, 7:44 AM
tstellarAMD updated this object.
nhaehnle accepted this revision.Sep 29 2016, 1:58 AM
nhaehnle added a reviewer: nhaehnle.

LGTM

This revision is now accepted and ready to land.Sep 29 2016, 1:58 AM
This revision was automatically updated to reflect the committed changes.