Arm64Emitter: Make RoundingMode enum an enum class

Prevents namespace pollution and makes the enum members strongly typed.
This commit is contained in:
Lioncash
2020-12-30 20:24:41 -05:00
parent d87ec71615
commit fab2053439
4 changed files with 21 additions and 21 deletions

View File

@ -2327,28 +2327,28 @@ void ARM64FloatEmitter::EmitConvertScalarToInt(ARM64Reg Rd, ARM64Reg Rn, Roundin
if (IsGPR(Rd))
{
// Use the encoding that transfers the result to a GPR.
bool sf = Is64Bit(Rd);
int type = IsDouble(Rn) ? 1 : 0;
const bool sf = Is64Bit(Rd);
const int type = IsDouble(Rn) ? 1 : 0;
Rd = DecodeReg(Rd);
Rn = DecodeReg(Rn);
int opcode = (sign ? 1 : 0);
int rmode = 0;
switch (round)
{
case ROUND_A:
case RoundingMode::A:
rmode = 0;
opcode |= 4;
break;
case ROUND_P:
case RoundingMode::P:
rmode = 1;
break;
case ROUND_M:
case RoundingMode::M:
rmode = 2;
break;
case ROUND_Z:
case RoundingMode::Z:
rmode = 3;
break;
case ROUND_N:
case RoundingMode::N:
rmode = 0;
break;
}
@ -2363,20 +2363,20 @@ void ARM64FloatEmitter::EmitConvertScalarToInt(ARM64Reg Rd, ARM64Reg Rn, Roundin
int opcode = 0;
switch (round)
{
case ROUND_A:
case RoundingMode::A:
opcode = 0x1C;
break;
case ROUND_N:
case RoundingMode::N:
opcode = 0x1A;
break;
case ROUND_M:
case RoundingMode::M:
opcode = 0x1B;
break;
case ROUND_P:
case RoundingMode::P:
opcode = 0x1A;
sz |= 2;
break;
case ROUND_Z:
case RoundingMode::Z:
opcode = 0x1B;
sz |= 2;
break;

View File

@ -310,13 +310,13 @@ enum ShiftAmount
SHIFT_48 = 3,
};
enum RoundingMode
enum class RoundingMode
{
ROUND_A, // round to nearest, ties to away
ROUND_M, // round towards -inf
ROUND_N, // round to nearest, ties to even
ROUND_P, // round towards +inf
ROUND_Z, // round towards zero
A, // round to nearest, ties to away
M, // round towards -inf
N, // round to nearest, ties to even
P, // round towards +inf
Z, // round towards zero
};
struct FixupBranch