From: Rich Felker Date: Wed, 20 Jan 2016 02:07:59 +0000 (+0000) Subject: switch arm, sh, and mips fenv asm from .sub system to .S files X-Git-Tag: v1.1.13~93 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=af21a82ccc8687aa16e85def7db95efeae4cf72e;p=oweals%2Fmusl.git switch arm, sh, and mips fenv asm from .sub system to .S files --- diff --git a/src/fenv/arm/fenv-hf.S b/src/fenv/arm/fenv-hf.S new file mode 100644 index 00000000..f55d798a --- /dev/null +++ b/src/fenv/arm/fenv-hf.S @@ -0,0 +1,69 @@ +#if __ARM_PCS_VFP + +.syntax unified +.fpu vfp + +.global fegetround +.type fegetround,%function +fegetround: + fmrx r0, fpscr + and r0, r0, #0xc00000 + bx lr + +.global __fesetround +.type __fesetround,%function +__fesetround: + fmrx r3, fpscr + bic r3, r3, #0xc00000 + orr r3, r3, r0 + fmxr fpscr, r3 + mov r0, #0 + bx lr + +.global fetestexcept +.type fetestexcept,%function +fetestexcept: + and r0, r0, #0x1f + fmrx r3, fpscr + and r0, r0, r3 + bx lr + +.global feclearexcept +.type feclearexcept,%function +feclearexcept: + and r0, r0, #0x1f + fmrx r3, fpscr + bic r3, r3, r0 + fmxr fpscr, r3 + mov r0, #0 + bx lr + +.global feraiseexcept +.type feraiseexcept,%function +feraiseexcept: + and r0, r0, #0x1f + fmrx r3, fpscr + orr r3, r3, r0 + fmxr fpscr, r3 + mov r0, #0 + bx lr + +.global fegetenv +.type fegetenv,%function +fegetenv: + fmrx r3, fpscr + str r3, [r0] + mov r0, #0 + bx lr + +.global fesetenv +.type fesetenv,%function +fesetenv: + cmn r0, #1 + moveq r3, #0 + ldrne r3, [r0] + fmxr fpscr, r3 + mov r0, #0 + bx lr + +#endif diff --git a/src/fenv/arm/fenv.c b/src/fenv/arm/fenv.c new file mode 100644 index 00000000..ad295f58 --- /dev/null +++ b/src/fenv/arm/fenv.c @@ -0,0 +1,3 @@ +#if !__ARM_PCS_VFP +#include "../fenv.c" +#endif diff --git a/src/fenv/armebhf/fenv.sub b/src/fenv/armebhf/fenv.sub deleted file mode 100644 index 5281e40b..00000000 --- a/src/fenv/armebhf/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -../armhf/fenv.s diff --git a/src/fenv/armhf/fenv.s b/src/fenv/armhf/fenv.s deleted file mode 100644 index 53307e68..00000000 --- a/src/fenv/armhf/fenv.s +++ /dev/null @@ -1,65 +0,0 @@ -.syntax unified -.fpu vfp - -.global fegetround -.type fegetround,%function -fegetround: - fmrx r0, fpscr - and r0, r0, #0xc00000 - bx lr - -.global __fesetround -.type __fesetround,%function -__fesetround: - fmrx r3, fpscr - bic r3, r3, #0xc00000 - orr r3, r3, r0 - fmxr fpscr, r3 - mov r0, #0 - bx lr - -.global fetestexcept -.type fetestexcept,%function -fetestexcept: - and r0, r0, #0x1f - fmrx r3, fpscr - and r0, r0, r3 - bx lr - -.global feclearexcept -.type feclearexcept,%function -feclearexcept: - and r0, r0, #0x1f - fmrx r3, fpscr - bic r3, r3, r0 - fmxr fpscr, r3 - mov r0, #0 - bx lr - -.global feraiseexcept -.type feraiseexcept,%function -feraiseexcept: - and r0, r0, #0x1f - fmrx r3, fpscr - orr r3, r3, r0 - fmxr fpscr, r3 - mov r0, #0 - bx lr - -.global fegetenv -.type fegetenv,%function -fegetenv: - fmrx r3, fpscr - str r3, [r0] - mov r0, #0 - bx lr - -.global fesetenv -.type fesetenv,%function -fesetenv: - cmn r0, #1 - moveq r3, #0 - ldrne r3, [r0] - fmxr fpscr, r3 - mov r0, #0 - bx lr diff --git a/src/fenv/armhf/fenv.sub b/src/fenv/armhf/fenv.sub deleted file mode 100644 index ec559cd4..00000000 --- a/src/fenv/armhf/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -fenv.s diff --git a/src/fenv/mips-sf/fenv.sub b/src/fenv/mips-sf/fenv.sub deleted file mode 100644 index 9cafca5e..00000000 --- a/src/fenv/mips-sf/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -../fenv.c diff --git a/src/fenv/mips/fenv-sf.c b/src/fenv/mips/fenv-sf.c new file mode 100644 index 00000000..4aa3dbf1 --- /dev/null +++ b/src/fenv/mips/fenv-sf.c @@ -0,0 +1,3 @@ +#ifdef __mips_soft_float +#include "../fenv.c" +#endif diff --git a/src/fenv/mips/fenv.S b/src/fenv/mips/fenv.S new file mode 100644 index 00000000..a5cb1f58 --- /dev/null +++ b/src/fenv/mips/fenv.S @@ -0,0 +1,71 @@ +#ifndef __mips_soft_float + +.set noreorder + +.global feclearexcept +.type feclearexcept,@function +feclearexcept: + and $4, $4, 0x7c + cfc1 $5, $31 + or $5, $5, $4 + xor $5, $5, $4 + ctc1 $5, $31 + jr $ra + li $2, 0 + +.global feraiseexcept +.type feraiseexcept,@function +feraiseexcept: + and $4, $4, 0x7c + cfc1 $5, $31 + or $5, $5, $4 + ctc1 $5, $31 + jr $ra + li $2, 0 + +.global fetestexcept +.type fetestexcept,@function +fetestexcept: + and $4, $4, 0x7c + cfc1 $2, $31 + jr $ra + and $2, $2, $4 + +.global fegetround +.type fegetround,@function +fegetround: + cfc1 $2, $31 + jr $ra + andi $2, $2, 3 + +.global __fesetround +.type __fesetround,@function +__fesetround: + cfc1 $5, $31 + li $6, -4 + and $5, $5, $6 + or $5, $5, $4 + ctc1 $5, $31 + jr $ra + li $2, 0 + +.global fegetenv +.type fegetenv,@function +fegetenv: + cfc1 $5, $31 + sw $5, 0($4) + jr $ra + li $2, 0 + +.global fesetenv +.type fesetenv,@function +fesetenv: + addiu $5, $4, 1 + beq $5, $0, 1f + nop + lw $5, 0($4) +1: ctc1 $5, $31 + jr $ra + li $2, 0 + +#endif diff --git a/src/fenv/mips/fenv.s b/src/fenv/mips/fenv.s deleted file mode 100644 index 62828212..00000000 --- a/src/fenv/mips/fenv.s +++ /dev/null @@ -1,67 +0,0 @@ -.set noreorder - -.global feclearexcept -.type feclearexcept,@function -feclearexcept: - and $4, $4, 0x7c - cfc1 $5, $31 - or $5, $5, $4 - xor $5, $5, $4 - ctc1 $5, $31 - jr $ra - li $2, 0 - -.global feraiseexcept -.type feraiseexcept,@function -feraiseexcept: - and $4, $4, 0x7c - cfc1 $5, $31 - or $5, $5, $4 - ctc1 $5, $31 - jr $ra - li $2, 0 - -.global fetestexcept -.type fetestexcept,@function -fetestexcept: - and $4, $4, 0x7c - cfc1 $2, $31 - jr $ra - and $2, $2, $4 - -.global fegetround -.type fegetround,@function -fegetround: - cfc1 $2, $31 - jr $ra - andi $2, $2, 3 - -.global __fesetround -.type __fesetround,@function -__fesetround: - cfc1 $5, $31 - li $6, -4 - and $5, $5, $6 - or $5, $5, $4 - ctc1 $5, $31 - jr $ra - li $2, 0 - -.global fegetenv -.type fegetenv,@function -fegetenv: - cfc1 $5, $31 - sw $5, 0($4) - jr $ra - li $2, 0 - -.global fesetenv -.type fesetenv,@function -fesetenv: - addiu $5, $4, 1 - beq $5, $0, 1f - nop - lw $5, 0($4) -1: ctc1 $5, $31 - jr $ra - li $2, 0 diff --git a/src/fenv/mipsel-sf/fenv.sub b/src/fenv/mipsel-sf/fenv.sub deleted file mode 100644 index 9cafca5e..00000000 --- a/src/fenv/mipsel-sf/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -../fenv.c diff --git a/src/fenv/sh-nofpu/fenv.sub b/src/fenv/sh-nofpu/fenv.sub deleted file mode 100644 index 9cafca5e..00000000 --- a/src/fenv/sh-nofpu/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -../fenv.c diff --git a/src/fenv/sh/fenv-nofpu.c b/src/fenv/sh/fenv-nofpu.c new file mode 100644 index 00000000..b2495a65 --- /dev/null +++ b/src/fenv/sh/fenv-nofpu.c @@ -0,0 +1,3 @@ +#if !__SH_FPU_ANY__ && !__SH4__ +#include "../fenv.c" +#endif diff --git a/src/fenv/sh/fenv.S b/src/fenv/sh/fenv.S new file mode 100644 index 00000000..cd47b5bc --- /dev/null +++ b/src/fenv/sh/fenv.S @@ -0,0 +1,78 @@ +#if __SH_FPU_ANY__ || __SH4__ + +.global fegetround +.type fegetround, @function +fegetround: + sts fpscr, r0 + rts + and #3, r0 + +.global __fesetround +.type __fesetround, @function +__fesetround: + sts fpscr, r0 + or r4, r0 + lds r0, fpscr + rts + mov #0, r0 + +.global fetestexcept +.type fetestexcept, @function +fetestexcept: + sts fpscr, r0 + and r4, r0 + rts + and #0x7c, r0 + +.global feclearexcept +.type feclearexcept, @function +feclearexcept: + mov r4, r0 + and #0x7c, r0 + not r0, r4 + sts fpscr, r0 + and r4, r0 + lds r0, fpscr + rts + mov #0, r0 + +.global feraiseexcept +.type feraiseexcept, @function +feraiseexcept: + mov r4, r0 + and #0x7c, r0 + sts fpscr, r4 + or r4, r0 + lds r0, fpscr + rts + mov #0, r0 + +.global fegetenv +.type fegetenv, @function +fegetenv: + sts fpscr, r0 + mov.l r0, @r4 + rts + mov #0, r0 + +.global fesetenv +.type fesetenv, @function +fesetenv: + mov r4, r0 + cmp/eq #-1, r0 + bf 1f + + ! the default environment is complicated by the fact that we need to + ! preserve the current precision bit, which we do not know a priori + sts fpscr, r0 + mov #8, r1 + swap.w r1, r1 + bra 2f + and r1, r0 + +1: mov.l @r4, r0 ! non-default environment +2: lds r0, fpscr + rts + mov #0, r0 + +#endif diff --git a/src/fenv/sh/fenv.s b/src/fenv/sh/fenv.s deleted file mode 100644 index 7f5c6277..00000000 --- a/src/fenv/sh/fenv.s +++ /dev/null @@ -1,74 +0,0 @@ -.global fegetround -.type fegetround, @function -fegetround: - sts fpscr, r0 - rts - and #3, r0 - -.global __fesetround -.type __fesetround, @function -__fesetround: - sts fpscr, r0 - or r4, r0 - lds r0, fpscr - rts - mov #0, r0 - -.global fetestexcept -.type fetestexcept, @function -fetestexcept: - sts fpscr, r0 - and r4, r0 - rts - and #0x7c, r0 - -.global feclearexcept -.type feclearexcept, @function -feclearexcept: - mov r4, r0 - and #0x7c, r0 - not r0, r4 - sts fpscr, r0 - and r4, r0 - lds r0, fpscr - rts - mov #0, r0 - -.global feraiseexcept -.type feraiseexcept, @function -feraiseexcept: - mov r4, r0 - and #0x7c, r0 - sts fpscr, r4 - or r4, r0 - lds r0, fpscr - rts - mov #0, r0 - -.global fegetenv -.type fegetenv, @function -fegetenv: - sts fpscr, r0 - mov.l r0, @r4 - rts - mov #0, r0 - -.global fesetenv -.type fesetenv, @function -fesetenv: - mov r4, r0 - cmp/eq #-1, r0 - bf 1f - - ! the default environment is complicated by the fact that we need to - ! preserve the current precision bit, which we do not know a priori - sts fpscr, r0 - mov #8, r1 - swap.w r1, r1 - bra 2f - and r1, r0 - -1: mov.l @r4, r0 ! non-default environment -2: lds r0, fpscr - rts - mov #0, r0 diff --git a/src/fenv/sheb-nofpu/fenv.sub b/src/fenv/sheb-nofpu/fenv.sub deleted file mode 100644 index 9cafca5e..00000000 --- a/src/fenv/sheb-nofpu/fenv.sub +++ /dev/null @@ -1 +0,0 @@ -../fenv.c