Blame sysdeps/ia64/fpu/s_nextafter.S

Packit 6c4009
.file "nextafter.s"
Packit 6c4009
Packit 6c4009
Packit 6c4009
// Copyright (c) 2000 - 2004, Intel Corporation
Packit 6c4009
// All rights reserved.
Packit 6c4009
//
Packit 6c4009
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
Packit 6c4009
//
Packit 6c4009
// Redistribution and use in source and binary forms, with or without
Packit 6c4009
// modification, are permitted provided that the following conditions are
Packit 6c4009
// met:
Packit 6c4009
//
Packit 6c4009
// * Redistributions of source code must retain the above copyright
Packit 6c4009
// notice, this list of conditions and the following disclaimer.
Packit 6c4009
//
Packit 6c4009
// * Redistributions in binary form must reproduce the above copyright
Packit 6c4009
// notice, this list of conditions and the following disclaimer in the
Packit 6c4009
// documentation and/or other materials provided with the distribution.
Packit 6c4009
//
Packit 6c4009
// * The name of Intel Corporation may not be used to endorse or promote
Packit 6c4009
// products derived from this software without specific prior written
Packit 6c4009
// permission.
Packit 6c4009
Packit 6c4009
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 6c4009
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 6c4009
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 6c4009
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
Packit 6c4009
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Packit 6c4009
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Packit 6c4009
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Packit 6c4009
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
Packit 6c4009
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
Packit 6c4009
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Packit 6c4009
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 6c4009
//
Packit 6c4009
// Intel Corporation is the author of this code, and requests that all
Packit 6c4009
// problem reports or change requests be submitted to it directly at
Packit 6c4009
// http://www.intel.com/software/products/opensource/libraries/num.htm.
Packit 6c4009
//
Packit 6c4009
// History
Packit 6c4009
//==============================================================
Packit 6c4009
// 02/02/00 Initial version
Packit 6c4009
// 03/03/00 Modified to conform to C9X, and improve speed of main path
Packit 6c4009
// 03/14/00 Fixed case where x is a power of 2, and x > y, improved speed
Packit 6c4009
// 04/04/00 Unwind support added
Packit 6c4009
// 05/12/00 Fixed erroneous denormal flag setting for exponent change cases 1,3
Packit 6c4009
// 08/15/00 Bundle added after call to __libm_error_support to properly
Packit 6c4009
//          set [the previously overwritten] GR_Parameter_RESULT.
Packit 6c4009
// 09/09/00 Updated fcmp so that qnans do not raise invalid
Packit 6c4009
// 12/15/00 Corrected behavior when both args are zero to conform to C99, and
Packit 6c4009
//          fixed flag settings for several cases
Packit 6c4009
// 05/20/02 Cleaned up namespace and sf0 syntax
Packit 6c4009
// 02/10/03 Reordered header: .section, .global, .proc, .align
Packit 6c4009
// 12/14/04 Added error handling on underflow.
Packit 6c4009
//
Packit 6c4009
// API
Packit 6c4009
//==============================================================
Packit 6c4009
// double nextafter( double x, double y );
Packit 6c4009
// input  floating point f8, f9
Packit 6c4009
// output floating point f8
Packit 6c4009
//
Packit 6c4009
// Registers used
Packit 6c4009
//==============================================================
Packit 6c4009
GR_max_pexp     = r14
Packit 6c4009
GR_min_pexp     = r15
Packit 6c4009
GR_exp          = r16
Packit 6c4009
GR_sig          = r17
Packit 6c4009
GR_lnorm_sig    = r18
Packit 6c4009
GR_sign_mask    = r19
Packit 6c4009
GR_exp_mask     = r20
Packit 6c4009
GR_sden_sig     = r21
Packit 6c4009
GR_new_sig      = r22
Packit 6c4009
GR_new_exp      = r23
Packit 6c4009
GR_lden_sig     = r24
Packit 6c4009
GR_snorm_sig    = r25
Packit 6c4009
GR_exp1         = r26
Packit 6c4009
GR_x_exp        = r27
Packit 6c4009
GR_min_den_rexp = r28
Packit 6c4009
// r36-39 parameters for libm_error_support
Packit 6c4009
Packit 6c4009
GR_SAVE_B0                = r34
Packit 6c4009
GR_SAVE_GP                = r35
Packit 6c4009
GR_SAVE_PFS               = r32
Packit 6c4009
Packit 6c4009
GR_Parameter_X            = r36
Packit 6c4009
GR_Parameter_Y            = r37
Packit 6c4009
GR_Parameter_RESULT       = r38
Packit 6c4009
GR_Parameter_TAG          = r39
Packit 6c4009
Packit 6c4009
FR_lnorm_sig       = f10
Packit 6c4009
FR_lnorm_exp       = f11
Packit 6c4009
FR_lnorm           = f12
Packit 6c4009
FR_sden_sig        = f13
Packit 6c4009
FR_sden_exp        = f14
Packit 6c4009
FR_sden            = f15
Packit 6c4009
FR_save_f8         = f33
Packit 6c4009
FR_new_exp         = f34
Packit 6c4009
FR_new_sig         = f35
Packit 6c4009
FR_lden_sig        = f36
Packit 6c4009
FR_snorm_sig       = f37
Packit 6c4009
FR_exp1            = f38
Packit 6c4009
FR_tmp             = f39
Packit 6c4009
Packit 6c4009
//
Packit 6c4009
// Overview of operation
Packit 6c4009
//==============================================================
Packit 6c4009
// nextafter determines the next representable value
Packit 6c4009
// after x in the direction of y.
Packit 6c4009
Packit 6c4009
Packit 6c4009
.section .text
Packit 6c4009
GLOBAL_LIBM_ENTRY(nextafter)
Packit 6c4009
Packit 6c4009
// Extract signexp from x
Packit 6c4009
// Is x < y ?  p10 if yes, p11 if no
Packit 6c4009
// Form smallest denormal significand = ulp size
Packit 6c4009
{ .mfi
Packit 6c4009
      getf.exp GR_exp      = f8
Packit 6c4009
      fcmp.lt.s1 p10,p11 = f8, f9
Packit 6c4009
      addl GR_sden_sig = 0x800, r0
Packit 6c4009
}
Packit 6c4009
// Form largest normal significand 0xfffffffffffff800
Packit 6c4009
// Form smallest normal exponent
Packit 6c4009
{ .mfi
Packit 6c4009
      addl GR_lnorm_sig = -0x800,r0
Packit 6c4009
      nop.f 999
Packit 6c4009
      addl GR_min_pexp = 0x0fc01, r0 ;;
Packit 6c4009
}
Packit 6c4009
// Extract significand from x
Packit 6c4009
// Is x=y?
Packit 6c4009
// Form largest normal exponent
Packit 6c4009
{ .mfi
Packit 6c4009
      getf.sig GR_sig      = f8
Packit 6c4009
      fcmp.eq.s0 p6,p0 = f8, f9
Packit 6c4009
      addl GR_max_pexp = 0x103fe, r0
Packit 6c4009
}
Packit 6c4009
// Move largest normal significand to fp reg for special cases
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.sig FR_lnorm_sig = GR_lnorm_sig
Packit 6c4009
      nop.f 999
