HLSL 2021 abandoned SELECT
Description
HLSL2021 added short circuit feature but it accidently(or on purpose?) abandoned SELECT. Instead it will use BR to simulate which dropped the performance a lot if there're multiple this kind of call.
see DirectXShaderCompiler\tools\clang\lib\CodeGen\CGExprScalar.cpp, function VisitAbstractConditionalOperator()
Steps to Reproduce HLSL like: result = inputW > 0 ? data_ptr[inputIdx - 1] * kernel_ptr[kernelIdx] : 0;
Actual Behavior we should still have chance to use SELECT.
Environment
- DXC version : release since DX Compiler release for August 2023.
- Host Operating System: Windows
Can you generate a repro on godbolt please? This trivial case generates select: https://godbolt.org/z/EMvqxaWeh
You can generate select by using the select intrinsic. See https://devblogs.microsoft.com/directx/hlsl-2021-migration-guide/ for more details.