Skip to content

Vector-AND's with constant Vectors of <i64 {DDDD}, i64 poison> should not load the constant in through GPR's #145284

Open
@Validark

Description

@Validark

Zig Godbolt LLVM Godbolt

define dso_local <8 x i8> @foo(<16 x i8> %0) local_unnamed_addr {
Entry:
  %1 = bitcast <16 x i8> %0 to <2 x i64>
  %2 = and <2 x i64> %1, <i64 72340172838076673, i64 poison>
  %3 = tail call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %2, <2 x i64> <i64 -1, i64 poison>, i8 signext 0)
  %.sroa.0.0.vec.extract.i = extractelement <2 x i64> %3, i64 0
  %4 = bitcast i64 %.sroa.0.0.vec.extract.i to <8 x i8>
  ret <8 x i8> %4
}

declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8 immarg) #1

Compiles to:

foo:                                    # @foo
        movabs  rax, 72340172838076673
        vmovq   xmm1, rax
        vpand   xmm0, xmm0, xmm1
        vpcmpeqd        xmm1, xmm1, xmm1
        vpclmulqdq      xmm0, xmm0, xmm1, 0
        ret

Should be:

.LCPI0_1:
        .zero   4,1
foo:
        vandps  xmm0, xmm0, dword ptr [rip + .LCPI0_1]{1to4}
        vpcmpeqd        xmm1, xmm1, xmm1
        vpclmulqdq      xmm0, xmm0, xmm1, 0
        ret

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