mirror of
https://github.com/projectPiki/pikmin2.git
synced 2024-12-02 18:36:39 +00:00
e_atan2 linked
the sweet smell of progress
This commit is contained in:
parent
53fe3a9d61
commit
0d6866a44e
@ -1,247 +0,0 @@
|
||||
.include "macros.inc"
|
||||
.section .sdata2, "a" # 0x80516360 - 0x80520E40
|
||||
.balign 0x8
|
||||
.global lbl_80517178
|
||||
lbl_80517178:
|
||||
.4byte 0x400921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_80517180
|
||||
lbl_80517180:
|
||||
.4byte 0xC00921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_80517188
|
||||
lbl_80517188:
|
||||
.4byte 0xBFF921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_80517190
|
||||
lbl_80517190:
|
||||
.4byte 0x3FF921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_80517198
|
||||
lbl_80517198:
|
||||
.4byte 0x3FE921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_805171A0
|
||||
lbl_805171A0:
|
||||
.4byte 0xBFE921FB
|
||||
.4byte 0x54442D18
|
||||
.global lbl_805171A8
|
||||
lbl_805171A8:
|
||||
.4byte 0x4002D97C
|
||||
.4byte 0x7F3321D2
|
||||
.global lbl_805171B0
|
||||
lbl_805171B0:
|
||||
.4byte 0xC002D97C
|
||||
.4byte 0x7F3321D2
|
||||
.global lbl_805171B8
|
||||
lbl_805171B8:
|
||||
.4byte 0x00000000
|
||||
.4byte 0x00000000
|
||||
.global lbl_805171C0
|
||||
lbl_805171C0:
|
||||
.4byte 0x80000000
|
||||
.4byte 0x00000000
|
||||
.global lbl_805171C8
|
||||
lbl_805171C8:
|
||||
.4byte 0x3CA1A626
|
||||
.4byte 0x33145C07
|
||||
|
||||
.section .text, "ax" # 0x800056C0 - 0x80472F00
|
||||
.global __ieee754_atan2
|
||||
__ieee754_atan2:
|
||||
/* 800CC5E8 000C9528 94 21 FF D0 */ stwu r1, -0x30(r1)
|
||||
/* 800CC5EC 000C952C 7C 08 02 A6 */ mflr r0
|
||||
/* 800CC5F0 000C9530 3C 60 7F F0 */ lis r3, 0x7ff0
|
||||
/* 800CC5F4 000C9534 D8 41 00 10 */ stfd f2, 0x10(r1)
|
||||
/* 800CC5F8 000C9538 81 01 00 14 */ lwz r8, 0x14(r1)
|
||||
/* 800CC5FC 000C953C 90 01 00 34 */ stw r0, 0x34(r1)
|
||||
/* 800CC600 000C9540 7C 08 00 D0 */ neg r0, r8
|
||||
/* 800CC604 000C9544 80 81 00 10 */ lwz r4, 0x10(r1)
|
||||
/* 800CC608 000C9548 7D 00 03 78 */ or r0, r8, r0
|
||||
/* 800CC60C 000C954C D8 21 00 08 */ stfd f1, 8(r1)
|
||||
/* 800CC610 000C9550 54 86 00 7E */ clrlwi r6, r4, 1
|
||||
/* 800CC614 000C9554 54 00 0F FE */ srwi r0, r0, 0x1f
|
||||
/* 800CC618 000C9558 80 A1 00 08 */ lwz r5, 8(r1)
|
||||
/* 800CC61C 000C955C 7C C0 03 78 */ or r0, r6, r0
|
||||
/* 800CC620 000C9560 93 E1 00 2C */ stw r31, 0x2c(r1)
|
||||
/* 800CC624 000C9564 7C 00 18 40 */ cmplw r0, r3
|
||||
/* 800CC628 000C9568 81 21 00 0C */ lwz r9, 0xc(r1)
|
||||
/* 800CC62C 000C956C 54 A7 00 7E */ clrlwi r7, r5, 1
|
||||
/* 800CC630 000C9570 41 81 00 1C */ bgt lbl_800CC64C
|
||||
/* 800CC634 000C9574 7C 09 00 D0 */ neg r0, r9
|
||||
/* 800CC638 000C9578 7D 20 03 78 */ or r0, r9, r0
|
||||
/* 800CC63C 000C957C 54 00 0F FE */ srwi r0, r0, 0x1f
|
||||
/* 800CC640 000C9580 7C E0 03 78 */ or r0, r7, r0
|
||||
/* 800CC644 000C9584 7C 00 18 40 */ cmplw r0, r3
|
||||
/* 800CC648 000C9588 40 81 00 14 */ ble lbl_800CC65C
|
||||
lbl_800CC64C:
|
||||
/* 800CC64C 000C958C C8 21 00 10 */ lfd f1, 0x10(r1)
|
||||
/* 800CC650 000C9590 C8 01 00 08 */ lfd f0, 8(r1)
|
||||
/* 800CC654 000C9594 FC 21 00 2A */ fadd f1, f1, f0
|
||||
/* 800CC658 000C9598 48 00 02 0C */ b lbl_800CC864
|
||||
lbl_800CC65C:
|
||||
/* 800CC65C 000C959C 3C 04 C0 10 */ addis r0, r4, 0xc010
|
||||
/* 800CC660 000C95A0 7C 00 43 79 */ or. r0, r0, r8
|
||||
/* 800CC664 000C95A4 40 82 00 0C */ bne lbl_800CC670
|
||||
/* 800CC668 000C95A8 48 00 28 C9 */ bl atan
|
||||
/* 800CC66C 000C95AC 48 00 01 F8 */ b lbl_800CC864
|
||||
lbl_800CC670:
|
||||
/* 800CC670 000C95B0 7C E0 4B 79 */ or. r0, r7, r9
|
||||
/* 800CC674 000C95B4 54 80 17 BC */ rlwinm r0, r4, 2, 0x1e, 0x1e
|
||||
/* 800CC678 000C95B8 7C 1F 03 78 */ mr r31, r0
|
||||
/* 800CC67C 000C95BC 50 BF 0F FE */ rlwimi r31, r5, 1, 0x1f, 0x1f
|
||||
/* 800CC680 000C95C0 40 82 00 3C */ bne lbl_800CC6BC
|
||||
/* 800CC684 000C95C4 2C 1F 00 02 */ cmpwi r31, 2
|
||||
/* 800CC688 000C95C8 41 82 00 24 */ beq lbl_800CC6AC
|
||||
/* 800CC68C 000C95CC 40 80 00 10 */ bge lbl_800CC69C
|
||||
/* 800CC690 000C95D0 2C 1F 00 00 */ cmpwi r31, 0
|
||||
/* 800CC694 000C95D4 40 80 01 D0 */ bge lbl_800CC864
|
||||
/* 800CC698 000C95D8 48 00 00 24 */ b lbl_800CC6BC
|
||||
lbl_800CC69C:
|
||||
/* 800CC69C 000C95DC 2C 1F 00 04 */ cmpwi r31, 4
|
||||
/* 800CC6A0 000C95E0 40 80 00 1C */ bge lbl_800CC6BC
|
||||
/* 800CC6A4 000C95E4 48 00 00 10 */ b lbl_800CC6B4
|
||||
/* 800CC6A8 000C95E8 48 00 01 BC */ b lbl_800CC864
|
||||
lbl_800CC6AC:
|
||||
/* 800CC6AC 000C95EC C8 22 8E 18 */ lfd f1, lbl_80517178@sda21(r2)
|
||||
/* 800CC6B0 000C95F0 48 00 01 B4 */ b lbl_800CC864
|
||||
lbl_800CC6B4:
|
||||
/* 800CC6B4 000C95F4 C8 22 8E 20 */ lfd f1, lbl_80517180@sda21(r2)
|
||||
/* 800CC6B8 000C95F8 48 00 01 AC */ b lbl_800CC864
|
||||
lbl_800CC6BC:
|
||||
/* 800CC6BC 000C95FC 7C C0 43 79 */ or. r0, r6, r8
|
||||
/* 800CC6C0 000C9600 40 82 00 1C */ bne lbl_800CC6DC
|
||||
/* 800CC6C4 000C9604 2C 05 00 00 */ cmpwi r5, 0
|
||||
/* 800CC6C8 000C9608 40 80 00 0C */ bge lbl_800CC6D4
|
||||
/* 800CC6CC 000C960C C8 22 8E 28 */ lfd f1, lbl_80517188@sda21(r2)
|
||||
/* 800CC6D0 000C9610 48 00 01 94 */ b lbl_800CC864
|
||||
lbl_800CC6D4:
|
||||
/* 800CC6D4 000C9614 C8 22 8E 30 */ lfd f1, lbl_80517190@sda21(r2)
|
||||
/* 800CC6D8 000C9618 48 00 01 8C */ b lbl_800CC864
|
||||
lbl_800CC6DC:
|
||||
/* 800CC6DC 000C961C 3C 06 80 10 */ addis r0, r6, 0x8010
|
||||
/* 800CC6E0 000C9620 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 800CC6E4 000C9624 40 82 00 A0 */ bne lbl_800CC784
|
||||
/* 800CC6E8 000C9628 3C 07 80 10 */ addis r0, r7, 0x8010
|
||||
/* 800CC6EC 000C962C 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 800CC6F0 000C9630 40 82 00 4C */ bne lbl_800CC73C
|
||||
/* 800CC6F4 000C9634 2C 1F 00 02 */ cmpwi r31, 2
|
||||
/* 800CC6F8 000C9638 41 82 00 34 */ beq lbl_800CC72C
|
||||
/* 800CC6FC 000C963C 40 80 00 14 */ bge lbl_800CC710
|
||||
/* 800CC700 000C9640 2C 1F 00 00 */ cmpwi r31, 0
|
||||
/* 800CC704 000C9644 41 82 00 18 */ beq lbl_800CC71C
|
||||
/* 800CC708 000C9648 40 80 00 1C */ bge lbl_800CC724
|
||||
/* 800CC70C 000C964C 48 00 00 78 */ b lbl_800CC784
|
||||
lbl_800CC710:
|
||||
/* 800CC710 000C9650 2C 1F 00 04 */ cmpwi r31, 4
|
||||
/* 800CC714 000C9654 40 80 00 70 */ bge lbl_800CC784
|
||||
/* 800CC718 000C9658 48 00 00 1C */ b lbl_800CC734
|
||||
lbl_800CC71C:
|
||||
/* 800CC71C 000C965C C8 22 8E 38 */ lfd f1, lbl_80517198@sda21(r2)
|
||||
/* 800CC720 000C9660 48 00 01 44 */ b lbl_800CC864
|
||||
lbl_800CC724:
|
||||
/* 800CC724 000C9664 C8 22 8E 40 */ lfd f1, lbl_805171A0@sda21(r2)
|
||||
/* 800CC728 000C9668 48 00 01 3C */ b lbl_800CC864
|
||||
lbl_800CC72C:
|
||||
/* 800CC72C 000C966C C8 22 8E 48 */ lfd f1, lbl_805171A8@sda21(r2)
|
||||
/* 800CC730 000C9670 48 00 01 34 */ b lbl_800CC864
|
||||
lbl_800CC734:
|
||||
/* 800CC734 000C9674 C8 22 8E 50 */ lfd f1, lbl_805171B0@sda21(r2)
|
||||
/* 800CC738 000C9678 48 00 01 2C */ b lbl_800CC864
|
||||
lbl_800CC73C:
|
||||
/* 800CC73C 000C967C 2C 1F 00 02 */ cmpwi r31, 2
|
||||
/* 800CC740 000C9680 41 82 00 34 */ beq lbl_800CC774
|
||||
/* 800CC744 000C9684 40 80 00 14 */ bge lbl_800CC758
|
||||
/* 800CC748 000C9688 2C 1F 00 00 */ cmpwi r31, 0
|
||||
/* 800CC74C 000C968C 41 82 00 18 */ beq lbl_800CC764
|
||||
/* 800CC750 000C9690 40 80 00 1C */ bge lbl_800CC76C
|
||||
/* 800CC754 000C9694 48 00 00 30 */ b lbl_800CC784
|
||||
lbl_800CC758:
|
||||
/* 800CC758 000C9698 2C 1F 00 04 */ cmpwi r31, 4
|
||||
/* 800CC75C 000C969C 40 80 00 28 */ bge lbl_800CC784
|
||||
/* 800CC760 000C96A0 48 00 00 1C */ b lbl_800CC77C
|
||||
lbl_800CC764:
|
||||
/* 800CC764 000C96A4 C8 22 8E 58 */ lfd f1, lbl_805171B8@sda21(r2)
|
||||
/* 800CC768 000C96A8 48 00 00 FC */ b lbl_800CC864
|
||||
lbl_800CC76C:
|
||||
/* 800CC76C 000C96AC C8 22 8E 60 */ lfd f1, lbl_805171C0@sda21(r2)
|
||||
/* 800CC770 000C96B0 48 00 00 F4 */ b lbl_800CC864
|
||||
lbl_800CC774:
|
||||
/* 800CC774 000C96B4 C8 22 8E 18 */ lfd f1, lbl_80517178@sda21(r2)
|
||||
/* 800CC778 000C96B8 48 00 00 EC */ b lbl_800CC864
|
||||
lbl_800CC77C:
|
||||
/* 800CC77C 000C96BC C8 22 8E 20 */ lfd f1, lbl_80517180@sda21(r2)
|
||||
/* 800CC780 000C96C0 48 00 00 E4 */ b lbl_800CC864
|
||||
lbl_800CC784:
|
||||
/* 800CC784 000C96C4 3C 07 80 10 */ addis r0, r7, 0x8010
|
||||
/* 800CC788 000C96C8 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 800CC78C 000C96CC 40 82 00 1C */ bne lbl_800CC7A8
|
||||
/* 800CC790 000C96D0 2C 05 00 00 */ cmpwi r5, 0
|
||||
/* 800CC794 000C96D4 40 80 00 0C */ bge lbl_800CC7A0
|
||||
/* 800CC798 000C96D8 C8 22 8E 28 */ lfd f1, lbl_80517188@sda21(r2)
|
||||
/* 800CC79C 000C96DC 48 00 00 C8 */ b lbl_800CC864
|
||||
lbl_800CC7A0:
|
||||
/* 800CC7A0 000C96E0 C8 22 8E 30 */ lfd f1, lbl_80517190@sda21(r2)
|
||||
/* 800CC7A4 000C96E4 48 00 00 C0 */ b lbl_800CC864
|
||||
lbl_800CC7A8:
|
||||
/* 800CC7A8 000C96E8 7C 06 38 50 */ subf r0, r6, r7
|
||||
/* 800CC7AC 000C96EC 7C 00 A6 70 */ srawi r0, r0, 0x14
|
||||
/* 800CC7B0 000C96F0 2C 00 00 3C */ cmpwi r0, 0x3c
|
||||
/* 800CC7B4 000C96F4 40 81 00 10 */ ble lbl_800CC7C4
|
||||
/* 800CC7B8 000C96F8 C8 02 8E 30 */ lfd f0, lbl_80517190@sda21(r2)
|
||||
/* 800CC7BC 000C96FC D8 01 00 18 */ stfd f0, 0x18(r1)
|
||||
/* 800CC7C0 000C9700 48 00 00 38 */ b lbl_800CC7F8
|
||||
lbl_800CC7C4:
|
||||
/* 800CC7C4 000C9704 2C 04 00 00 */ cmpwi r4, 0
|
||||
/* 800CC7C8 000C9708 40 80 00 18 */ bge lbl_800CC7E0
|
||||
/* 800CC7CC 000C970C 2C 00 FF C4 */ cmpwi r0, -60
|
||||
/* 800CC7D0 000C9710 40 80 00 10 */ bge lbl_800CC7E0
|
||||
/* 800CC7D4 000C9714 C8 02 8E 58 */ lfd f0, lbl_805171B8@sda21(r2)
|
||||
/* 800CC7D8 000C9718 D8 01 00 18 */ stfd f0, 0x18(r1)
|
||||
/* 800CC7DC 000C971C 48 00 00 1C */ b lbl_800CC7F8
|
||||
lbl_800CC7E0:
|
||||
/* 800CC7E0 000C9720 C8 21 00 08 */ lfd f1, 8(r1)
|
||||
/* 800CC7E4 000C9724 C8 01 00 10 */ lfd f0, 0x10(r1)
|
||||
/* 800CC7E8 000C9728 FC 01 00 24 */ fdiv f0, f1, f0
|
||||
/* 800CC7EC 000C972C FC 20 02 10 */ fabs f1, f0
|
||||
/* 800CC7F0 000C9730 48 00 27 41 */ bl atan
|
||||
/* 800CC7F4 000C9734 D8 21 00 18 */ stfd f1, 0x18(r1)
|
||||
lbl_800CC7F8:
|
||||
/* 800CC7F8 000C9738 2C 1F 00 01 */ cmpwi r31, 1
|
||||
/* 800CC7FC 000C973C 41 82 00 28 */ beq lbl_800CC824
|
||||
/* 800CC800 000C9740 40 80 00 10 */ bge lbl_800CC810
|
||||
/* 800CC804 000C9744 2C 1F 00 00 */ cmpwi r31, 0
|
||||
/* 800CC808 000C9748 40 80 00 14 */ bge lbl_800CC81C
|
||||
/* 800CC80C 000C974C 48 00 00 44 */ b lbl_800CC850
|
||||
lbl_800CC810:
|
||||
/* 800CC810 000C9750 2C 1F 00 03 */ cmpwi r31, 3
|
||||
/* 800CC814 000C9754 40 80 00 3C */ bge lbl_800CC850
|
||||
/* 800CC818 000C9758 48 00 00 20 */ b lbl_800CC838
|
||||
lbl_800CC81C:
|
||||
/* 800CC81C 000C975C C8 21 00 18 */ lfd f1, 0x18(r1)
|
||||
/* 800CC820 000C9760 48 00 00 44 */ b lbl_800CC864
|
||||
lbl_800CC824:
|
||||
/* 800CC824 000C9764 80 01 00 18 */ lwz r0, 0x18(r1)
|
||||
/* 800CC828 000C9768 6C 00 80 00 */ xoris r0, r0, 0x8000
|
||||
/* 800CC82C 000C976C 90 01 00 18 */ stw r0, 0x18(r1)
|
||||
/* 800CC830 000C9770 C8 21 00 18 */ lfd f1, 0x18(r1)
|
||||
/* 800CC834 000C9774 48 00 00 30 */ b lbl_800CC864
|
||||
lbl_800CC838:
|
||||
/* 800CC838 000C9778 C8 21 00 18 */ lfd f1, 0x18(r1)
|
||||
/* 800CC83C 000C977C C8 02 8E 68 */ lfd f0, lbl_805171C8@sda21(r2)
|
||||
/* 800CC840 000C9780 C8 42 8E 18 */ lfd f2, lbl_80517178@sda21(r2)
|
||||
/* 800CC844 000C9784 FC 01 00 28 */ fsub f0, f1, f0
|
||||
/* 800CC848 000C9788 FC 22 00 28 */ fsub f1, f2, f0
|
||||
/* 800CC84C 000C978C 48 00 00 18 */ b lbl_800CC864
|
||||
lbl_800CC850:
|
||||
/* 800CC850 000C9790 C8 41 00 18 */ lfd f2, 0x18(r1)
|
||||
/* 800CC854 000C9794 C8 22 8E 68 */ lfd f1, lbl_805171C8@sda21(r2)
|
||||
/* 800CC858 000C9798 C8 02 8E 18 */ lfd f0, lbl_80517178@sda21(r2)
|
||||
/* 800CC85C 000C979C FC 22 08 28 */ fsub f1, f2, f1
|
||||
/* 800CC860 000C97A0 FC 21 00 28 */ fsub f1, f1, f0
|
||||
lbl_800CC864:
|
||||
/* 800CC864 000C97A4 80 01 00 34 */ lwz r0, 0x34(r1)
|
||||
/* 800CC868 000C97A8 83 E1 00 2C */ lwz r31, 0x2c(r1)
|
||||
/* 800CC86C 000C97AC 7C 08 03 A6 */ mtlr r0
|
||||
/* 800CC870 000C97B0 38 21 00 30 */ addi r1, r1, 0x30
|
||||
/* 800CC874 000C97B4 4E 80 00 20 */ blr
|
@ -304,7 +304,7 @@ DOLPHIN:=\
|
||||
$(BUILD_DIR)/asm/Dolphin/wchar_io.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/uart_console_io_gcn.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/e_asin.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/e_atan2.o\
|
||||
$(BUILD_DIR)/src/Dolphin/e_atan2.o\
|
||||
$(BUILD_DIR)/src/Dolphin/e_exp.o\
|
||||
$(BUILD_DIR)/src/Dolphin/e_fmod.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/e_log.o\
|
||||
|
@ -1,241 +1,123 @@
|
||||
|
||||
|
||||
/* @(#)e_atan2.c 1.3 95/01/18 */
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800CC5E8
|
||||
* Size: 000290
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*
|
||||
*/
|
||||
void __ieee754_atan2(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x30(r1)
|
||||
mflr r0
|
||||
lis r3, 0x7FF0
|
||||
stfd f2, 0x10(r1)
|
||||
lwz r8, 0x14(r1)
|
||||
stw r0, 0x34(r1)
|
||||
neg r0, r8
|
||||
lwz r4, 0x10(r1)
|
||||
or r0, r8, r0
|
||||
stfd f1, 0x8(r1)
|
||||
rlwinm r6,r4,0,1,31
|
||||
rlwinm r0,r0,1,31,31
|
||||
lwz r5, 0x8(r1)
|
||||
or r0, r6, r0
|
||||
stw r31, 0x2C(r1)
|
||||
cmplw r0, r3
|
||||
lwz r9, 0xC(r1)
|
||||
rlwinm r7,r5,0,1,31
|
||||
bgt- .loc_0x64
|
||||
neg r0, r9
|
||||
or r0, r9, r0
|
||||
rlwinm r0,r0,1,31,31
|
||||
or r0, r7, r0
|
||||
cmplw r0, r3
|
||||
ble- .loc_0x74
|
||||
|
||||
.loc_0x64:
|
||||
lfd f1, 0x10(r1)
|
||||
lfd f0, 0x8(r1)
|
||||
fadd f1, f1, f0
|
||||
b .loc_0x27C
|
||||
/* __ieee754_atan2(y,x)
|
||||
* Method :
|
||||
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
|
||||
* 2. Reduce x to positive by (if x and y are unexceptional):
|
||||
* ARG (x+iy) = arctan(y/x) ... if x > 0,
|
||||
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
|
||||
*
|
||||
* Special cases:
|
||||
*
|
||||
* ATAN2((anything), NaN ) is NaN;
|
||||
* ATAN2(NAN , (anything) ) is NaN;
|
||||
* ATAN2(+-0, +(anything but NaN)) is +-0 ;
|
||||
* ATAN2(+-0, -(anything but NaN)) is +-pi ;
|
||||
* ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
|
||||
* ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
|
||||
* ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
|
||||
* ATAN2(+-INF,+INF ) is +-pi/4 ;
|
||||
* ATAN2(+-INF,-INF ) is +-3pi/4;
|
||||
* ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
|
||||
*
|
||||
* Constants:
|
||||
* The hexadecimal values are the intended ones for the following
|
||||
* constants. The decimal values may be used, provided that the
|
||||
* compiler will convert from decimal to binary accurately enough
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
.loc_0x74:
|
||||
subis r0, r4, 0x3FF0
|
||||
or. r0, r0, r8
|
||||
bne- .loc_0x88
|
||||
bl 0x28C8
|
||||
b .loc_0x27C
|
||||
#include "fdlibm.h"
|
||||
|
||||
.loc_0x88:
|
||||
or. r0, r7, r9
|
||||
rlwinm r0,r4,2,30,30
|
||||
mr r31, r0
|
||||
rlwimi r31,r5,1,31,31
|
||||
bne- .loc_0xD4
|
||||
cmpwi r31, 0x2
|
||||
beq- .loc_0xC4
|
||||
bge- .loc_0xB4
|
||||
cmpwi r31, 0
|
||||
bge- .loc_0x27C
|
||||
b .loc_0xD4
|
||||
#ifdef __STDC__
|
||||
static const double
|
||||
#else
|
||||
static double
|
||||
#endif
|
||||
tiny = 1.0e-300,
|
||||
zero = 0.0,
|
||||
pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */
|
||||
pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
|
||||
pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
|
||||
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||
|
||||
.loc_0xB4:
|
||||
cmpwi r31, 0x4
|
||||
bge- .loc_0xD4
|
||||
b .loc_0xCC
|
||||
b .loc_0x27C
|
||||
#ifdef __STDC__
|
||||
double __ieee754_atan2(double y, double x)
|
||||
#else
|
||||
double __ieee754_atan2(y,x)
|
||||
double y,x;
|
||||
#endif
|
||||
{
|
||||
double z;
|
||||
int k,m,hx,hy,ix,iy;
|
||||
unsigned lx,ly;
|
||||
|
||||
.loc_0xC4:
|
||||
lfd f1, -0x71E8(r2)
|
||||
b .loc_0x27C
|
||||
hx = __HI(x); ix = hx&0x7fffffff;
|
||||
lx = __LO(x);
|
||||
hy = __HI(y); iy = hy&0x7fffffff;
|
||||
ly = __LO(y);
|
||||
if(((ix|((lx|-lx)>>31))>0x7ff00000)||
|
||||
((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */
|
||||
return x+y;
|
||||
if((hx-0x3ff00000|lx)==0) return atan(y); /* x=1.0 */
|
||||
m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */
|
||||
|
||||
.loc_0xCC:
|
||||
lfd f1, -0x71E0(r2)
|
||||
b .loc_0x27C
|
||||
/* when y = 0 */
|
||||
if((iy|ly)==0) {
|
||||
switch(m) {
|
||||
case 0:
|
||||
case 1: return y; /* atan(+-0,+anything)=+-0 */
|
||||
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
|
||||
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
|
||||
}
|
||||
}
|
||||
/* when x = 0 */
|
||||
if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
|
||||
|
||||
/* when x is INF */
|
||||
if(ix==0x7ff00000) {
|
||||
if(iy==0x7ff00000) {
|
||||
switch(m) {
|
||||
case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
|
||||
case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
|
||||
case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/
|
||||
case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/
|
||||
}
|
||||
} else {
|
||||
switch(m) {
|
||||
case 0: return zero ; /* atan(+...,+INF) */
|
||||
case 1: return -zero ; /* atan(-...,+INF) */
|
||||
case 2: return pi+tiny ; /* atan(+...,-INF) */
|
||||
case 3: return -pi-tiny ; /* atan(-...,-INF) */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* when y is INF */
|
||||
if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
|
||||
|
||||
.loc_0xD4:
|
||||
or. r0, r6, r8
|
||||
bne- .loc_0xF4
|
||||
cmpwi r5, 0
|
||||
bge- .loc_0xEC
|
||||
lfd f1, -0x71D8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0xEC:
|
||||
lfd f1, -0x71D0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0xF4:
|
||||
subis r0, r6, 0x7FF0
|
||||
cmplwi r0, 0
|
||||
bne- .loc_0x19C
|
||||
subis r0, r7, 0x7FF0
|
||||
cmplwi r0, 0
|
||||
bne- .loc_0x154
|
||||
cmpwi r31, 0x2
|
||||
beq- .loc_0x144
|
||||
bge- .loc_0x128
|
||||
cmpwi r31, 0
|
||||
beq- .loc_0x134
|
||||
bge- .loc_0x13C
|
||||
b .loc_0x19C
|
||||
|
||||
.loc_0x128:
|
||||
cmpwi r31, 0x4
|
||||
bge- .loc_0x19C
|
||||
b .loc_0x14C
|
||||
|
||||
.loc_0x134:
|
||||
lfd f1, -0x71C8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x13C:
|
||||
lfd f1, -0x71C0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x144:
|
||||
lfd f1, -0x71B8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x14C:
|
||||
lfd f1, -0x71B0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x154:
|
||||
cmpwi r31, 0x2
|
||||
beq- .loc_0x18C
|
||||
bge- .loc_0x170
|
||||
cmpwi r31, 0
|
||||
beq- .loc_0x17C
|
||||
bge- .loc_0x184
|
||||
b .loc_0x19C
|
||||
|
||||
.loc_0x170:
|
||||
cmpwi r31, 0x4
|
||||
bge- .loc_0x19C
|
||||
b .loc_0x194
|
||||
|
||||
.loc_0x17C:
|
||||
lfd f1, -0x71A8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x184:
|
||||
lfd f1, -0x71A0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x18C:
|
||||
lfd f1, -0x71E8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x194:
|
||||
lfd f1, -0x71E0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x19C:
|
||||
subis r0, r7, 0x7FF0
|
||||
cmplwi r0, 0
|
||||
bne- .loc_0x1C0
|
||||
cmpwi r5, 0
|
||||
bge- .loc_0x1B8
|
||||
lfd f1, -0x71D8(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x1B8:
|
||||
lfd f1, -0x71D0(r2)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x1C0:
|
||||
sub r0, r7, r6
|
||||
srawi r0, r0, 0x14
|
||||
cmpwi r0, 0x3C
|
||||
ble- .loc_0x1DC
|
||||
lfd f0, -0x71D0(r2)
|
||||
stfd f0, 0x18(r1)
|
||||
b .loc_0x210
|
||||
|
||||
.loc_0x1DC:
|
||||
cmpwi r4, 0
|
||||
bge- .loc_0x1F8
|
||||
cmpwi r0, -0x3C
|
||||
bge- .loc_0x1F8
|
||||
lfd f0, -0x71A8(r2)
|
||||
stfd f0, 0x18(r1)
|
||||
b .loc_0x210
|
||||
|
||||
.loc_0x1F8:
|
||||
lfd f1, 0x8(r1)
|
||||
lfd f0, 0x10(r1)
|
||||
fdiv f0, f1, f0
|
||||
fabs f1, f0
|
||||
bl 0x2740
|
||||
stfd f1, 0x18(r1)
|
||||
|
||||
.loc_0x210:
|
||||
cmpwi r31, 0x1
|
||||
beq- .loc_0x23C
|
||||
bge- .loc_0x228
|
||||
cmpwi r31, 0
|
||||
bge- .loc_0x234
|
||||
b .loc_0x268
|
||||
|
||||
.loc_0x228:
|
||||
cmpwi r31, 0x3
|
||||
bge- .loc_0x268
|
||||
b .loc_0x250
|
||||
|
||||
.loc_0x234:
|
||||
lfd f1, 0x18(r1)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x23C:
|
||||
lwz r0, 0x18(r1)
|
||||
xoris r0, r0, 0x8000
|
||||
stw r0, 0x18(r1)
|
||||
lfd f1, 0x18(r1)
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x250:
|
||||
lfd f1, 0x18(r1)
|
||||
lfd f0, -0x7198(r2)
|
||||
lfd f2, -0x71E8(r2)
|
||||
fsub f0, f1, f0
|
||||
fsub f1, f2, f0
|
||||
b .loc_0x27C
|
||||
|
||||
.loc_0x268:
|
||||
lfd f2, 0x18(r1)
|
||||
lfd f1, -0x7198(r2)
|
||||
lfd f0, -0x71E8(r2)
|
||||
fsub f1, f2, f1
|
||||
fsub f1, f1, f0
|
||||
|
||||
.loc_0x27C:
|
||||
lwz r0, 0x34(r1)
|
||||
lwz r31, 0x2C(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x30
|
||||
blr
|
||||
*/
|
||||
}
|
||||
/* compute y/x */
|
||||
k = (iy-ix)>>20;
|
||||
if(k > 60) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */
|
||||
else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */
|
||||
else z=atan(__fabs(y/x)); /* safe to do y/x */
|
||||
switch (m) {
|
||||
case 0: return z ; /* atan(+,+) */
|
||||
case 1: __HI(z) ^= 0x80000000;
|
||||
return z ; /* atan(-,+) */
|
||||
case 2: return pi-(z-pi_lo);/* atan(+,-) */
|
||||
default: /* case 3 */
|
||||
return (z-pi_lo)-pi;/* atan(-,-) */
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user