exec_output = ""
vcvtUIntFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.uw) : "m" (FpOp1.uw));
FpDest = FpOp1.uw;
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtUIntFpSIop = InstObjParams("vcvt", "VcvtUIntFpS", "FpRegRegOp",
{ "code": vcvtUIntFpSCode,
exec_output += PredOpExecute.subst(vcvtUIntFpSIop);
vcvtUIntFpDCode = '''
- IntDoubleUnion cDest;
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1P0.uw) : "m" (FpOp1P0.uw));
- cDest.fp = (uint64_t)FpOp1P0.uw;
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = (uint64_t)FpOp1P0.uw;
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtUIntFpDIop = InstObjParams("vcvt", "VcvtUIntFpD", "FpRegRegOp",
{ "code": vcvtUIntFpDCode,
exec_output += PredOpExecute.subst(vcvtUIntFpDIop);
vcvtSIntFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.sw) : "m" (FpOp1.sw));
FpDest = FpOp1.sw;
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtSIntFpSIop = InstObjParams("vcvt", "VcvtSIntFpS", "FpRegRegOp",
{ "code": vcvtSIntFpSCode,
exec_output += PredOpExecute.subst(vcvtSIntFpSIop);
vcvtSIntFpDCode = '''
- IntDoubleUnion cDest;
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1P0.sw) : "m" (FpOp1P0.sw));
- cDest.fp = FpOp1P0.sw;
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = FpOp1P0.sw;
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtSIntFpDIop = InstObjParams("vcvt", "VcvtSIntFpD", "FpRegRegOp",
{ "code": vcvtSIntFpDCode,
exec_output += PredOpExecute.subst(vcvtSIntFpDIop);
vcvtFpUIntSRCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ vfpFlushToZero(fpscr, FpOp1);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.uw = vfpFpSToFixed(FpOp1, false, false, 0, false);
__asm__ __volatile__("" :: "m" (FpDest.uw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpUIntSRIop = InstObjParams("vcvt", "VcvtFpUIntSR", "FpRegRegOp",
{ "code": vcvtFpUIntSRCode,
exec_output += PredOpExecute.subst(vcvtFpUIntSRIop);
vcvtFpUIntDRCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t result = vfpFpDToFixed(cOp1.fp, false, false, 0, false);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t result = vfpFpDToFixed(cOp1, false, false, 0, false);
__asm__ __volatile__("" :: "m" (result));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = result;
'''
vcvtFpUIntDRIop = InstObjParams("vcvtr", "VcvtFpUIntDR", "FpRegRegOp",
exec_output += PredOpExecute.subst(vcvtFpUIntDRIop);
vcvtFpSIntSRCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ vfpFlushToZero(fpscr, FpOp1);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.sw = vfpFpSToFixed(FpOp1, true, false, 0, false);
__asm__ __volatile__("" :: "m" (FpDest.sw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpSIntSRIop = InstObjParams("vcvtr", "VcvtFpSIntSR", "FpRegRegOp",
{ "code": vcvtFpSIntSRCode,
exec_output += PredOpExecute.subst(vcvtFpSIntSRIop);
vcvtFpSIntDRCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- int64_t result = vfpFpDToFixed(cOp1.fp, true, false, 0, false);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ int64_t result = vfpFpDToFixed(cOp1, true, false, 0, false);
__asm__ __volatile__("" :: "m" (result));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = result;
'''
vcvtFpSIntDRIop = InstObjParams("vcvtr", "VcvtFpSIntDR", "FpRegRegOp",
exec_output += PredOpExecute.subst(vcvtFpSIntDRIop);
vcvtFpUIntSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
fesetround(FeRoundZero);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.uw = vfpFpSToFixed(FpOp1, false, false, 0);
__asm__ __volatile__("" :: "m" (FpDest.uw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpUIntSIop = InstObjParams("vcvt", "VcvtFpUIntS", "FpRegRegOp",
{ "code": vcvtFpUIntSCode,
exec_output += PredOpExecute.subst(vcvtFpUIntSIop);
vcvtFpUIntDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
fesetround(FeRoundZero);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t result = vfpFpDToFixed(cOp1.fp, false, false, 0);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t result = vfpFpDToFixed(cOp1, false, false, 0);
__asm__ __volatile__("" :: "m" (result));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = result;
'''
vcvtFpUIntDIop = InstObjParams("vcvt", "VcvtFpUIntD", "FpRegRegOp",
exec_output += PredOpExecute.subst(vcvtFpUIntDIop);
vcvtFpSIntSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
fesetround(FeRoundZero);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.sw = vfpFpSToFixed(FpOp1, true, false, 0);
__asm__ __volatile__("" :: "m" (FpDest.sw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpSIntSIop = InstObjParams("vcvt", "VcvtFpSIntS", "FpRegRegOp",
{ "code": vcvtFpSIntSCode,
exec_output += PredOpExecute.subst(vcvtFpSIntSIop);
vcvtFpSIntDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
fesetround(FeRoundZero);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- int64_t result = vfpFpDToFixed(cOp1.fp, true, false, 0);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ int64_t result = vfpFpDToFixed(cOp1, true, false, 0);
__asm__ __volatile__("" :: "m" (result));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = result;
'''
vcvtFpSIntDIop = InstObjParams("vcvt", "VcvtFpSIntD", "FpRegRegOp",
exec_output += PredOpExecute.subst(vcvtFpSIntDIop);
vcvtFpSFpDCode = '''
- IntDoubleUnion cDest;
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
- cDest.fp = fixFpSFpDDest(Fpscr, FpOp1);
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = fixFpSFpDDest(Fpscr, FpOp1);
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtFpSFpDIop = InstObjParams("vcvt", "VcvtFpSFpD", "FpRegRegOp",
{ "code": vcvtFpSFpDCode,
exec_output += PredOpExecute.subst(vcvtFpSFpDIop);
vcvtFpDFpSCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- FpDest = fixFpDFpSDest(Fpscr, cOp1.fp);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ FpDest = fixFpDFpSDest(Fpscr, cOp1);
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpDFpSIop = InstObjParams("vcvt", "VcvtFpDFpS", "FpRegRegOp",
{ "code": vcvtFpDFpSCode,
exec_output += PredOpExecute.subst(vcvtFpDFpSIop);
vcmpSCode = '''
- vfpFlushToZero(Fpscr, FpDest, FpOp1);
FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpDest, FpOp1);
if (FpDest == FpOp1) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
} else if (FpDest < FpOp1) {
exec_output += PredOpExecute.subst(vcmpSIop);
vcmpDCode = '''
- IntDoubleUnion cOp1, cDest;
- cDest.bits = ((uint64_t)FpDestP0.uw | ((uint64_t)FpDestP1.uw << 32));
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cDest.fp, cOp1.fp);
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ double cDest = dbl(FpDestP0.uw, FpDestP1.uw);
FPSCR fpscr = Fpscr;
- if (cDest.fp == cOp1.fp) {
+ vfpFlushToZero(fpscr, cDest, cOp1);
+ if (cDest == cOp1) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
- } else if (cDest.fp < cOp1.fp) {
+ } else if (cDest < cOp1) {
fpscr.n = 1; fpscr.z = 0; fpscr.c = 0; fpscr.v = 0;
- } else if (cDest.fp > cOp1.fp) {
+ } else if (cDest > cOp1) {
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 0;
} else {
const uint64_t qnan = ULL(0x7ff8000000000000);
- const bool nan1 = std::isnan(cDest.fp);
- const bool signal1 = nan1 && ((cDest.bits & qnan) != qnan);
- const bool nan2 = std::isnan(cOp1.fp);
- const bool signal2 = nan2 && ((cOp1.bits & qnan) != qnan);
+ const bool nan1 = std::isnan(cDest);
+ const bool signal1 = nan1 && ((fpToBits(cDest) & qnan) != qnan);
+ const bool nan2 = std::isnan(cOp1);
+ const bool signal2 = nan2 && ((fpToBits(cOp1) & qnan) != qnan);
if (signal1 || signal2)
fpscr.ioc = 1;
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 1;
exec_output += PredOpExecute.subst(vcmpDIop);
vcmpZeroSCode = '''
- vfpFlushToZero(Fpscr, FpDest);
FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpDest);
// This only handles imm == 0 for now.
assert(imm == 0);
if (FpDest == imm) {
exec_output += PredOpExecute.subst(vcmpZeroSIop);
vcmpZeroDCode = '''
- IntDoubleUnion cDest;
// This only handles imm == 0 for now.
assert(imm == 0);
- cDest.bits = ((uint64_t)FpDestP0.uw | ((uint64_t)FpDestP1.uw << 32));
- vfpFlushToZero(Fpscr, cDest.fp);
+ double cDest = dbl(FpDestP0.uw, FpDestP1.uw);
FPSCR fpscr = Fpscr;
- if (cDest.fp == imm) {
+ vfpFlushToZero(fpscr, cDest);
+ if (cDest == imm) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
- } else if (cDest.fp < imm) {
+ } else if (cDest < imm) {
fpscr.n = 1; fpscr.z = 0; fpscr.c = 0; fpscr.v = 0;
- } else if (cDest.fp > imm) {
+ } else if (cDest > imm) {
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 0;
} else {
const uint64_t qnan = ULL(0x7ff8000000000000);
- const bool nan = std::isnan(cDest.fp);
- const bool signal = nan && ((cDest.bits & qnan) != qnan);
+ const bool nan = std::isnan(cDest);
+ const bool signal = nan && ((fpToBits(cDest) & qnan) != qnan);
if (signal)
fpscr.ioc = 1;
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 1;
exec_output += PredOpExecute.subst(vcmpZeroDIop);
vcmpeSCode = '''
- vfpFlushToZero(Fpscr, FpDest, FpOp1);
FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpDest, FpOp1);
if (FpDest == FpOp1) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
} else if (FpDest < FpOp1) {
exec_output += PredOpExecute.subst(vcmpeSIop);
vcmpeDCode = '''
- IntDoubleUnion cOp1, cDest;
- cDest.bits = ((uint64_t)FpDestP0.uw | ((uint64_t)FpDestP1.uw << 32));
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cDest.fp, cOp1.fp);
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ double cDest = dbl(FpDestP0.uw, FpDestP1.uw);
FPSCR fpscr = Fpscr;
- if (cDest.fp == cOp1.fp) {
+ vfpFlushToZero(fpscr, cDest, cOp1);
+ if (cDest == cOp1) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
- } else if (cDest.fp < cOp1.fp) {
+ } else if (cDest < cOp1) {
fpscr.n = 1; fpscr.z = 0; fpscr.c = 0; fpscr.v = 0;
- } else if (cDest.fp > cOp1.fp) {
+ } else if (cDest > cOp1) {
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 0;
} else {
fpscr.ioc = 1;
exec_output += PredOpExecute.subst(vcmpeDIop);
vcmpeZeroSCode = '''
- vfpFlushToZero(Fpscr, FpDest);
FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpDest);
if (FpDest == imm) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
} else if (FpDest < imm) {
exec_output += PredOpExecute.subst(vcmpeZeroSIop);
vcmpeZeroDCode = '''
- IntDoubleUnion cDest;
- cDest.bits = ((uint64_t)FpDestP0.uw | ((uint64_t)FpDestP1.uw << 32));
- vfpFlushToZero(Fpscr, cDest.fp);
+ double cDest = dbl(FpDestP0.uw, FpDestP1.uw);
FPSCR fpscr = Fpscr;
- if (cDest.fp == imm) {
+ vfpFlushToZero(fpscr, cDest);
+ if (cDest == imm) {
fpscr.n = 0; fpscr.z = 1; fpscr.c = 1; fpscr.v = 0;
- } else if (cDest.fp < imm) {
+ } else if (cDest < imm) {
fpscr.n = 1; fpscr.z = 0; fpscr.c = 0; fpscr.v = 0;
- } else if (cDest.fp > imm) {
+ } else if (cDest > imm) {
fpscr.n = 0; fpscr.z = 0; fpscr.c = 1; fpscr.v = 0;
} else {
fpscr.ioc = 1;
exec_output = ""
vcvtFpSFixedSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.sw = vfpFpSToFixed(FpOp1, true, false, imm);
__asm__ __volatile__("" :: "m" (FpDest.sw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpSFixedSIop = InstObjParams("vcvt", "VcvtFpSFixedS", "FpRegRegImmOp",
{ "code": vcvtFpSFixedSCode,
exec_output += PredOpExecute.subst(vcvtFpSFixedSIop);
vcvtFpSFixedDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t mid = vfpFpDToFixed(cOp1.fp, true, false, imm);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t mid = vfpFpDToFixed(cOp1, true, false, imm);
__asm__ __volatile__("" :: "m" (mid));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = mid;
FpDestP1.uw = mid >> 32;
'''
exec_output += PredOpExecute.subst(vcvtFpSFixedDIop);
vcvtFpUFixedSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.uw = vfpFpSToFixed(FpOp1, false, false, imm);
__asm__ __volatile__("" :: "m" (FpDest.uw));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpUFixedSIop = InstObjParams("vcvt", "VcvtFpUFixedS", "FpRegRegImmOp",
{ "code": vcvtFpUFixedSCode,
exec_output += PredOpExecute.subst(vcvtFpUFixedSIop);
vcvtFpUFixedDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t mid = vfpFpDToFixed(cOp1.fp, false, false, imm);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t mid = vfpFpDToFixed(cOp1, false, false, imm);
__asm__ __volatile__("" :: "m" (mid));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = mid;
FpDestP1.uw = mid >> 32;
'''
exec_output += PredOpExecute.subst(vcvtFpUFixedDIop);
vcvtSFixedFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.sw) : "m" (FpOp1.sw));
FpDest = vfpSFixedToFpS(Fpscr, FpOp1.sw, false, imm);
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtSFixedFpSIop = InstObjParams("vcvt", "VcvtSFixedFpS", "FpRegRegImmOp",
{ "code": vcvtSFixedFpSCode,
exec_output += PredOpExecute.subst(vcvtSFixedFpSIop);
vcvtSFixedFpDCode = '''
- IntDoubleUnion cDest;
+ FPSCR fpscr = Fpscr;
uint64_t mid = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (mid) : "m" (mid));
- cDest.fp = vfpSFixedToFpD(Fpscr, mid, false, imm);
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = vfpSFixedToFpD(Fpscr, mid, false, imm);
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtSFixedFpDIop = InstObjParams("vcvt", "VcvtSFixedFpD", "FpRegRegImmOp",
{ "code": vcvtSFixedFpDCode,
exec_output += PredOpExecute.subst(vcvtSFixedFpDIop);
vcvtUFixedFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.uw) : "m" (FpOp1.uw));
FpDest = vfpUFixedToFpS(Fpscr, FpOp1.uw, false, imm);
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtUFixedFpSIop = InstObjParams("vcvt", "VcvtUFixedFpS", "FpRegRegImmOp",
{ "code": vcvtUFixedFpSCode,
exec_output += PredOpExecute.subst(vcvtUFixedFpSIop);
vcvtUFixedFpDCode = '''
- IntDoubleUnion cDest;
+ FPSCR fpscr = Fpscr;
uint64_t mid = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (mid) : "m" (mid));
- cDest.fp = vfpUFixedToFpD(Fpscr, mid, false, imm);
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = vfpUFixedToFpD(Fpscr, mid, false, imm);
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtUFixedFpDIop = InstObjParams("vcvt", "VcvtUFixedFpD", "FpRegRegImmOp",
{ "code": vcvtUFixedFpDCode,
exec_output += PredOpExecute.subst(vcvtUFixedFpDIop);
vcvtFpSHFixedSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.sh = vfpFpSToFixed(FpOp1, true, true, imm);
__asm__ __volatile__("" :: "m" (FpDest.sh));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpSHFixedSIop = InstObjParams("vcvt", "VcvtFpSHFixedS",
"FpRegRegImmOp",
exec_output += PredOpExecute.subst(vcvtFpSHFixedSIop);
vcvtFpSHFixedDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t result = vfpFpDToFixed(cOp1.fp, true, true, imm);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t result = vfpFpDToFixed(cOp1, true, true, imm);
__asm__ __volatile__("" :: "m" (result));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = result;
FpDestP1.uw = result >> 32;
'''
exec_output += PredOpExecute.subst(vcvtFpSHFixedDIop);
vcvtFpUHFixedSCode = '''
- vfpFlushToZero(Fpscr, FpOp1);
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ vfpFlushToZero(fpscr, FpOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1));
FpDest.uh = vfpFpSToFixed(FpOp1, false, true, imm);
__asm__ __volatile__("" :: "m" (FpDest.uh));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtFpUHFixedSIop = InstObjParams("vcvt", "VcvtFpUHFixedS",
"FpRegRegImmOp",
exec_output += PredOpExecute.subst(vcvtFpUHFixedSIop);
vcvtFpUHFixedDCode = '''
- IntDoubleUnion cOp1;
- cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- vfpFlushToZero(Fpscr, cOp1.fp);
- VfpSavedState state = prepVfpFpscr(Fpscr);
- __asm__ __volatile__("" : "=m" (cOp1.fp) : "m" (cOp1.fp));
- uint64_t mid = vfpFpDToFixed(cOp1.fp, false, true, imm);
+ FPSCR fpscr = Fpscr;
+ double cOp1 = dbl(FpOp1P0.uw, FpOp1P1.uw);
+ vfpFlushToZero(fpscr, cOp1);
+ VfpSavedState state = prepFpState(fpscr.rMode);
+ __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1));
+ uint64_t mid = vfpFpDToFixed(cOp1, false, true, imm);
__asm__ __volatile__("" :: "m" (mid));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
FpDestP0.uw = mid;
FpDestP1.uw = mid >> 32;
'''
exec_output += PredOpExecute.subst(vcvtFpUHFixedDIop);
vcvtSHFixedFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.sh) : "m" (FpOp1.sh));
FpDest = vfpSFixedToFpS(Fpscr, FpOp1.sh, true, imm);
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtSHFixedFpSIop = InstObjParams("vcvt", "VcvtSHFixedFpS",
"FpRegRegImmOp",
exec_output += PredOpExecute.subst(vcvtSHFixedFpSIop);
vcvtSHFixedFpDCode = '''
- IntDoubleUnion cDest;
+ FPSCR fpscr = Fpscr;
uint64_t mid = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (mid) : "m" (mid));
- cDest.fp = vfpSFixedToFpD(Fpscr, mid, true, imm);
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = vfpSFixedToFpD(Fpscr, mid, true, imm);
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtSHFixedFpDIop = InstObjParams("vcvt", "VcvtSHFixedFpD",
"FpRegRegImmOp",
exec_output += PredOpExecute.subst(vcvtSHFixedFpDIop);
vcvtUHFixedFpSCode = '''
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ FPSCR fpscr = Fpscr;
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (FpOp1.uh) : "m" (FpOp1.uh));
FpDest = vfpUFixedToFpS(Fpscr, FpOp1.uh, true, imm);
__asm__ __volatile__("" :: "m" (FpDest));
- Fpscr = setVfpFpscr(Fpscr, state);
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
'''
vcvtUHFixedFpSIop = InstObjParams("vcvt", "VcvtUHFixedFpS",
"FpRegRegImmOp",
exec_output += PredOpExecute.subst(vcvtUHFixedFpSIop);
vcvtUHFixedFpDCode = '''
- IntDoubleUnion cDest;
+ FPSCR fpscr = Fpscr;
uint64_t mid = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
- VfpSavedState state = prepVfpFpscr(Fpscr);
+ VfpSavedState state = prepFpState(fpscr.rMode);
__asm__ __volatile__("" : "=m" (mid) : "m" (mid));
- cDest.fp = vfpUFixedToFpD(Fpscr, mid, true, imm);
- __asm__ __volatile__("" :: "m" (cDest.fp));
- Fpscr = setVfpFpscr(Fpscr, state);
- FpDestP0.uw = cDest.bits;
- FpDestP1.uw = cDest.bits >> 32;
+ double cDest = vfpUFixedToFpD(Fpscr, mid, true, imm);
+ __asm__ __volatile__("" :: "m" (cDest));
+ finishVfp(fpscr, state);
+ Fpscr = fpscr;
+ FpDestP0.uw = dblLow(cDest);
+ FpDestP1.uw = dblHi(cDest);
'''
vcvtUHFixedFpDIop = InstObjParams("vcvt", "VcvtUHFixedFpD",
"FpRegRegImmOp",