ibfe (sm5 - asm)

Given a range of bits in a number, shift those bits to the LSB and sign extend the MSB of the range.

ibfe dest[.mask], src0[.swizzle], src1[.swizzle], src2[.swizzle]
Item Description
dest
[in] The address of the results of the operation.
src0
[in] The bitfield width.
src1
[in] The bitfield offset.
src2
[in] The value to shift.

Remarks

The LSB 5 bits of src0 provide the bitfield width (0-31).

The LSB 5 bits of src1 provide the bitfield offset (0-31).

The following example shows how to use this instruction.

        Given width, offset:
                if( width == 0 )
                {
                    dest = 0
                }
                else if( width + offset < 32 )
                {
                    shl dest, src2, 32-(width+offset)
                    ishr dest, dest, 32-width
                }
                else
                {
                    ishr dest, src2, offset
                }

Use this instruction to unpack signed integers or flags.

This instruction applies to the following shader stages:

Vertex Hull Domain Geometry Pixel Compute
X X X X X X

Minimum Shader Model

This instruction is supported in the following shader models:

Shader Model Supported
Shader Model 5 yes
Shader Model 4.1 no
Shader Model 4 no
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

Shader Model 5 Assembly (DirectX HLSL)