GlobalISel: Fix lowerSelect handling of boolean high bits
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 12 Apr 2022 01:11:26 +0000 (21:11 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 12 Apr 2022 20:54:03 +0000 (16:54 -0400)
commit3f2cc7cc2b17ea6b7c09470ffc75b4691ce3ea95
tree736236fcd1e6044f1bb49891b803877084346493
parent0e489926be00326b09fb4dd51d76c758056d358c
GlobalISel: Fix lowerSelect handling of boolean high bits

This was making several invalid assumptions about the incoming
select. First, it was assuming the incoming condition was either s1 or
already sign extended, not accounting for different boolean high bits
behavior between scalar and vector conditions. We only had a vector
boolean due to the intermediate step vector select, which is now
avoided.

Second, it was assuming it can use the result vector type as a boolean
mask. These types don't have anything to do with other, and only makes
sense in the context of the expansion to bit operations. Since these
logically are part of the same lowering, do the complete expansion in
a single step.

The added select_v4s1_s1 test does fail to legalize, since it seems
AArch64's vector legalization support is pretty incomplete.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir