github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/math/dim_arm64.s (about)

     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 ·archMax(x, y float64) float64
    12  TEXT ·archMax(SB),NOSPLIT,$0
    13  	// +Inf special cases
    14  	MOVD	$PosInf, R0
    15  	MOVD	x+0(FP), R1
    16  	CMP	R0, R1
    17  	BEQ	isPosInf
    18  	MOVD	y+8(FP), R2
    19  	CMP	R0, R2
    20  	BEQ	isPosInf
    21  	// normal case
    22  	FMOVD	R1, F0
    23  	FMOVD	R2, F1
    24  	FMAXD	F0, F1, F0
    25  	FMOVD	F0, ret+16(FP)
    26  	RET
    27  isPosInf: // return +Inf
    28  	MOVD	R0, ret+16(FP)
    29  	RET
    30  
    31  // func archMin(x, y float64) float64
    32  TEXT ·archMin(SB),NOSPLIT,$0
    33  	// -Inf special cases
    34  	MOVD	$NegInf, R0
    35  	MOVD	x+0(FP), R1
    36  	CMP	R0, R1
    37  	BEQ	isNegInf
    38  	MOVD	y+8(FP), R2
    39  	CMP	R0, R2
    40  	BEQ	isNegInf
    41  	// normal case
    42  	FMOVD	R1, F0
    43  	FMOVD	R2, F1
    44  	FMIND	F0, F1, F0
    45  	FMOVD	F0, ret+16(FP)
    46  	RET
    47  isNegInf: // return -Inf
    48  	MOVD	R0, ret+16(FP)
    49  	RET