MyCurry/docs/old_code/asm/x86_64/fsgn.s

48 lines
1,005 B
ArmAsm

#
# Copyright 2016, 2017 Michele "King_DuckZ" Santullo
# This file is part of MyCurry.
# MyCurry is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# MyCurry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with MyCurry. If not, see <http://www.gnu.org/licenses/>.
#
.data
minus1: .float -1.0
.global fsgn_asm
.text
fsgn_asm:
subq $24,%rsp
movss %xmm0,(%rsp)
fldz
flds (%rsp)
fcomp
fstsw %ax
sahf
fld1
fld minus1
fcmovnbe %st(1),%st
fcmove %st(2),%st
fstps (%rsp)
fninit
movss (%rsp),%xmm0
#xorpd %xmm0,%xmm0
addq $24,%rsp
ret