if (sub_i) {
elt2_i = fplibNeg<Element>(elt2_i);
}
- fpscr = (FPSCR) FpscrExc;
+ fpscr = FpscrExc & ~FpscrAhpMask;
acc_r = fplibAdd<Element>(acc_r, elt2_i, fpscr);
FpscrExc = fpscr;
}
if (sub_r) {
elt2_r = fplibNeg<Element>(elt2_r);
}
- fpscr = (FPSCR) FpscrExc;
+ fpscr = FpscrExc & ~FpscrAhpMask;
acc_i = fplibAdd<Element>(acc_i, elt2_r, fpscr);
FpscrExc = fpscr;
}
if (neg_r) {
elt2_a = fplibNeg<Element>(elt2_a);
}
- fpscr = (FPSCR) FpscrExc;
+ fpscr = FpscrExc & ~FpscrAhpMask;
addend_r = fplibMulAdd<Element>(addend_r, elt1_a, elt2_a, fpscr);
FpscrExc = fpscr;'''
if predType != PredType.NONE:
if (neg_i) {
elt2_b = fplibNeg<Element>(elt2_b);
}
- fpscr = (FPSCR) FpscrExc;
+ fpscr = FpscrExc & ~FpscrAhpMask;
addend_i = fplibMulAdd<Element>(addend_i, elt1_a, elt2_b, fpscr);
FpscrExc = fpscr;'''
if predType != PredType.NONE:
sveExtInst('ext', 'Ext', 'SimdAluOp')
# FABD
fpOp = '''
- FPSCR fpscr = (FPSCR) FpscrExc;
+ FPSCR fpscr = FpscrExc & ~FpscrAhpMask;
destElem = %s;
FpscrExc = fpscr;
'''
sveBinInst('fadd', 'FaddUnpred', 'SimdFloatAddOp', floatTypes, faddCode)
# FADDA
fpAddaOp = '''
- FPSCR fpscr = (FPSCR) FpscrExc;
+ FPSCR fpscr = FpscrExc & ~FpscrAhpMask;
destElem = fplibAdd<Element>(destElem, srcElem1, fpscr);
FpscrExc = FpscrExc | fpscr;
'''
fpAddaOp)
# FADDV
fpReduceOp = '''
- FPSCR fpscr = (FPSCR) FpscrExc;
+ FPSCR fpscr = FpscrExc & ~FpscrAhpMask;
destElem = fplib%s<Element>(srcElem1, srcElem2, fpscr);
FpscrExc = FpscrExc | fpscr;
'''
// This mask selects bits of the FPSCR that actually go in the FpCondCodes
// integer register to allow renaming.
static const uint32_t FpCondCodesMask = 0xF0000000;
- // This mask selects the cumulative FP exception flags of the FPSCR.
- static const uint32_t FpscrExcMask = 0x0000009F;
// This mask selects the cumulative saturation flag of the FPSCR.
static const uint32_t FpscrQcMask = 0x08000000;
+ // This mask selects the AHP bit of the FPSCR.
+ static const uint32_t FpscrAhpMask = 0x04000000;
+ // This mask selects the cumulative FP exception flags of the FPSCR.
+ static const uint32_t FpscrExcMask = 0x0000009F;
/**
* Check for permission to read coprocessor registers.