Issue 145752
Summary [HLSL][DirectX] `firstbithigh` returns bit index from wrong side
Labels HLSL
Assignees
Reporter V-FEXrt
    https://godbolt.org/z/1ahzc64a8

DXC returns `32 - 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 https://github.com/llvm/offload-test-suite/pull/210
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to