/* VABS Floating-point Absolute takes the absolute value of a single-precision register, and places the result in a second register. VABS<c>.F32 <Sd>, <Sm> 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 |1 1 1 0| 1 1 1 0 1| D| 1 1| 0 0 0 0| Vd | 1 0 1 sz 1 1 M 0| Vm | where : <c>, <q> See Standard assembler syntax fields on page A7-175. <Sd>, <Sm> The destination single-precision register and the operand single-precision register. <Dd>, <Dm> The destination double-precision register and the operand double-precision register, for a double-precision operation. */ void VABS(uint32_t instruction) { uint32_t Vd = getBits(instruction,15,12); uint32_t Vm = getBits(instruction,3,0); uint32_t sz = getBits(instruction,8,8); uint32_t M = getBits(instruction,5,5); uint32_t D = getBits(instruction,22,22); uint32_t d = determineRegisterBasedOnSZ(D, Vd, sz); uint32_t m = determineRegisterBasedOnSZ(M, Vm, sz); executeFPUChecking(); if(inITBlock()) { if( checkCondition(cond) ) { if(sz == 1) ThrowError(); //undefined instruction if sz == 1 in FPv4-SP architecture else writeSinglePrecision(d, FPAbs(fpuSinglePrecision[m], 32 ) ); } shiftITState(); } else { if(sz == 1) ThrowError(); //undefined instruction if sz == 1 in FPv4-SP architecture else writeSinglePrecision(d, FPAbs(fpuSinglePrecision[m], 32 ) ); } coreReg[PC] += 4; }
scalar FPArcTan2(scalar a, scalar b) { if (a == 0) { if (b == 0) return 0; else return FPSgn(b)*(PI/2); } if (a > 0) return FPArcTan(FPDiv(b,a)); else return FPSgn(b) * (PI - FPArcTan(FPAbs(FPDiv(b,a)))); }
scalar Vector::manhattanNorm() const { return FPAbs(x) + FPAbs(y) + FPAbs(z); }