Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -754,4 +754,21 @@ def DXSA_DclOutputSgv : DXSA_Op<"dcl_output_sgv"> {
let assemblyFormat = "$operand `,` $name attr-dict";
}

def DXSA_DclOutputSiv : DXSA_Op<"dcl_output_siv"> {
let summary = "declares an output as a System Interpreted Value";
let description = [{
The `dxsa.dcl_output_siv` operation declares an output to be written
that represents a System Interpreted Value.

Example:

```mlir
dxsa.dcl_output_siv <type = output, components = 4, mask = <x, y, z, w>, index = [3]>, <position>
```
}];
let arguments = (ins DXSA_InlineOperandAttr:$operand,
DXSA_SystemValueNameAttr:$name);
let assemblyFormat = "$operand `,` $name attr-dict";
}

#endif // DXSA_OPS
17 changes: 17 additions & 0 deletions mlir/lib/Target/DXSA/BinaryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,12 @@ class DXBuilder {
return dxsa::DclOutputSgv::create(builder, loc, operand, nameAttr);
}

Instruction buildDclOutputSiv(dxsa::InlineOperandAttr operand,
dxsa::SystemValueName name, Location loc) {
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
return dxsa::DclOutputSiv::create(builder, loc, operand, nameAttr);
}

private:
MLIRContext *context;
ModuleOp module;
Expand Down Expand Up @@ -1202,6 +1208,14 @@ class Parser {
return builder.buildDclOutputSgv(*operand, *name, loc);
}

FailureOr<Instruction> parseDclOutputSiv(Location loc) {
auto operand = parseInlineOperand();
FAILURE_IF_FAILED(operand);
auto name = parseSystemValueName(getLocation());
FAILURE_IF_FAILED(name);
return builder.buildDclOutputSiv(*operand, *name, loc);
}

OptionalParseResult parseDclInstruction(uint32_t opcodeToken, Location loc,
Instruction &out) {
FailureOr<Instruction> result;
Expand Down Expand Up @@ -1254,6 +1268,9 @@ class Parser {
case D3D10_SB_OPCODE_DCL_OUTPUT_SGV:
result = parseDclOutputSgv(loc);
break;
case D3D10_SB_OPCODE_DCL_OUTPUT_SIV:
result = parseDclOutputSiv(loc);
break;
default:
return std::nullopt;
}
Expand Down
6 changes: 6 additions & 0 deletions mlir/test/Target/DXSA/dcl_output_siv.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_output_siv.bin | FileCheck %s

// CHECK: module {
// CHECK-NEXT: dxsa.dcl_output_siv <type = output, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
// CHECK-NEXT: dxsa.dcl_output_siv <type = output, components = 4, mask = <x>, index = [1]>, <clipDistance>
// CHECK-NEXT: }
Binary file added mlir/test/Target/DXSA/inputs/dcl_output_siv.bin
Binary file not shown.