Skip to content

[X86] Failure to merge PINSRW insertions #129056

@RKSimon

Description

@RKSimon
define <16 x i16> @ff(<16 x i16> %x, i16 %s) {
  %i0 = insertelement <16 x i16> %x, i16 %s, i32 0
  %i1 = insertelement <16 x i16> %i0, i16 %s, i32 8
  ret <16 x i16> %i1
}

llc -mcpu=x86-64-v3

ff: # @ff
  vpinsrw $0, %edi, %xmm0, %xmm1
  vpblendd $15, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
  vmovd %edi, %xmm1
  vpbroadcastw %xmm1, %ymm1
  vpblendw $1, %ymm1, %ymm0, %ymm1 # ymm1 = ymm1[0],ymm0[1,2,3,4,5,6,7],ymm1[8],ymm0[9,10,11,12,13,14,15]
  vpblendd $240, %ymm1, %ymm0, %ymm0 # ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
  retq

This should just perform the vmovd+vpbroadcastw to transfer %edi once

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions