From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/math/i386/s_trunc.s | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/math/i386/s_trunc.s (limited to 'src/math/i386/s_trunc.s') diff --git a/src/math/i386/s_trunc.s b/src/math/i386/s_trunc.s new file mode 100644 index 00000000..0773891a --- /dev/null +++ b/src/math/i386/s_trunc.s @@ -0,0 +1,36 @@ +.global ceilf +ceilf: flds 4(%esp) + jmp 1f + +.global ceil +ceil: fldl 4(%esp) +1: mov $0x08fb,%edx + jmp 0f + +.global floorf +floorf: flds 4(%esp) + jmp 1f + +.global floor +floor: fldl 4(%esp) +1: mov $0x04f7,%edx + jmp 0f + +.global truncf +truncf: flds 4(%esp) + jmp 1f + +.global trunc +trunc: fldl 4(%esp) +1: mov $0x0cff,%edx + +0: fstcw 4(%esp) + mov 5(%esp),%ah + or %dh,%ah + and %dl,%ah + xchg %ah,5(%esp) + fldcw 4(%esp) + frndint + mov %ah,5(%esp) + fldcw 4(%esp) + ret -- cgit v1.2.1