[all-commits] [llvm/llvm-project] 66c1b6: [AArch64] Optimize lowering of i1 vector reduction...
Cheng Lingfei via All-commits
all-commits at lists.llvm.org
Tue Apr 28 11:59:06 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 66c1b6f0194bec99396e358f997d771d5e3bd28d
https://github.com/llvm/llvm-project/commit/66c1b6f0194bec99396e358f997d771d5e3bd28d
Author: Cheng Lingfei <53817093+clingfei at users.noreply.github.com>
Date: 2026-04-28 (Tue, 28 Apr 2026)
Changed paths:
M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
A llvm/test/CodeGen/AArch64/bool-vector-bitcast-compare.ll
M llvm/test/CodeGen/AArch64/dag-combine-setcc.ll
M llvm/test/CodeGen/AArch64/illegal-floating-point-vector-compares.ll
M llvm/test/CodeGen/AArch64/neon-anyof-splat.ll
Log Message:
-----------
[AArch64] Optimize lowering of i1 vector reduction (#187912)
This pr optimizes code generation in AArch64 for comparing bitcast <N x
i1> results with 0 or -1 using eq/ne. For scenarios where only "all
zeros or all 1s" are considered, the backend no longer prioritizes
materializing packed bitmasks and using vector reduction methods like
addv/umaxv/uminv. Instead, it expands the boolean vector into a regular
integer vector and performs the comparison via a more direct scalar
comparison path. For 64-bit and 128-bit cases that can be folded down to
64-bit, a lighter instruction sequence like fmov + cmp/cmn + cset/csel
is generated.
Functionally, this brings several benefits:
- Optimized the `setcc(bitcast(vNi1), 0/-1)` and
`select_cc(bitcast(vNi1), 0/-1, ...)` modes.
- In scenarios like <8 x i1>, a zero/all-one check can be performed
directly on the entire comparison result, avoiding additional vector
lateral reduction.
- In 128-bit scenarios like <16 x i1>, the vector is first folded using
ext + orr/and before a scalar comparison is performed.
Closes https://github.com/llvm/llvm-project/issues/186710.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list