suyu/src/shader_recompiler/frontend/ir/opcode.inc

212 lines
25 KiB
PHP
Raw Normal View History

2021-01-09 07:30:07 +01:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
// opcode name, return type, arg1 type, arg2 type, arg3 type, arg4 type, ...
OPCODE(Void, Void, )
OPCODE(Identity, Opaque, Opaque, )
2021-02-03 01:07:00 +01:00
OPCODE(Phi, Opaque, /*todo*/ )
2021-01-09 07:30:07 +01:00
// Control flow
OPCODE(Branch, Void, Label, )
OPCODE(BranchConditional, Void, U1, Label, Label, )
OPCODE(Exit, Void, )
OPCODE(Return, Void, )
OPCODE(Unreachable, Void, )
// Context getters/setters
OPCODE(GetRegister, U32, Reg, )
OPCODE(SetRegister, Void, Reg, U32, )
OPCODE(GetPred, U1, Pred, )
OPCODE(SetPred, Void, Pred, U1, )
OPCODE(GetCbuf, U32, U32, U32, )
OPCODE(GetAttribute, U32, Attribute, )
OPCODE(SetAttribute, U32, Attribute, )
OPCODE(GetAttributeIndexed, U32, U32, )
OPCODE(SetAttributeIndexed, U32, U32, )
OPCODE(GetZFlag, U1, Void, )
OPCODE(GetSFlag, U1, Void, )
OPCODE(GetCFlag, U1, Void, )
OPCODE(GetOFlag, U1, Void, )
OPCODE(SetZFlag, Void, U1, )
OPCODE(SetSFlag, Void, U1, )
OPCODE(SetCFlag, Void, U1, )
OPCODE(SetOFlag, Void, U1, )
2021-02-03 20:43:04 +01:00
OPCODE(WorkgroupIdX, U32, )
OPCODE(WorkgroupIdY, U32, )
OPCODE(WorkgroupIdZ, U32, )
OPCODE(LocalInvocationIdX, U32, )
OPCODE(LocalInvocationIdY, U32, )
OPCODE(LocalInvocationIdZ, U32, )
2021-01-09 07:30:07 +01:00
2021-02-03 01:07:00 +01:00
// Undefined
OPCODE(Undef1, U1, )
OPCODE(Undef8, U8, )
OPCODE(Undef16, U16, )
OPCODE(Undef32, U32, )
OPCODE(Undef64, U64, )
2021-01-09 07:30:07 +01:00
// Memory operations
2021-02-03 20:43:04 +01:00
OPCODE(LoadGlobalU8, U32, U64, )
OPCODE(LoadGlobalS8, U32, U64, )
OPCODE(LoadGlobalU16, U32, U64, )
OPCODE(LoadGlobalS16, U32, U64, )
OPCODE(LoadGlobal32, U32, U64, )
OPCODE(LoadGlobal64, Opaque, U64, )
OPCODE(LoadGlobal128, Opaque, U64, )
2021-01-09 07:30:07 +01:00
OPCODE(WriteGlobalU8, Void, U64, U32, )
OPCODE(WriteGlobalS8, Void, U64, U32, )
OPCODE(WriteGlobalU16, Void, U64, U32, )
OPCODE(WriteGlobalS16, Void, U64, U32, )
OPCODE(WriteGlobal32, Void, U64, U32, )
OPCODE(WriteGlobal64, Void, U64, Opaque, )
OPCODE(WriteGlobal128, Void, U64, Opaque, )
// Storage buffer operations
OPCODE(LoadStorageU8, U32, U32, U32, )
OPCODE(LoadStorageS8, U32, U32, U32, )
OPCODE(LoadStorageU16, U32, U32, U32, )
OPCODE(LoadStorageS16, U32, U32, U32, )
OPCODE(LoadStorage32, U32, U32, U32, )
OPCODE(LoadStorage64, Opaque, U32, U32, )
OPCODE(LoadStorage128, Opaque, U32, U32, )
OPCODE(WriteStorageU8, Void, U32, U32, U32, )
OPCODE(WriteStorageS8, Void, U32, U32, U32, )
OPCODE(WriteStorageU16, Void, U32, U32, U32, )
OPCODE(WriteStorageS16, Void, U32, U32, U32, )
OPCODE(WriteStorage32, Void, U32, U32, U32, )
OPCODE(WriteStorage64, Void, U32, U32, Opaque, )
OPCODE(WriteStorage128, Void, U32, U32, Opaque, )
2021-01-09 07:30:07 +01:00
// Vector utility
OPCODE(CompositeConstruct2, Opaque, Opaque, Opaque, )
OPCODE(CompositeConstruct3, Opaque, Opaque, Opaque, Opaque, )
OPCODE(CompositeConstruct4, Opaque, Opaque, Opaque, Opaque, Opaque, )
OPCODE(CompositeExtract, Opaque, Opaque, U32, )
2021-02-03 20:43:04 +01:00
// Select operations
OPCODE(Select8, U8, U1, U8, U8, )
OPCODE(Select16, U16, U1, U16, U16, )
OPCODE(Select32, U32, U1, U32, U32, )
OPCODE(Select64, U64, U1, U64, U64, )
2021-01-09 07:30:07 +01:00
// Bitwise conversions
OPCODE(PackUint2x32, U64, Opaque, )
OPCODE(UnpackUint2x32, Opaque, U64, )
OPCODE(PackFloat2x16, U32, Opaque, )
OPCODE(UnpackFloat2x16, Opaque, U32, )
OPCODE(PackDouble2x32, U64, Opaque, )
OPCODE(UnpackDouble2x32, Opaque, U64, )
// Pseudo-operation, handled specially at final emit
OPCODE(GetZeroFromOp, U1, Opaque, )
OPCODE(GetSignFromOp, U1, Opaque, )
OPCODE(GetCarryFromOp, U1, Opaque, )
OPCODE(GetOverflowFromOp, U1, Opaque, )
// Floating-point operations
2021-02-03 20:43:04 +01:00
OPCODE(FPAbs16, U16, U16, )
OPCODE(FPAbs32, U32, U32, )
OPCODE(FPAbs64, U64, U64, )
OPCODE(FPAdd16, U16, U16, U16, )
OPCODE(FPAdd32, U32, U32, U32, )
OPCODE(FPAdd64, U64, U64, U64, )
OPCODE(FPFma16, U16, U16, U16, U16, )
OPCODE(FPFma32, U32, U32, U32, U32, )
OPCODE(FPFma64, U64, U64, U64, U64, )
OPCODE(FPMax32, U32, U32, U32, )
OPCODE(FPMax64, U64, U64, U64, )
OPCODE(FPMin32, U32, U32, U32, )
OPCODE(FPMin64, U64, U64, U64, )
OPCODE(FPMul16, U16, U16, U16, )
OPCODE(FPMul32, U32, U32, U32, )
OPCODE(FPMul64, U64, U64, U64, )
OPCODE(FPNeg16, U16, U16, )
OPCODE(FPNeg32, U32, U32, )
OPCODE(FPNeg64, U64, U64, )
OPCODE(FPRecip32, U32, U32, )
OPCODE(FPRecip64, U64, U64, )
OPCODE(FPRecipSqrt32, U32, U32, )
OPCODE(FPRecipSqrt64, U64, U64, )
OPCODE(FPSqrt, U32, U32, )
OPCODE(FPSin, U32, U32, )
OPCODE(FPSinNotReduced, U32, U32, )
OPCODE(FPExp2, U32, U32, )
OPCODE(FPExp2NotReduced, U32, U32, )
OPCODE(FPCos, U32, U32, )
OPCODE(FPCosNotReduced, U32, U32, )
OPCODE(FPLog2, U32, U32, )
OPCODE(FPSaturate16, U16, U16, )
OPCODE(FPSaturate32, U32, U32, )
OPCODE(FPSaturate64, U64, U64, )
OPCODE(FPRoundEven16, U16, U16, )
OPCODE(FPRoundEven32, U32, U32, )
OPCODE(FPRoundEven64, U64, U64, )
OPCODE(FPFloor16, U16, U16, )
OPCODE(FPFloor32, U32, U32, )
OPCODE(FPFloor64, U64, U64, )
OPCODE(FPCeil16, U16, U16, )
OPCODE(FPCeil32, U32, U32, )
OPCODE(FPCeil64, U64, U64, )
OPCODE(FPTrunc16, U16, U16, )
OPCODE(FPTrunc32, U32, U32, )
OPCODE(FPTrunc64, U64, U64, )
// Integer operations
OPCODE(IAdd32, U32, U32, U32, )
OPCODE(IAdd64, U64, U64, U64, )
OPCODE(ISub32, U32, U32, U32, )
OPCODE(ISub64, U64, U64, U64, )
2021-02-03 20:43:04 +01:00
OPCODE(IMul32, U32, U32, U32, )
OPCODE(INeg32, U32, U32, )
OPCODE(IAbs32, U32, U32, )
OPCODE(ShiftLeftLogical32, U32, U32, U32, )
OPCODE(ShiftRightLogical32, U32, U32, U32, )
OPCODE(ShiftRightArithmetic32, U32, U32, U32, )
OPCODE(BitwiseAnd32, U32, U32, U32, )
OPCODE(BitwiseOr32, U32, U32, U32, )
OPCODE(BitwiseXor32, U32, U32, U32, )
OPCODE(BitFieldInsert, U32, U32, U32, U32, U32, )
OPCODE(BitFieldSExtract, U32, U32, U32, U32, )
OPCODE(BitFieldUExtract, U32, U32, U32, U32, )
OPCODE(SLessThan, U1, U32, U32, )
OPCODE(ULessThan, U1, U32, U32, )
OPCODE(IEqual, U1, U32, U32, )
OPCODE(SLessThanEqual, U1, U32, U32, )
OPCODE(ULessThanEqual, U1, U32, U32, )
OPCODE(SGreaterThan, U1, U32, U32, )
OPCODE(UGreaterThan, U1, U32, U32, )
OPCODE(INotEqual, U1, U32, U32, )
OPCODE(SGreaterThanEqual, U1, U32, U32, )
OPCODE(UGreaterThanEqual, U1, U32, U32, )
2021-01-09 07:30:07 +01:00
// Logical operations
OPCODE(LogicalOr, U1, U1, U1, )
OPCODE(LogicalAnd, U1, U1, U1, )
2021-02-03 20:43:04 +01:00
OPCODE(LogicalXor, U1, U1, U1, )
2021-01-09 07:30:07 +01:00
OPCODE(LogicalNot, U1, U1, )
// Conversion operations
OPCODE(ConvertS16F16, U32, U16, )
OPCODE(ConvertS16F32, U32, U32, )
OPCODE(ConvertS16F64, U32, U64, )
OPCODE(ConvertS32F16, U32, U16, )
OPCODE(ConvertS32F32, U32, U32, )
OPCODE(ConvertS32F64, U32, U64, )
OPCODE(ConvertS64F16, U64, U16, )
OPCODE(ConvertS64F32, U64, U32, )
OPCODE(ConvertS64F64, U64, U64, )
OPCODE(ConvertU16F16, U32, U16, )
OPCODE(ConvertU16F32, U32, U32, )
OPCODE(ConvertU16F64, U32, U64, )
OPCODE(ConvertU32F16, U32, U16, )
OPCODE(ConvertU32F32, U32, U32, )
OPCODE(ConvertU32F64, U32, U64, )
OPCODE(ConvertU64F16, U64, U16, )
OPCODE(ConvertU64F32, U64, U32, )
OPCODE(ConvertU64F64, U64, U64, )
OPCODE(ConvertU64U32, U64, U32, )
OPCODE(ConvertU32U64, U32, U64, )