diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/arm/int64.s | 45 | ||||
-rw-r--r-- | runtime/ia32/int64.s | 57 | ||||
-rw-r--r-- | runtime/powerpc/int64.s | 50 | ||||
-rw-r--r-- | runtime/test/test_int64.c | 19 |
4 files changed, 0 insertions, 171 deletions
diff --git a/runtime/arm/int64.s b/runtime/arm/int64.s index 6b03351..58ac024 100644 --- a/runtime/arm/int64.s +++ b/runtime/arm/int64.s @@ -77,36 +77,6 @@ __i64_scmp: .type __i64_scmp, %function .size __i64_scmp, . - __i64_scmp -@@@ Opposite - - .global __i64_neg -__i64_neg: - rsbs r0, r0, #0 - rsc r1, r1, #0 - bx lr - .type __i64_neg, %function - .size __i64_neg, . - __i64_neg - -@@@ Addition - - .global __i64_add -__i64_add: - adds r0, r0, r2 - adc r1, r1, r3 - bx lr - .type __i64_add, %function - .size __i64_add, . - __i64_add - -@@@ Subtraction - - .global __i64_sub -__i64_sub: - subs r0, r0, r2 - sbc r1, r1, r3 - bx lr - .type __i64_sub, %function - .size __i64_sub, . - __i64_sub - @ Note on ARM shifts: the shift amount is taken modulo 256. @ Therefore, unsigned shifts by 32 bits or more produce 0. @@ -167,21 +137,6 @@ __i64_sar: .type __i64_sar, %function .size __i64_sar, . - __i64_sar -@@@ Multiplication - - .global __i64_mul -__i64_mul: - push {r4, r5} - mov r4, r0 @ save first arg in r4,r5 - mov r5, r1 - umull r0, r1, r2, r4 @ 64-bit product of low halves - mla r1, r2, r5, r1 @ add 32-bit products low half * high half - mla r1, r3, r4, r1 @ to high half of result - pop {r4, r5} - bx lr - .type __i64_mul, %function - .size __i64_mul, . - __i64_mul - @@@ Auxiliary function for division and modulus. Not exported. @ On entry: N = (r0, r1) numerator D = (r2, r3) divisor diff --git a/runtime/ia32/int64.s b/runtime/ia32/int64.s index 8fd8151..06a3b49 100644 --- a/runtime/ia32/int64.s +++ b/runtime/ia32/int64.s @@ -36,63 +36,6 @@ .text -# Opposite - - .globl __i64_neg - .balign 16 -__i64_neg: - movl 4(%esp), %eax - movl 8(%esp), %edx - negl %eax - adcl $0, %edx - negl %edx - ret - .type __i64_neg, @function - .size __i64_neg, . - __i64_neg - -# Addition - - .globl __i64_add - .balign 16 -__i64_add: - movl 4(%esp), %eax - movl 8(%esp), %edx - addl 12(%esp), %eax - adcl 16(%esp), %edx - ret - .type __i64_add, @function - .size __i64_add, . - __i64_add - -# Subtraction - - .globl __i64_sub - .balign 16 -__i64_sub: - movl 4(%esp), %eax - movl 8(%esp), %edx - subl 12(%esp), %eax - sbbl 16(%esp), %edx - ret - .type __i64_sub, @function - .size __i64_sub, . - __i64_sub - -# Multiplication - - .globl __i64_mul - .balign 16 -__i64_mul: - movl 4(%esp), %eax - mull 12(%esp) # edx:eax = xlo * ylo - movl 4(%esp), %ecx - imull 16(%esp), %ecx # ecx = xlo * yhi - addl %ecx, %edx - movl 12(%esp), %ecx # ecx = xhi * ylo - imull 8(%esp), %ecx - addl %ecx, %edx - ret - .type __i64_mul, @function - .size __i64_mul, . - __i64_mul - # Division and remainder # Auxiliary function, not exported. diff --git a/runtime/powerpc/int64.s b/runtime/powerpc/int64.s index 34b65b5..247e3cd 100644 --- a/runtime/powerpc/int64.s +++ b/runtime/powerpc/int64.s @@ -45,56 +45,6 @@ .text -### Opposite - - .balign 16 - .globl __i64_neg -__i64_neg: - subfic r4, r4, 0 # RL = -XL and set borrow iff XL != 0 - subfze r3, r3 # RH = -XH - borrow - blr - .type __i64_neg, @function - .size __i64_neg, .-__i64_neg - -### Addition - - .balign 16 - .globl __i64_add -__i64_add: - addc r4, r4, r6 # RL = XL + YL and set carry if overflow - adde r3, r3, r5 # RH = XH + YH + carry - blr - .type __i64_add, @function - .size __i64_add, .-__i64_add - -### Subtraction - - .balign 16 - .globl __i64_sub -__i64_sub: - subfc r4, r6, r4 # RL = XL - YL and set borrow if underflow - subfe r3, r5, r3 # RH = XH - YH - borrow - blr - .type __i64_sub, @function - .size __i64_sub, .-__i64_sub - -### Multiplication - - .balign 16 - .globl __i64_mul -__i64_mul: - # Form intermediate products - mulhwu r7, r4, r6 # r7 = high half of XL * YL - mullw r8, r3, r6 # r8 = low half of XH * YL - mullw r9, r4, r5 # r9 = low half of XL * YH - mullw r4, r4, r6 # r4 = low half of XL * YL = low half of result - # Reconstruct high half of result - add r3, r7, r8 - add r3, r3, r9 - blr - .type __i64_mul, @function - .size __i64_mul, .-__i64_mul - ### Helper function for division and modulus. Not exported. # Input: numerator N in (r3,r4), divisor D in (r5,r6) # Output: quotient Q in (r7,r8), remainder R in (r3,r4) diff --git a/runtime/test/test_int64.c b/runtime/test/test_int64.c index 11adce3..49e732a 100644 --- a/runtime/test/test_int64.c +++ b/runtime/test/test_int64.c @@ -41,10 +41,6 @@ typedef unsigned long long u64; typedef signed long long s64; -extern s64 __i64_neg(s64 x); -extern s64 __i64_add(s64 x, s64 y); -extern s64 __i64_sub(s64 x, s64 y); -extern s64 __i64_mul(s64 x, s64 y); extern u64 __i64_udiv(u64 x, u64 y); extern u64 __i64_umod(u64 x, u64 y); extern s64 __i64_sdiv(s64 x, s64 y); @@ -78,21 +74,6 @@ static void test1(u64 x, u64 y) int i; double f, g; - z = __i64_neg(x); - if (z != -x) - error++, printf("- %016llx = %016llx, expected %016llx\n", x, z, -x); - z = __i64_add(x, y); - if (z != x + y) - error++, printf("%016llx + %016llx = %016llx, expected %016llx\n", x, y, z, x + y); - - z = __i64_sub(x, y); - if (z != x - y) - error++, printf("%016llx - %016llx = %016llx, expected %016llx\n", x, y, z, x - y); - - z = __i64_mul(x, y); - if (z != x * y) - error++, printf("%016llx * %016llx = %016llx, expected %016llx\n", x, y, z, x * y); - if (y != 0) { z = __i64_udiv(x, y); |