Skip to content

Implement the InterlockedCompareStoreFloatBitwise HLSL Function #99202

Open
@farzonl

Description

@farzonl
  • Implement InterlockedCompareStoreFloatBitwise clang builtin,
  • Link InterlockedCompareStoreFloatBitwise clang builtin with hlsl_intrinsics.h
  • Add sema checks for InterlockedCompareStoreFloatBitwise to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for InterlockedCompareStoreFloatBitwise to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/InterlockedCompareStoreFloatBitwise.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/InterlockedCompareStoreFloatBitwise-errors.hlsl
  • Create the int_dx_InterlockedCompareStoreFloatBitwise intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_InterlockedCompareStoreFloatBitwise to 79 in DXIL.td
  • Create the InterlockedCompareStoreFloatBitwise.ll and InterlockedCompareStoreFloatBitwise_errors.ll tests in llvm/test/CodeGen/DirectX/

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
79 AtomicCompareExchange 6.0 ()

SPIR-V

There is no support for InterlockedCompareStoreFloatBitwise when targeting SPIR-V.

Test Case(s)

Example 1

//dxc InterlockedCompareStoreFloatBitwise_test.hlsl -T lib_6_8 -enable-16bit-types -O0

RWStructuredBuffer<float> buffer : register(u0);
[numthreads(1, 1, 1)]
export void fn(uint3 dispatchThreadID : SV_DispatchThreadID, float p1, float p2) {
int index = dispatchThreadID.x;
    return InterlockedCompareStoreFloatBitwise(buffer[index], p1, p2);
}

HLSL:

Syntax

void InterlockedCompareStoreFloatBitwise(float32_only result, float compare, float value);
void InterlockedCompareStoreFloatBitwise(uint byteOffest, float compare, float value);

Type Description

Name Template Type Component Type Size
ret void void 0
result scalar float 1
compare scalar float 1
value scalar float 1

Type Description

Name Template Type Component Type Size
ret void void 0
byteOffest scalar uint 1
compare scalar float 1
value scalar float 1

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6.3 and higher shader models yes

Shader Stages

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Supportbackend:DirectXbot:HLSLmetaissueIssue to collect references to a group of similar or related issues.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions