//META: generated=true
//META: model=claude-opus-4-7
//META: generated_at=2026-05-20T17:00:00+00:00
//META: source_commit=ecefa0388fc4ccf7d14670c7bf1eccc88a7bdd14
//META: doc_ref=docs/generated/design/ir-reference/resources-and-atomics.md#buffer-load-and-store
//META: doc_section_digest=a5cc503aaed86633e5970cfcf6ca63262c9a68fc95f6b94e9a9eaf7fe399c9fd
//META: purpose=`ByteAddressBuffer::Load(offset)` surfaces the `byteAddressBufferLoad(%buf, %offset, %alignment)` opcode inside the pulled-in library function body for `ByteAddressBuffer.Load`.
//META: intent=functional
//META: pipeline_stage=lower
//META: warning=Auto-generated. May drift from source. Do not edit by hand.

// The doc says `byteAddressBufferLoad` is produced by lowering
// `ByteAddressBuffer::Load*` methods. At LOWER-TO-IR the opcode
// appears inside the library function `ByteAddressBuffer_Load`,
// not on `main` directly — `main` hosts a `call` of that helper.

//TEST:SIMPLE(filecheck=IR):-target spirv-asm -dump-ir -o /dev/null -stage compute -entry main

uniform ByteAddressBuffer babuf;
uniform RWStructuredBuffer<uint> rwbuf;

[numthreads(1, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
    uint idx = tid.x;
    uint v = babuf.Load(idx * 4);
    rwbuf[idx] = v;
}

// IR: byteAddressBufferLoad(%{{[^,]+}}, %{{[^,]+}}, {{.*}})
