[AArch64 NEON] Fix invalid constant used in vselect condition.
authorKevin Qin <Kevin.Qin@arm.com>
Mon, 6 Jan 2014 02:26:10 +0000 (02:26 +0000)
committerKevin Qin <Kevin.Qin@arm.com>
Mon, 6 Jan 2014 02:26:10 +0000 (02:26 +0000)
commitf14f22cebf4608056238fd5e326a6526cb1eef13
tree995346c8e4b4cd139519e137ec103a8c32e8d293
parent8cba6039daffc8bb1e8ccd3a1d647c75e87b0c30
[AArch64 NEON] Fix invalid constant used in vselect condition.

There is a wrong assumption that the vector element type and the
type of each ConstantSDNode in the build_vector were the same.
However, when promoting the integer operand of a legally typed
build_vector, the operand type and the vector element type do not
need to be the same
(See method 'DAGTypeLegalizer::PromoteIntOp_BUILD_VECTOR' in
LegalizeIntegerTypes.cpp).

  in AArch64 backend, the following dag sequence:

  C0: i1 = Constant<0>
  C1: i1 = Constant<-1>
  V: v8i1 = BUILD_VECTOR C1, C1, C0, C0, C0, C0, C0, C0

  is type-legalized into:

  NewC0: i32 = Constant<0>
  NewC1: i32 = Constant<1>
  V: v8i8 = BUILD_VECTOR NewC1, NewC1, NewC0, NewC0, NewC0, NewC0, NewC0, NewC0

Forcing a getZeroExtend to VTBits to ensure that the new constant
is correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198582 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/neon-bitwise-instructions.ll