Skip to content

[HLSL][DirectX] firstbithigh returns bit index from wrong side #145752

Open
@V-FEXrt

Description

@V-FEXrt

https://godbolt.org/z/1ahzc64a8

DXC returns 31 - firstbit(S)hi instead of directly returning firstbit(S)hi like clang currently does. This test confirms it is intentional https://github.com/microsoft/DirectXShaderCompiler/blob/b390fb19adc5d7c23180eb470470411fce986910/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/bitwise/firstbitHi.hlsl#L10

Without the inversion the result has the bit set from the wrong direction.

This is a bug in the clang lowering that was caught by llvm/offload-test-suite#210

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Support

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions