- Replace 'cmp+sel' with 'umin' if possible.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
2473 | The comment says 33 if Hi and Lo have the same sign, but the expression gives 33 if they have different sign. Do you want 33 - ((Lo ^ Hi) >> 31)? |
Comment Actions
Fix the calculation of MaxShAmt.
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
2473 | Good catch. That's wrong. Corrected in the latest revision. |
Comment Actions
LGTM, thanks!
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
2493–2494 | Another possible micro-optimization is to push the -1 into the umin, to shorten the critical path: umin((ffbh hi)-1, ((hi^lo) ashr 31)+32) |
The comment says 33 if Hi and Lo have the same sign, but the expression gives 33 if they have different sign. Do you want 33 - ((Lo ^ Hi) >> 31)?