Packit 6c4009
      addl GR_sign_mask = 0x20000, r0 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Move smallest denormal significand and signexp to fp regs
Packit 6c4009
// Is x=nan?
Packit 6c4009
// Set p12 and p13 based on whether significand increases or decreases
Packit 6c4009
// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
Packit 6c4009
// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.sig FR_sden_sig = GR_sden_sig
Packit 6c4009
      fclass.m  p8,p0 = f8, 0xc3
Packit 6c4009
(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
Packit 6c4009
}
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.exp FR_sden_exp = GR_min_pexp
Packit 6c4009
(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
.pred.rel "mutex",p12,p13
Packit 6c4009
Packit 6c4009
// Form expected new significand, adding or subtracting 1 ulp increment
Packit 6c4009
// If x=y set result to y
Packit 6c4009
// Form smallest normal significand and largest denormal significand
Packit 6c4009
{ .mfi
Packit 6c4009
(p12) add GR_new_sig = GR_sig, GR_sden_sig
Packit 6c4009
(p6)  fmerge.s f8=f9,f9
Packit 6c4009
      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
Packit 6c4009
}
Packit 6c4009
{ .mlx
Packit 6c4009
(p13) sub GR_new_sig = GR_sig, GR_sden_sig
Packit 6c4009
      movl GR_lden_sig = 0x7ffffffffffff800 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Move expected result significand and signexp to fp regs
Packit 6c4009
// Is y=nan?
Packit 6c4009
// Form new exponent in case result exponent needs incrementing or decrementing
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.exp FR_new_exp = GR_exp
Packit 6c4009
      fclass.m  p9,p0 = f9, 0xc3
Packit 6c4009
(p12) add GR_exp1 = 1, GR_exp
Packit 6c4009
}
Packit 6c4009
{ .mib
Packit 6c4009
      setf.sig FR_new_sig = GR_new_sig
Packit 6c4009
(p13) add GR_exp1 = -1, GR_exp
Packit 6c4009
(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Move largest normal signexp to fp reg for special cases
Packit 6c4009
// Is x=zero?
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.exp FR_lnorm_exp = GR_max_pexp
Packit 6c4009
      fclass.m  p7,p0 = f8, 0x7
Packit 6c4009
      nop.i 999
Packit 6c4009
}
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
(p8)  fma.s0 f8 = f8,f1,f9
Packit 6c4009
(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Move exp+-1 and smallest normal significand to fp regs for special cases
Packit 6c4009
// Is x=inf?
Packit 6c4009
{ .mfi
Packit 6c4009
      setf.exp FR_exp1 = GR_exp1
Packit 6c4009
      fclass.m  p6,p0 = f8, 0x23
Packit 6c4009
      addl GR_exp_mask = 0x1ffff, r0
Packit 6c4009
}
Packit 6c4009
{ .mfb
Packit 6c4009
      setf.sig FR_snorm_sig = GR_snorm_sig
Packit 6c4009
(p9)  fma.s0 f8 = f8,f1,f9
Packit 6c4009
(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Move largest denormal significand to fp regs for special cases
Packit 6c4009
// Save x
Packit 6c4009
{ .mfb
Packit 6c4009
      setf.sig FR_lden_sig = GR_lden_sig
Packit 6c4009
      mov FR_save_f8 = f8
Packit 6c4009
(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Mask off the sign to get x_exp
Packit 6c4009
{ .mfb
Packit 6c4009
      and GR_x_exp = GR_exp_mask, GR_exp
Packit 6c4009
      nop.f 999
Packit 6c4009
(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Check 6 special cases when significand rolls over:
Packit 6c4009
//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
Packit 6c4009
//     Set p6, result is sig=min_sig, exp++
Packit 6c4009
//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
Packit 6c4009
//     Set p7, result is inf, signal overflow
Packit 6c4009
//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
Packit 6c4009
//     Set p8, result is sig=max_sig, exp--
Packit 6c4009
//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
Packit 6c4009
//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
Packit 6c4009
//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
Packit 6c4009
//     Set p10, result is zero, sign of x, signal underflow and inexact
Packit 6c4009
//  6 sig size decr, x_sig=min_sig, x_exp < min_exp
Packit 6c4009
//     Set p14, result is zero, sign of x, signal underflow and inexact
Packit 6c4009
//
Packit 6c4009
// Form exponent of smallest double denormal (if normalized register format)
Packit 6c4009
{ .mmi
Packit 6c4009
      adds GR_min_den_rexp = -52, GR_min_pexp
Packit 6c4009
(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
Packit 6c4009
(p13) cmp.eq.unc p8,p10 = GR_new_sig, GR_lden_sig ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
{ .mmi
Packit 6c4009
(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
Packit 6c4009
(p8)  cmp.gt.unc p8,p9 = GR_x_exp, GR_min_pexp
Packit 6c4009
(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Create small normal in case need to generate underflow flag
Packit 6c4009
{ .mfi
Packit 6c4009
(p10) cmp.le.unc p10,p0 = GR_x_exp, GR_min_pexp
Packit 6c4009
      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
Packit 6c4009
(p9)  cmp.gt.unc p9,p14 = GR_x_exp, GR_min_den_rexp
Packit 6c4009
}
Packit 6c4009
// Branch if cases 1, 2, 3
Packit 6c4009
{ .bbb
Packit 6c4009
(p6)  br.cond.spnt NEXT_EXPUP
Packit 6c4009
(p7)  br.cond.spnt NEXT_OVERFLOW
Packit 6c4009
(p8)  br.cond.spnt NEXT_EXPDOWN ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Branch if cases 4, 5, 6
Packit 6c4009
{ .bbb
Packit 6c4009
(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
Packit 6c4009
(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
Packit 6c4009
(p14) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Here if no special cases
Packit 6c4009
// Set p6 if result will be a denormal, so can force underflow flag
Packit 6c4009
//    Case 1:  x_exp=min_exp, x_sig=unnormalized
Packit 6c4009
//    Case 2:  x_exp
Packit 6c4009
{ .mfi
Packit 6c4009
      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
Packit 6c4009
      fmerge.se f8 = FR_new_exp, FR_new_sig
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      nop.f 999
Packit 6c4009
(p7)  tbit.z p6,p0 = GR_new_sig, 63 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_COMMON_FINISH:
Packit 6c4009
// Force underflow and inexact if denormal result
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
(p6)  fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
Packit 6c4009
      nop.i 999
Packit 6c4009
}
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
      fnorm.d.s0 f8 = f8 // Final normalization to result precision
Packit 6c4009
(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
      nop.f 999
Packit 6c4009
      br.ret.sptk b0;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
//Special cases
Packit 6c4009
NEXT_EXPUP:
Packit 6c4009
{ .mfb
Packit 6c4009
      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
Packit 6c4009
      fmerge.se f8 = FR_exp1, FR_snorm_sig
Packit 6c4009
      br.cond.sptk NEXT_COMMON_FINISH ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_EXPDOWN:
Packit 6c4009
{ .mfb
Packit 6c4009
      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
Packit 6c4009
      fmerge.se f8 = FR_exp1, FR_lnorm_sig
Packit 6c4009
      br.cond.sptk NEXT_COMMON_FINISH ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_NORM_TO_DENORM:
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.se f8 = FR_new_exp, FR_lden_sig
Packit 6c4009
      nop.i 999
Packit 6c4009
}
Packit 6c4009
// Force underflow and inexact if denormal result
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
Packit 6c4009
      br.cond.sptk NEXT_UNDERFLOW ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_UNDERFLOW_TO_ZERO:
Packit 6c4009
{ .mfb
Packit 6c4009
      cmp.eq p6,p0 = r0,r0
Packit 6c4009
      fmerge.s f8 = FR_save_f8,f0
Packit 6c4009
      br.cond.sptk NEXT_COMMON_FINISH ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_INF:
Packit 6c4009
// Here if f8 is +- infinity
Packit 6c4009
// INF
Packit 6c4009
// if f8 is +inf, no matter what y is return  largest double
Packit 6c4009
// if f8 is -inf, no matter what y is return -largest double
Packit 6c4009
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.s f8 = f8,FR_lnorm
Packit 6c4009
      br.ret.sptk    b0 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_ZERO:
Packit 6c4009
Packit 6c4009
// Here if f8 is +- zero
Packit 6c4009
// ZERO
Packit 6c4009
// if f8 is zero and y is +, return + smallest double denormal
Packit 6c4009
// if f8 is zero and y is -, return - smallest double denormal
Packit 6c4009
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.se FR_sden = FR_sden_exp,FR_sden_sig
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Create small normal to generate underflow flag
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Add correct sign from direction arg
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.s f8 = f9,FR_sden
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Force underflow and inexact flags
Packit 6c4009
{ .mfb
Packit 6c4009
      nop.m 999
Packit 6c4009
      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
Packit 6c4009
      br.cond.sptk NEXT_UNDERFLOW ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
NEXT_UNDERFLOW:
Packit 6c4009
// Here if result is a denorm, or input is finite and result is zero
Packit 6c4009
// Call error support to report possible range error
Packit 6c4009
{ .mib
Packit 6c4009
      alloc          r32=ar.pfs,2,2,4,0
Packit 6c4009
      mov           GR_Parameter_TAG = 268      // Error code
Packit 6c4009
      br.cond.sptk  __libm_error_region    // Branch to error call
Packit 6c4009
}
Packit 6c4009
;;
Packit 6c4009
Packit 6c4009
NEXT_OVERFLOW:
Packit 6c4009
// Here if input is finite, but result will be infinite
Packit 6c4009
// Use frcpa to generate infinity of correct sign
Packit 6c4009
// Call error support to report possible range error
Packit 6c4009
{ .mfi
Packit 6c4009
      alloc          r32=ar.pfs,2,2,4,0
Packit 6c4009
      frcpa.s1 f8,p6 = FR_save_f8, f0
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Create largest double
Packit 6c4009
{ .mfi
Packit 6c4009
      nop.m 999
Packit 6c4009
      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
Packit 6c4009
      nop.i 999 ;;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
// Force overflow and inexact flags to be set
Packit 6c4009
{ .mfb
Packit 6c4009
      mov           GR_Parameter_TAG = 154      // Error code
Packit 6c4009
      fma.d.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
Packit 6c4009
      br.cond.sptk  __libm_error_region    // Branch to error call
Packit 6c4009
}
Packit 6c4009
;;
Packit 6c4009
Packit 6c4009
GLOBAL_LIBM_END(nextafter)
Packit 6c4009
libm_alias_double_other (nextafter, nextafter)
Packit 6c4009
Packit 6c4009
Packit 6c4009
LOCAL_LIBM_ENTRY(__libm_error_region)
Packit 6c4009
.prologue
Packit 6c4009
Packit 6c4009
// (1)
Packit 6c4009
{ .mfi
Packit 6c4009
        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
Packit 6c4009
        nop.f 0
Packit 6c4009
.save   ar.pfs,GR_SAVE_PFS
Packit 6c4009
        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
Packit 6c4009
}
Packit 6c4009
{ .mfi
Packit 6c4009
.fframe 64
Packit 6c4009
        add sp=-64,sp                          // Create new stack
Packit 6c4009
        nop.f 0
Packit 6c4009
        mov GR_SAVE_GP=gp                      // Save gp
Packit 6c4009
};;
Packit 6c4009
Packit 6c4009
Packit 6c4009
// (2)
Packit 6c4009
{ .mmi
Packit 6c4009
        stfd [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
Packit 6c4009
        add GR_Parameter_X = 16,sp            // Parameter 1 address
Packit 6c4009
.save   b0, GR_SAVE_B0
Packit 6c4009
        mov GR_SAVE_B0=b0                     // Save b0
Packit 6c4009
};;
Packit 6c4009
Packit 6c4009
.body
Packit 6c4009
// (3)
Packit 6c4009
{ .mib
Packit 6c4009
        stfd [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
Packit 6c4009
        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
Packit 6c4009
        nop.b 0
Packit 6c4009
}
Packit 6c4009
{ .mib
Packit 6c4009
        stfd [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
Packit 6c4009
        add   GR_Parameter_Y = -16,GR_Parameter_Y
Packit 6c4009
        br.call.sptk b0=__libm_error_support#   // Call error handling function
Packit 6c4009
};;
Packit 6c4009
{ .mmi
Packit 6c4009
        nop.m 0
Packit 6c4009
        nop.m 0
Packit 6c4009
        add   GR_Parameter_RESULT = 48,sp
Packit 6c4009
};;
Packit 6c4009
Packit 6c4009
// (4)
Packit 6c4009
{ .mmi
Packit 6c4009
        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
Packit 6c4009
.restore sp
Packit 6c4009
        add   sp = 64,sp                       // Restore stack pointer
Packit 6c4009
        mov   b0 = GR_SAVE_B0                  // Restore return address
Packit 6c4009
};;
Packit 6c4009
{ .mib
Packit 6c4009
        mov   gp = GR_SAVE_GP                  // Restore gp
Packit 6c4009
        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
Packit 6c4009
        br.ret.sptk     b0                     // Return
Packit 6c4009
};;
Packit 6c4009
Packit 6c4009
LOCAL_LIBM_END(__libm_error_region)
Packit 6c4009
Packit 6c4009
Packit 6c4009
.type   __libm_error_support#,@function
Packit 6c4009
.global __libm_error_support#