This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Implement widenScalar for G_INSERT_VECTOR_ELT
ClosedPublic

Authored by arsenm on Oct 1 2019, 5:05 PM.

Diff Detail

Event Timeline

arsenm created this revision.Oct 1 2019, 5:05 PM

For the vector itself and the inserted element, shouldn't this be using G_ANYEXT instead? Looking at the corresponding test, the G_SHL/G_ASHR on $vgpr0 should be unnecessary based on the original code.

For the element index, shouldn't this be using G_ZEXT or G_ANYEXT? I don't recall whether insertelement is supposed to interpret this argument as a signed or unsigned integer, and couldn't quickly find a reference to it. Not that it usually matters, but I find G_SEXT here surprising as well.

For the vector itself and the inserted element, shouldn't this be using G_ANYEXT instead? Looking at the corresponding test, the G_SHL/G_ASHR on $vgpr0 should be unnecessary based on the original code.

For the element index, shouldn't this be using G_ZEXT or G_ANYEXT? I don't recall whether insertelement is supposed to interpret this argument as a signed or unsigned integer, and couldn't quickly find a reference to it. Not that it usually matters, but I find G_SEXT here surprising as well.

I was just copying what the extract does. Signed doesn't particularly make sense because a negative index would be an undefined / out of bounds result

Yeah, it doesn't seem very relevant for the element argument, though precisely because of that I'd feel more comfortable with ANYEXT.

For the value argument it really does seem to make a codegen difference. It should be possible to avoid the SHL/ASHR sequence.

arsenm updated this revision to Diff 225298.Oct 16 2019, 1:11 PM

Use G_ANYEXT for vector/value

This revision is now accepted and ready to land.Oct 22 2019, 6:46 AM
arsenm closed this revision.Oct 25 2019, 1:56 PM

1a276d1e8c5da57a0c83d1b1d1a02ec0bcdb77d7