Skip to content

AdvSimd shift+widen invalid imm8 range #122590

@ovska

Description

@ovska

Description

AdvSimd.ShiftLeftLogicalWideningLower and friends have the imm argument limited to one too low. For example only 7 when widening bytes. Docs say you should be able to use the full bit width (e.g. 8 on uint8):
https://developer.arm.com/documentation/dui0473/m/neon-instructions/vshll--by-immediate-

Reproduction Steps

AdvSimd.ShiftLeftLogicalWideningLower(Vector64<byte>.One, 8)

Encountered when trying to widen a byte vector's MSB's to uints.

Expected behavior

Imm8 range 0..8

Actual behavior

Imm8 range 0..7, using 8 produces a diagnostic and throws an exception on runtime

Regression?

Known Workarounds

Widen first, then shift manually (a few extra ops).

Configuration

.NET 10.0.100
macOS 26.1 (25B78)

Other information

No response

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