summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/opcodes.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir/opcodes.inc')
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc237
1 files changed, 237 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
new file mode 100644
index 000000000..6eb105d92
--- /dev/null
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -0,0 +1,237 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5// opcode name, return type, arg1 type, arg2 type, arg3 type, arg4 type, ...
6OPCODE(Void, Void, )
7OPCODE(Identity, Opaque, Opaque, )
8OPCODE(Phi, Opaque, /*todo*/ )
9
10// Control flow
11OPCODE(Branch, Void, Label, )
12OPCODE(BranchConditional, Void, U1, Label, Label, )
13OPCODE(Exit, Void, )
14OPCODE(Return, Void, )
15OPCODE(Unreachable, Void, )
16
17// Context getters/setters
18OPCODE(GetRegister, U32, Reg, )
19OPCODE(SetRegister, Void, Reg, U32, )
20OPCODE(GetPred, U1, Pred, )
21OPCODE(SetPred, Void, Pred, U1, )
22OPCODE(GetCbuf, U32, U32, U32, )
23OPCODE(GetAttribute, U32, Attribute, )
24OPCODE(SetAttribute, U32, Attribute, )
25OPCODE(GetAttributeIndexed, U32, U32, )
26OPCODE(SetAttributeIndexed, U32, U32, )
27OPCODE(GetZFlag, U1, Void, )
28OPCODE(GetSFlag, U1, Void, )
29OPCODE(GetCFlag, U1, Void, )
30OPCODE(GetOFlag, U1, Void, )
31OPCODE(SetZFlag, Void, U1, )
32OPCODE(SetSFlag, Void, U1, )
33OPCODE(SetCFlag, Void, U1, )
34OPCODE(SetOFlag, Void, U1, )
35OPCODE(WorkgroupIdX, U32, )
36OPCODE(WorkgroupIdY, U32, )
37OPCODE(WorkgroupIdZ, U32, )
38OPCODE(LocalInvocationIdX, U32, )
39OPCODE(LocalInvocationIdY, U32, )
40OPCODE(LocalInvocationIdZ, U32, )
41
42// Undefined
43OPCODE(Undef1, U1, )
44OPCODE(Undef8, U8, )
45OPCODE(Undef16, U16, )
46OPCODE(Undef32, U32, )
47OPCODE(Undef64, U64, )
48
49// Memory operations
50OPCODE(LoadGlobalU8, U32, U64, )
51OPCODE(LoadGlobalS8, U32, U64, )
52OPCODE(LoadGlobalU16, U32, U64, )
53OPCODE(LoadGlobalS16, U32, U64, )
54OPCODE(LoadGlobal32, U32, U64, )
55OPCODE(LoadGlobal64, U32x2, U64, )
56OPCODE(LoadGlobal128, U32x4, U64, )
57OPCODE(WriteGlobalU8, Void, U64, U32, )
58OPCODE(WriteGlobalS8, Void, U64, U32, )
59OPCODE(WriteGlobalU16, Void, U64, U32, )
60OPCODE(WriteGlobalS16, Void, U64, U32, )
61OPCODE(WriteGlobal32, Void, U64, U32, )
62OPCODE(WriteGlobal64, Void, U64, U32x2, )
63OPCODE(WriteGlobal128, Void, U64, U32x4, )
64
65// Storage buffer operations
66OPCODE(LoadStorageU8, U32, U32, U32, )
67OPCODE(LoadStorageS8, U32, U32, U32, )
68OPCODE(LoadStorageU16, U32, U32, U32, )
69OPCODE(LoadStorageS16, U32, U32, U32, )
70OPCODE(LoadStorage32, U32, U32, U32, )
71OPCODE(LoadStorage64, U32x2, U32, U32, )
72OPCODE(LoadStorage128, U32x4, U32, U32, )
73OPCODE(WriteStorageU8, Void, U32, U32, U32, )
74OPCODE(WriteStorageS8, Void, U32, U32, U32, )
75OPCODE(WriteStorageU16, Void, U32, U32, U32, )
76OPCODE(WriteStorageS16, Void, U32, U32, U32, )
77OPCODE(WriteStorage32, Void, U32, U32, U32, )
78OPCODE(WriteStorage64, Void, U32, U32, U32x2, )
79OPCODE(WriteStorage128, Void, U32, U32, U32x4, )
80
81// Vector utility
82OPCODE(CompositeConstructU32x2, U32x2, U32, U32, )
83OPCODE(CompositeConstructU32x3, U32x3, U32, U32, U32, )
84OPCODE(CompositeConstructU32x4, U32x4, U32, U32, U32, U32, )
85OPCODE(CompositeExtractU32x2, U32, U32x2, U32, )
86OPCODE(CompositeExtractU32x3, U32, U32x3, U32, )
87OPCODE(CompositeExtractU32x4, U32, U32x4, U32, )
88OPCODE(CompositeConstructF16x2, F16x2, F16, F16, )
89OPCODE(CompositeConstructF16x3, F16x3, F16, F16, F16, )
90OPCODE(CompositeConstructF16x4, F16x4, F16, F16, F16, F16, )
91OPCODE(CompositeExtractF16x2, F16, F16x2, U32, )
92OPCODE(CompositeExtractF16x3, F16, F16x3, U32, )
93OPCODE(CompositeExtractF16x4, F16, F16x4, U32, )
94OPCODE(CompositeConstructF32x2, F32x2, F32, F32, )
95OPCODE(CompositeConstructF32x3, F32x3, F32, F32, F32, )
96OPCODE(CompositeConstructF32x4, F32x4, F32, F32, F32, F32, )
97OPCODE(CompositeExtractF32x2, F32, F32x2, U32, )
98OPCODE(CompositeExtractF32x3, F32, F32x3, U32, )
99OPCODE(CompositeExtractF32x4, F32, F32x4, U32, )
100OPCODE(CompositeConstructF64x2, F64x2, F64, F64, )
101OPCODE(CompositeConstructF64x3, F64x3, F64, F64, F64, )
102OPCODE(CompositeConstructF64x4, F64x4, F64, F64, F64, F64, )
103OPCODE(CompositeExtractF64x2, F64, F64x2, U32, )
104OPCODE(CompositeExtractF64x3, F64, F64x3, U32, )
105OPCODE(CompositeExtractF64x4, F64, F64x4, U32, )
106
107// Select operations
108OPCODE(Select8, U8, U1, U8, U8, )
109OPCODE(Select16, U16, U1, U16, U16, )
110OPCODE(Select32, U32, U1, U32, U32, )
111OPCODE(Select64, U64, U1, U64, U64, )
112
113// Bitwise conversions
114OPCODE(BitCastU16F16, U16, F16, )
115OPCODE(BitCastU32F32, U32, F32, )
116OPCODE(BitCastU64F64, U64, F64, )
117OPCODE(BitCastF16U16, F16, U16, )
118OPCODE(BitCastF32U32, F32, U32, )
119OPCODE(BitCastF64U64, F64, U64, )
120OPCODE(PackUint2x32, U64, U32x2, )
121OPCODE(UnpackUint2x32, U32x2, U64, )
122OPCODE(PackFloat2x16, U32, F16x2, )
123OPCODE(UnpackFloat2x16, F16x2, U32, )
124OPCODE(PackDouble2x32, U64, U32x2, )
125OPCODE(UnpackDouble2x32, U32x2, U64, )
126
127// Pseudo-operation, handled specially at final emit
128OPCODE(GetZeroFromOp, U1, Opaque, )
129OPCODE(GetSignFromOp, U1, Opaque, )
130OPCODE(GetCarryFromOp, U1, Opaque, )
131OPCODE(GetOverflowFromOp, U1, Opaque, )
132
133// Floating-point operations
134OPCODE(FPAbs16, F16, F16, )
135OPCODE(FPAbs32, F32, F32, )
136OPCODE(FPAbs64, F64, F64, )
137OPCODE(FPAdd16, F16, F16, F16, )
138OPCODE(FPAdd32, F32, F32, F32, )
139OPCODE(FPAdd64, F64, F64, F64, )
140OPCODE(FPFma16, F16, F16, F16, F16, )
141OPCODE(FPFma32, F32, F32, F32, F32, )
142OPCODE(FPFma64, F64, F64, F64, F64, )
143OPCODE(FPMax32, F32, F32, F32, )
144OPCODE(FPMax64, F64, F64, F64, )
145OPCODE(FPMin32, F32, F32, F32, )
146OPCODE(FPMin64, F64, F64, F64, )
147OPCODE(FPMul16, F16, F16, F16, )
148OPCODE(FPMul32, F32, F32, F32, )
149OPCODE(FPMul64, F64, F64, F64, )
150OPCODE(FPNeg16, F16, F16, )
151OPCODE(FPNeg32, F32, F32, )
152OPCODE(FPNeg64, F64, F64, )
153OPCODE(FPRecip32, F32, F32, )
154OPCODE(FPRecip64, F64, F64, )
155OPCODE(FPRecipSqrt32, F32, F32, )
156OPCODE(FPRecipSqrt64, F64, F64, )
157OPCODE(FPSqrt, F32, F32, )
158OPCODE(FPSin, F32, F32, )
159OPCODE(FPSinNotReduced, F32, F32, )
160OPCODE(FPExp2, F32, F32, )
161OPCODE(FPExp2NotReduced, F32, F32, )
162OPCODE(FPCos, F32, F32, )
163OPCODE(FPCosNotReduced, F32, F32, )
164OPCODE(FPLog2, F32, F32, )
165OPCODE(FPSaturate16, F16, F16, )
166OPCODE(FPSaturate32, F32, F32, )
167OPCODE(FPSaturate64, F64, F64, )
168OPCODE(FPRoundEven16, F16, F16, )
169OPCODE(FPRoundEven32, F32, F32, )
170OPCODE(FPRoundEven64, F64, F64, )
171OPCODE(FPFloor16, F16, F16, )
172OPCODE(FPFloor32, F32, F32, )
173OPCODE(FPFloor64, F64, F64, )
174OPCODE(FPCeil16, F16, F16, )
175OPCODE(FPCeil32, F32, F32, )
176OPCODE(FPCeil64, F64, F64, )
177OPCODE(FPTrunc16, F16, F16, )
178OPCODE(FPTrunc32, F32, F32, )
179OPCODE(FPTrunc64, F64, F64, )
180
181// Integer operations
182OPCODE(IAdd32, U32, U32, U32, )
183OPCODE(IAdd64, U64, U64, U64, )
184OPCODE(ISub32, U32, U32, U32, )
185OPCODE(ISub64, U64, U64, U64, )
186OPCODE(IMul32, U32, U32, U32, )
187OPCODE(INeg32, U32, U32, )
188OPCODE(IAbs32, U32, U32, )
189OPCODE(ShiftLeftLogical32, U32, U32, U32, )
190OPCODE(ShiftRightLogical32, U32, U32, U32, )
191OPCODE(ShiftRightArithmetic32, U32, U32, U32, )
192OPCODE(BitwiseAnd32, U32, U32, U32, )
193OPCODE(BitwiseOr32, U32, U32, U32, )
194OPCODE(BitwiseXor32, U32, U32, U32, )
195OPCODE(BitFieldInsert, U32, U32, U32, U32, U32, )
196OPCODE(BitFieldSExtract, U32, U32, U32, U32, )
197OPCODE(BitFieldUExtract, U32, U32, U32, U32, )
198
199OPCODE(SLessThan, U1, U32, U32, )
200OPCODE(ULessThan, U1, U32, U32, )
201OPCODE(IEqual, U1, U32, U32, )
202OPCODE(SLessThanEqual, U1, U32, U32, )
203OPCODE(ULessThanEqual, U1, U32, U32, )
204OPCODE(SGreaterThan, U1, U32, U32, )
205OPCODE(UGreaterThan, U1, U32, U32, )
206OPCODE(INotEqual, U1, U32, U32, )
207OPCODE(SGreaterThanEqual, U1, U32, U32, )
208OPCODE(UGreaterThanEqual, U1, U32, U32, )
209
210// Logical operations
211OPCODE(LogicalOr, U1, U1, U1, )
212OPCODE(LogicalAnd, U1, U1, U1, )
213OPCODE(LogicalXor, U1, U1, U1, )
214OPCODE(LogicalNot, U1, U1, )
215
216// Conversion operations
217OPCODE(ConvertS16F16, U32, F16, )
218OPCODE(ConvertS16F32, U32, F32, )
219OPCODE(ConvertS16F64, U32, F64, )
220OPCODE(ConvertS32F16, U32, F16, )
221OPCODE(ConvertS32F32, U32, F32, )
222OPCODE(ConvertS32F64, U32, F64, )
223OPCODE(ConvertS64F16, U64, F16, )
224OPCODE(ConvertS64F32, U64, F32, )
225OPCODE(ConvertS64F64, U64, F64, )
226OPCODE(ConvertU16F16, U32, F16, )
227OPCODE(ConvertU16F32, U32, F32, )
228OPCODE(ConvertU16F64, U32, F64, )
229OPCODE(ConvertU32F16, U32, F16, )
230OPCODE(ConvertU32F32, U32, F32, )
231OPCODE(ConvertU32F64, U32, F64, )
232OPCODE(ConvertU64F16, U64, F16, )
233OPCODE(ConvertU64F32, U64, F32, )
234OPCODE(ConvertU64F64, U64, F64, )
235
236OPCODE(ConvertU64U32, U64, U32, )
237OPCODE(ConvertU32U64, U32, U64, )