[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 23 Oct 2022 13:47:19 +0000 (14:47 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 23 Oct 2022 13:47:24 +0000 (14:47 +0100)
commit4e8f847676fd589c456abb266afe968c20fb63e3
tree516956349b8d16bed6f07fa4169cc323e7da0ba4
parent770d5e89ba899d0306c35aa7f6f19a4736d8005b
[X86][AVX512] Fold extract_element(bitcast(<X x i1>) -> bitcast(extract_subvector())

On AVX512, extract legal bool vectors as bool subvectors before bitcasting to scalars to avoid spilling to stack.

This helps rust which internally represents bool vectors as bool arrays

It also exposes more missed opportunities to use the KADD instruction to add masks together before moving to gpr

Fixes #58546
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/bitcast-vector-bool.ll