[AArch64][MachineLegalizer] Mark more G_BITCAST as legal.

Basically any vector types that fits in a 32-bit register is also valid
as far as copies are concerned.

llvm-svn: 284089
This commit is contained in:
Quentin Colombet 2016-10-13 00:12:01 +00:00
parent f760799c40
commit db643d9091
2 changed files with 11 additions and 1 deletions

View File

@ -181,14 +181,21 @@ AArch64MachineLegalizer::AArch64MachineLegalizer() {
setAction({G_BITCAST, 1, Ty}, Legal);
}
// For the sake of copying bits around, the type does not really
// matter as long as it fits a register.
for (int EltSize = 8; EltSize <= 64; EltSize *= 2) {
setAction({G_BITCAST, 0, LLT::vector(128/EltSize, EltSize)}, Legal);
setAction({G_BITCAST, 1, LLT::vector(128/EltSize, EltSize)}, Legal);
if (EltSize == 64)
if (EltSize >= 64)
continue;
setAction({G_BITCAST, 0, LLT::vector(64/EltSize, EltSize)}, Legal);
setAction({G_BITCAST, 1, LLT::vector(64/EltSize, EltSize)}, Legal);
if (EltSize >= 32)
continue;
setAction({G_BITCAST, 0, LLT::vector(32/EltSize, EltSize)}, Legal);
setAction({G_BITCAST, 1, LLT::vector(32/EltSize, EltSize)}, Legal);
}
computeTables();

View File

@ -48,6 +48,7 @@ registers:
- { id: 31, class: _ }
- { id: 32, class: _ }
- { id: 33, class: _ }
- { id: 34, class: _ }
body: |
bb.0.entry:
liveins: %x0, %x1, %x2, %x3
@ -127,4 +128,6 @@ body: |
%30(<2 x s32>) = G_BITCAST %9
%31(s64) = G_BITCAST %30
%32(s32) = G_BITCAST %15
%33(<4 x s8>) = G_BITCAST %15
%34(<2 x s16>) = G_BITCAST %15
...