[RISCV] Add test cases showing missed opportunity to use shXadd.uw. NFC
The tests here show the codegen for something like this C code. unsigned diff = ptr1 - ptr2; return ptr3[diff]; The pointer difference is truncated to 32-bits before being used again as an index. In SelectionDAG this appears as an AND between a SRL and a SHL. DAGCombiner will remove the shifts leaving only an AND. The Mask now has 1,2, or 3 trailing zeros and 31, 30, or 29 leading zeros. We end up falling back to constant materialization to create this mask. We could instead use srli followed by slli.uw. Or since we have an add, we can use srli followed by shXadd.uw. Differential Revision: https://reviews.llvm.org/D126589
Loading
Please sign in to comment