================ @@ -564,6 +564,30 @@ def CBits : DXILOp<31, unary> { let attributes = [Attributes<DXIL1_0, [ReadNone]>]; } +def FBH : DXILOp<33, unary> { + let Doc = "Returns the location of the first set bit starting from " + "the highest order bit and working downward."; + let LLVMIntrinsic = int_dx_firstbituhigh; + let arguments = [OverloadTy]; + let result = OverloadTy; + let overloads = + [Overloads<DXIL1_0, [Int16Ty, Int32Ty, Int64Ty]>]; + let stages = [Stages<DXIL1_0, [all_stages]>]; + let attributes = [Attributes<DXIL1_0, [ReadNone]>]; +} + +def FBSH : DXILOp<34, unary> { + let Doc = "Returns the location of the first set bit from " + "the highest order bit based on the sign."; + let LLVMIntrinsic = int_dx_firstbitshigh; + let arguments = [OverloadTy]; + let result = OverloadTy; + let overloads = + [Overloads<DXIL1_0, [Int16Ty, Int32Ty, Int64Ty]>]; + let stages = [Stages<DXIL1_0, [all_stages]>]; + let attributes = [Attributes<DXIL1_0, [ReadNone]>]; +} ---------------- bogner wrote:
A few things here: 1. Please name these with the full names of the dxil ops, `FirstbitHi` and `FirstbitSHi` 2. These need to use `unaryBits` for the `OpClass`, not `unary` 3. [The result type should be i32](https://github.com/microsoft/DirectXShaderCompiler/blob/release-1.8.2407/utils/hct/hctdb.py#L1410), not `OverloadTy` I'll also that this overload set does match dxc, as indicated by ["wil"](https://github.com/microsoft/DirectXShaderCompiler/blob/release-1.8.2407/utils/hct/hctdb.py#L1407) in hctdb.py, but I'm not entirely convinced that dxc does the right thing for i16 or i64. For instance, in https://hlsl.godbolt.org/z/cE1sahjKa there's no way that could return a meaningful result. That said, it's probably fine to allow i16 and i64 match dxc, as least for now. https://github.com/llvm/llvm-project/pull/111082 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits