mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 13:00:15 +02:00
IR: Allow passing padding and MaxBytes through Constant IR
This commit is contained in:
3 files changed
+32
-4
No files matched your search
@@ -43,8 +43,15 @@ DEF_BINOP_WITH_CONSTANT(Ror, rorv, ror)
|
||||
DEF_OP(Constant) {
|
||||
auto Op = IROp->C<IR::IROp_Constant>();
|
||||
auto Dst = GetReg(Node);
|
||||
// TODO: Audit the frontend generating these constants and pass through padding information.
|
||||
LoadConstant(ARMEmitter::Size::i64Bit, Dst, Op->Constant, CPU::Arm64Emitter::PadType::AUTOPAD);
|
||||
|
||||
const auto PadType = [Pad = Op->Pad]() {
|
||||
switch (Pad) {
|
||||
case IR::ConstPad::NoPad: return CPU::Arm64Emitter::PadType::NOPAD;
|
||||
case IR::ConstPad::DoPad: return CPU::Arm64Emitter::PadType::DOPAD;
|
||||
default: return CPU::Arm64Emitter::PadType::AUTOPAD;
|
||||
}
|
||||
}();
|
||||
LoadConstant(ARMEmitter::Size::i64Bit, Dst, Op->Constant, PadType, Op->MaxBytes);
|
||||
}
|
||||
|
||||
DEF_OP(EntrypointOffset) {
|
||||
|
||||
@@ -105,6 +105,11 @@
|
||||
"PosInfinity = 2,",
|
||||
"TowardsZero = 3, /* Truncate */",
|
||||
"Host = 4,"
|
||||
],
|
||||
"class ConstPad : uint8_t": [
|
||||
"NoPad = 0,",
|
||||
"DoPad = 1,",
|
||||
"AutoPad = 2,"
|
||||
]
|
||||
},
|
||||
"Defines": [
|
||||
@@ -142,6 +147,7 @@
|
||||
"MemOffsetType": "MemOffsetType",
|
||||
"BreakDefinition": "BreakDefinition",
|
||||
"RoundType": "RoundMode",
|
||||
"ConstPad": "ConstPad",
|
||||
"FloatCompareOp": "FloatCompareOp",
|
||||
"NamedVectorConstant": "FEXCore::IR::NamedVectorConstant",
|
||||
"IndexNamedVectorConstant": "FEXCore::IR::IndexNamedVectorConstant",
|
||||
@@ -930,11 +936,15 @@
|
||||
]
|
||||
},
|
||||
|
||||
"GPR = Constant i64:$Constant": {
|
||||
"GPR = Constant i64:$Constant, ConstPad:$Pad{ConstPad::AutoPad}, i32:$MaxBytes{0}": {
|
||||
"Desc": ["Generates a 64bit constant inside of a GPR",
|
||||
"Unsupported to create a constant in FPR"
|
||||
],
|
||||
"DestSize": "OpSize::i64Bit"
|
||||
"DestSize": "OpSize::i64Bit",
|
||||
"EmitValidation": [
|
||||
"MaxBytes >= 0 && MaxBytes <= 8 && (MaxBytes & 1) == 0",
|
||||
"MaxBytes == 0 || (Constant >> (MaxBytes * 8)) == 0"
|
||||
]
|
||||
},
|
||||
|
||||
"InlineConstant i64:$Constant": {
|
||||
|
||||
@@ -149,6 +149,17 @@ static void PrintArg(fextl::stringstream* out, const IRListView*, RoundMode Arg)
|
||||
}();
|
||||
}
|
||||
|
||||
static void PrintArg(fextl::stringstream* out, const IRListView*, ConstPad Arg) {
|
||||
*out << [Arg] {
|
||||
switch (Arg) {
|
||||
case ConstPad::NoPad: return "NoPad";
|
||||
case ConstPad::DoPad: return "DoPad";
|
||||
case ConstPad::AutoPad: return "AutoPad";
|
||||
}
|
||||
return "<Unknown ConstPad Type>";
|
||||
}();
|
||||
}
|
||||
|
||||
static void PrintArg(fextl::stringstream* out, const IRListView*, NamedVectorConstant Arg) {
|
||||
*out << [Arg] {
|
||||
// clang-format off
|
||||
|
||||
Reference in new issue
Block a user