[llvm] r277749 - GlobalISel: also add G_TRUNC to IRTranslator.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 13:33:53 PDT 2016
On 18 Aug 2016, at 12:10, Quentin Colombet <qcolombet at apple.com> wrote:
> We were discussing this offline and came to the conclusion that G_TRUNC is a special case of G_EXTRACT.
> In other words, we wouldn’t need that instruction.
I think it's different for vectors (I considered reusing it at the time).
%trunc = G_EXTRACT { <4 x i16>, <4 x i32> } %src
would extract the low 64-bits of the %src reg.
It could probably be represented as a G_EXTRACT followed by a G_SEQUENCE though:
%e0, %e1, %e2, %e3 = G_EXTRACT {s16, s16, s16, s16, <4 x s32> } %src, 0, 32, 48, 64
%vec = G_SEQUENCE { <4 x s16>, s16, s16, s16, s16 } %e0, %e1, %e2, %e3
I'm not entirely convinced it would be an improvement though. Depends on how orthogonal we want these things to be.
> This would be good for us. We currently have to deal with a lot of DAG combines switching between trunc and vector extracts
I don't quite follow this. They seem pretty incompatible even in the SDag world.
Tim.
More information about the llvm-commits
mailing list