Skip to content

Special case the handling of Extract followed by Insert or Broadcast for SIMD #82370

Open

Description

@tannergooding

For the SIMD accelerated types, we should ensure that good codegen is generated for patterns such as:

vector4.W = otherVector4.W;

-or-

return Vector128.Create(vector128.GetElement(3);

and other similar patterns. Today, we're generating unnecessary broadcast or shuffle instructions in some scenarios when it could be handled directly be a preceding or proceeding instruction.

For example, in the first case we're generating:

C5E0C6C3FF vshufps xmm0, xmm3, xmm3, -1
C4E36921D030 vinsertps xmm2, xmm2, xmm0, 48

When we could be generating (and if xmm3 was coming from memory, it could access w directly):

vinsertps xmm2, xmm2, xmm3, 240

In the latter we're generating things such as:

C5E8C6E2FF vshufps xmm4, xmm2, xmm2, -1
C4E27918E4 vbroadcastss xmm4, xmm4

When we could have generated just:

vshufps xmm4, xmm2, xmm2, -1

Activity

  1. ghost added
    untriaged
    on Feb 19, 2023
  2. added
    area-CodeGen-coreclr
    and removed
    untriaged
    on Feb 19, 2023
  3. added this to the Future milestone on Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclr

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions