libc: native _addv() and _subv() routines for arm

This commit is contained in:
cinap_lenrek 2016-06-26 15:16:23 +02:00
parent a99cf56c7d
commit 69b0980a42
2 changed files with 24 additions and 36 deletions

View file

@ -3,11 +3,30 @@ TEXT _mulv(SB), 1, $0
MOVW 8(FP),R11 /* h0 */
MOVW 12(FP),R4 /* l1 */
MOVW 16(FP),R5 /* h1 */
MULLU R8,R4,(R6, R7) /* l0*l1 */
MULLU R8,R4,(R7,R6) /* l0*l1 */
MUL R8,R5,R5 /* l0*h1 */
ADD R5,R7
MUL R11,R4,R4 /* h0*l1 */
ADD R4,R6
ADD R5,R6
MOVW R6,4(R0)
MOVW R7,0(R0)
ADD R4,R7
MOVM.IA [R6,R7],(R0)
RET
TEXT _addv(SB), 1, $0
MOVW 4(FP),R8 /* l0 */
MOVW 8(FP),R11 /* h0 */
MOVW 12(FP),R4 /* l1 */
MOVW 16(FP),R5 /* h1 */
ADD.S R8,R4
ADC R11,R5
MOVM.IA [R4,R5],(R0)
RET
TEXT _subv(SB), 1, $0
MOVW 4(FP),R8 /* l0 */
MOVW 8(FP),R11 /* h0 */
MOVW 12(FP),R4 /* l1 */
MOVW 16(FP),R5 /* h1 */
SUB.S R4,R8,R4
SBC R5,R11,R5
MOVM.IA [R4,R5],(R0)
RET

View file

@ -15,37 +15,6 @@ struct Vlong
void abort(void);
/* needed by profiler; can't be profiled */
#pragma profile off
void
_addv(Vlong *r, Vlong a, Vlong b)
{
ulong lo, hi;
lo = a.lo + b.lo;
hi = a.hi + b.hi;
if(lo < a.lo)
hi++;
r->lo = lo;
r->hi = hi;
}
void
_subv(Vlong *r, Vlong a, Vlong b)
{
ulong lo, hi;
lo = a.lo - b.lo;
hi = a.hi - b.hi;
if(lo > a.lo)
hi--;
r->lo = lo;
r->hi = hi;
}
#pragma profile on
void
_d2v(Vlong *y, double d)
{