...
Run Format

Text file src/math/dim_arm64.s

Documentation: math

     1	// Copyright 2016 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	#include "textflag.h"
     6	
     7	#define PosInf 0x7FF0000000000000
     8	#define NaN    0x7FF8000000000001
     9	#define NegInf 0xFFF0000000000000
    10	
    11	// func Dim(x, y float64) float64
    12	TEXT ·Dim(SB),NOSPLIT,$0
    13		// (+Inf, +Inf) special case
    14		MOVD	$PosInf, R0
    15		MOVD	x+0(FP), R1
    16		MOVD	y+8(FP), R2
    17		CMP	R0, R1
    18		BNE	dim2
    19		CMP	R0, R2
    20		BEQ	bothInf
    21	dim2:	// (-Inf, -Inf) special case
    22		MOVD	$NegInf, R0
    23		CMP	R0, R1
    24		BNE	dim3
    25		CMP	R0, R2
    26		BEQ	bothInf
    27	dim3:	// normal case
    28		FMOVD	R1, F0
    29		FMOVD	R2, F1
    30		FMOVD	$0.0, F2
    31		FSUBD	F1, F0
    32		FMAXD	F0, F2, F0
    33		FMOVD	F0, ret+16(FP)
    34		RET
    35	bothInf:
    36		MOVD	$NaN, R0
    37		MOVD	R0, ret+16(FP)
    38		RET
    39	
    40	// func ·Max(x, y float64) float64
    41	TEXT ·Max(SB),NOSPLIT,$0
    42		// +Inf special cases
    43		MOVD	$PosInf, R0
    44		MOVD	x+0(FP), R1
    45		CMP	R0, R1
    46		BEQ	isPosInf
    47		MOVD	y+8(FP), R2
    48		CMP	R0, R2
    49		BEQ	isPosInf
    50		// normal case
    51		FMOVD	R1, F0
    52		FMOVD	R2, F1
    53		FMAXD	F0, F1, F0
    54		FMOVD	F0, ret+16(FP)
    55		RET
    56	isPosInf: // return +Inf
    57		MOVD	R0, ret+16(FP)
    58		RET
    59	
    60	// func Min(x, y float64) float64
    61	TEXT ·Min(SB),NOSPLIT,$0
    62		// -Inf special cases
    63		MOVD	$NegInf, R0
    64		MOVD	x+0(FP), R1
    65		CMP	R0, R1
    66		BEQ	isNegInf
    67		MOVD	y+8(FP), R2
    68		CMP	R0, R2
    69		BEQ	isNegInf
    70		// normal case
    71		FMOVD	R1, F0
    72		FMOVD	R2, F1
    73		FMIND	F0, F1, F0
    74		FMOVD	F0, ret+16(FP)
    75		RET
    76	isNegInf: // return -Inf
    77		MOVD	R0, ret+16(FP)
    78		RET

View as plain text