[HLSL][DirectX] Implement the `SV_Target` semantic
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Add `SV_Target` (`SV_TargetN`) to the list of parsed semantics. Then lower as follows:
DXIL: `StoreOutput` op (`dx.op.storeOutput`, opcode 5) indexed by its render-target number.
SPIRV: Already implemented
Reference [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#system-value-constraints) for its type constraints. Reference the [pixel](https://github.com/llvm/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#pixel-shader) shader section for packing info and where valid.
An offload test already exists for this intrinsic.
AC:
- [ ] Add the semantic spelling in `Attr.td`
- [ ] Update `CGHLSLRuntime` to handle the semantic spelling and its render-target index
- [ ] Update `SemaHLSL` to add additional diagnostics
- [ ] Add LIT testing of sema and codegen
Contributor guide
Assessment
This issue has not been assessed yet.