X86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST
Optimize a pattern where a sequence of 8/16 or 32 bits is tested for zero: LLVM normalizes this towards and `AND` with mask which is usually good, but does not work well on X86 when the mask does not fit into a 64bit register. This DagToDAG peephole transforms sequences like: ``` movabsq $562941363486720, %rax # imm = 0x1FFFE00000000 testq %rax, %rdi ``` to ``` shrq $33, %rdi testw %di, %di ``` The result has a shorter encoding and saves a register if the tested value isn't used otherwise. Differential Revision: https://reviews.llvm.org/D121320
Loading
Please sign in to comment