diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-03-19 05:42:04 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-03-19 05:42:04 -0400 |
commit | 0b70a1e9a9651d21242c5b6da327ecab0f1a38a6 (patch) | |
tree | 5a12d948d65d668ebc1aa01a1646c7acd20b251b /src/math/i386/floor.s | |
parent | 58ff9e8eaf99f2294232be860daa2ca6f3674faf (diff) | |
download | musl-0b70a1e9a9651d21242c5b6da327ecab0f1a38a6.tar.gz musl-0b70a1e9a9651d21242c5b6da327ecab0f1a38a6.tar.xz musl-0b70a1e9a9651d21242c5b6da327ecab0f1a38a6.zip |
asm for floor/ceil/trunc
Diffstat (limited to 'src/math/i386/floor.s')
-rw-r--r-- | src/math/i386/floor.s | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/math/i386/floor.s b/src/math/i386/floor.s new file mode 100644 index 00000000..46ba88db --- /dev/null +++ b/src/math/i386/floor.s @@ -0,0 +1,67 @@ +.global floorf +.type floorf,@function +floorf: + flds 4(%esp) + jmp 1f + +.global floorl +.type floorl,@function +floorl: + fldt 4(%esp) + jmp 1f + +.global floor +.type floor,@function +floor: + fldl 4(%esp) +1: mov $0x7,%al +1: fstcw 4(%esp) + mov 5(%esp),%ah + mov %al,5(%esp) + fldcw 4(%esp) + frndint + mov %ah,5(%esp) + fldcw 4(%esp) + ret + +.global ceil +.type ceil,@function +ceil: + fldl 4(%esp) + mov $0xb,%al + jmp 1b + +.global ceilf +.type ceilf,@function +ceilf: + flds 4(%esp) + mov $0xb,%al + jmp 1b + +.global ceill +.type ceill,@function +ceill: + fldt 4(%esp) + mov $0xb,%al + jmp 1b + +.global trunc +.type trunc,@function +trunc: + fldl 4(%esp) + mov $0xf,%al + jmp 1b + +.global truncf +.type truncf,@function +truncf: + flds 4(%esp) + mov $0xf,%al + jmp 1b + +.global truncl +.type truncl,@function +truncl: + fldt 4(%esp) + mov $0xf,%al + jmp 1b |