[AArch64] Use intermediate step for concat_vectors of illegal truncs.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 17 Mar 2015 03:23:09 +0000 (03:23 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 17 Mar 2015 03:23:09 +0000 (03:23 +0000)
commitdf08543f4890b5ef42afcfab0d04d4b7ced4d71a
tree1133a175fcc9c3675d598c4eb948b735dcab3fce
parent1c48733f543465cd7cedf9079b54ca237b1cfb72
[AArch64] Use intermediate step for concat_vectors of illegal truncs.

Optimize concat_vectors of truncated vectors, where the intermediate
type is illegal, to avoid said illegality,  e.g.,
  (v4i16 (concat_vectors (v2i16 (truncate (v2i64))),
                         (v2i16 (truncate (v2i64)))))
->
  (v4i16 (truncate (v4i32 (concat_vectors (v2i32 (truncate (v2i64))),
                                          (v2i32 (truncate (v2i64)))))))

This isn't really target-specific, and, as such, would best go in the
DAGCombiner.  However, ISD::TRUNCATE legality isn't keyed on both input
and result type, so we might generate worse code when we don't know
better.  On AArch64 we know it's fine for v2i64->v4i16 and v4i32->v8i8.
rdar://20022387

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232459 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64ISelLowering.cpp
test/CodeGen/AArch64/concat_vector-truncate-combine.ll [new file with mode: 0644]