//META: generated=true
//META: model=claude-opus-4-7
//META: generated_at=2026-05-20T17:16:11+00:00
//META: source_commit=ecefa0388fc4ccf7d14670c7bf1eccc88a7bdd14
//META: doc_ref=docs/generated/design/target-pipelines/hlsl.md#phase-c-hlsl-legalization-lowering-phi-elimination
//META: doc_section_digest=549f8ae382ad795540f97904e8ba737a55b9729a516fa91350bc135710a2f1a2
//META: purpose=An atomic operation on a UAV survives Phase C (validateAtomicOperations runs for non-SPIRV targets) and emits as the HLSL interlocked intrinsic.
//META: intent=functional
//META: pipeline_stage=emit
//META: warning=Auto-generated. May drift from source. Do not edit by hand.

// The Phase C table lists `validateAtomicOperations` for non-SPIRV
// targets. HLSL accepts the validated IR, and the HLSL emitter
// chooses the matching `InterlockedAdd(...)` intrinsic on the
// UAV access.

//TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry main -stage compute

RWStructuredBuffer<int> outBuf;

[shader("compute")]
[numthreads(8, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
    InterlockedAdd(outBuf[0], int(tid.x));
}

// CHECK: InterlockedAdd(
