[AArch64] Add more efficient vector bitcast for AArch64
authorLawrence Benson <github@lawben.com>
Thu, 13 Apr 2023 15:44:09 +0000 (16:44 +0100)
committerDavid Green <david.green@arm.com>
Thu, 13 Apr 2023 15:44:09 +0000 (16:44 +0100)
commit3653722ce6d9bb44a42ffdce4e07080aa1928ddc
tree7b0f92e6a33f372ddc338139957a7e7ddfcfb157
parentaa754f7e0fddcc6c4d6737c71baf357825b09a3e
[AArch64] Add more efficient vector bitcast for AArch64

Adds a DAG combine checks for vector comparisons followed by a bitcast to a
scalar value. Previously, this resulted in an expand.  Now, this is done with a
constant number of instructions that take one bit per vector value (via an AND
mask) and perfom a horizontal add to get a single value. This is especially
useful for Clang's __builtin_convertvector() to a bool vector.

Issue: https://github.com/llvm/llvm-project/issues/59829

Differential Revision: https://reviews.llvm.org/D145301
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/vec-combine-compare-to-bitmask.ll [new file with mode: 0644]