Skip to content

[SPIRV][Vulkan] Invalid SPIRV generation for HLSL sign #149722

@llvm-beanz

Description

@llvm-beanz

Given the following code:

StructuredBuffer<int4> In1 : register(t0);
RWStructuredBuffer<int4> Out1 : register(u4);

[numthreads(1,1,1)]
void main() {
  // int
  Out1[0] = sign(In1[0]);
  int4 Tmp = {sign(In1[0].xyz), sign(In1[0].w)};
  Out1[1] = Tmp;
  Out1[2].xy = sign(In1[0].xy);
}

Compiler Explorer

The generated SPIRV contains an invalid OpVectorShuffle instruction:

%69 = OpVectorShuffle %4 %66 %33 0 1 -1 -1

Compiler Explorer

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions