# [AArch64][GlobalISel] Fold G_XOR into TB(N)Z bit calculation9effe38b225fActions

Authored by paquette on Feb 3 2020, 2:26 PM.

# Description

[AArch64][GlobalISel] Fold G_XOR into TB(N)Z bit calculation

This ports the existing case for G_XOR from getTestBitOperand in
AArch64ISelLowering into GlobalISel.

The idea is to flip between TBZ and TBNZ while walking through G_XORs.

Let's say we have

`tbz (xor x, c), b`

Let's say the b-th bit in c is 1. Then

• If the b-th bit in x is 1, the b-th bit in (xor x, c) is 0.
• If the b-th bit in x is 0, then the b-th bit in (xor x, c) is 1.

So, then

`tbz (xor x, c), b == tbnz x, b`

Let's say the b-th bit in c is 0. Then

• If the b-th bit in x is 1, the b-th bit in (xor x, c) is 1.
• If the b-th bit in x is 0, then the b-th bit in (xor x, c) is 0.

So, then

`tbz (xor x, c), b == tbz x, b`

Differential Revision: https://reviews.llvm.org/D73929

# Details

Committed
 paquette Feb 3 2020, 3:22 PM
Differential Revision
D73929: [AArch64][GlobalISel] Fold G_XOR into TB(N)Z bit calculation
Parents
rG2252cac694f1: [ANDGPU] getMemOperandsWithOffset: support BUF non-stack-access instructionsâ€¦
Branches
Unknown
Tags
Unknown