summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386/cos.S
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/i386/cos.S')
-rw-r--r--mdk-stage1/dietlibc/i386/cos.S35
1 files changed, 35 insertions, 0 deletions
diff --git a/mdk-stage1/dietlibc/i386/cos.S b/mdk-stage1/dietlibc/i386/cos.S
new file mode 100644
index 000000000..f95c81ca7
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/cos.S
@@ -0,0 +1,35 @@
+.text
+
+.global cosf,cos,cosl
+.type cosf,@function
+.type cos,@function
+.type cosl,@function
+
+cosf:
+ flds 4(%esp)
+ jmp 1f
+cos:
+ fldl 4(%esp)
+1:
+ fcos
+ fnstsw %ax
+ testb $0x04, %ah
+ je 3f
+ fldpi
+ fadd %st
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testb $0x04, %ah
+ jne 2b
+ fstp %st(1)
+ fcos
+3: ret
+cosl:
+ fldt 4(%esp)
+ jmp 1b
+
+.Lende:
+.size cos,.Lende-cos
+.size cosl,.Lende-cosl
+.size cosf,.Lende-cosf