diff --git a/src/math/all_test.go b/src/math/all_test.go index 7598d88570d..0412c19e579 100644 --- a/src/math/all_test.go +++ b/src/math/all_test.go @@ -3210,7 +3210,7 @@ func BenchmarkAbs(b *testing.B) { func BenchmarkDim(b *testing.B) { x := 0.0 for i := 0; i < b.N; i++ { - x = Dim(10, 3) + x = Dim(GlobalF, x) } GlobalF = x } diff --git a/src/math/dim.go b/src/math/dim.go index ac0aa869d73..d2e5d47f5c8 100644 --- a/src/math/dim.go +++ b/src/math/dim.go @@ -10,9 +10,7 @@ package math // Dim(+Inf, +Inf) = NaN // Dim(-Inf, -Inf) = NaN // Dim(x, NaN) = Dim(NaN, x) = NaN -func Dim(x, y float64) float64 - -func dim(x, y float64) float64 { +func Dim(x, y float64) float64 { // The special cases result in NaN after the subtraction: // +Inf - +Inf = NaN // -Inf - -Inf = NaN diff --git a/src/math/dim_386.s b/src/math/dim_386.s index 22b8abb017f..2ee13886d70 100644 --- a/src/math/dim_386.s +++ b/src/math/dim_386.s @@ -4,9 +4,6 @@ #include "textflag.h" -TEXT ·Dim(SB),NOSPLIT,$0 - JMP ·dim(SB) - TEXT ·Max(SB),NOSPLIT,$0 JMP ·max(SB) diff --git a/src/math/dim_amd64.s b/src/math/dim_amd64.s index 249f1b15698..85c02e6e52a 100644 --- a/src/math/dim_amd64.s +++ b/src/math/dim_amd64.s @@ -8,44 +8,6 @@ #define NaN 0x7FF8000000000001 #define NegInf 0xFFF0000000000000 -// func Dim(x, y float64) float64 -TEXT ·Dim(SB),NOSPLIT,$0 - // (+Inf, +Inf) special case - MOVQ x+0(FP), BX - MOVQ y+8(FP), CX - MOVQ $PosInf, AX - CMPQ AX, BX - JNE dim2 - CMPQ AX, CX - JEQ bothInf -dim2: // (-Inf, -Inf) special case - MOVQ $NegInf, AX - CMPQ AX, BX - JNE dim3 - CMPQ AX, CX - JEQ bothInf -dim3: // (NaN, x) or (x, NaN) - MOVQ $~(1<<63), DX - MOVQ $PosInf, AX - ANDQ DX, BX // x = |x| - CMPQ AX, BX - JLT isDimNaN - ANDQ DX, CX // y = |y| - CMPQ AX, CX - JLT isDimNaN - - MOVSD x+0(FP), X0 - SUBSD y+8(FP), X0 - MOVSD $(0.0), X1 - MAXSD X1, X0 - MOVSD X0, ret+16(FP) - RET -bothInf: // Dim(-Inf, -Inf) or Dim(+Inf, +Inf) -isDimNaN: - MOVQ $NaN, AX - MOVQ AX, ret+16(FP) - RET - // func ·Max(x, y float64) float64 TEXT ·Max(SB),NOSPLIT,$0 // +Inf special cases diff --git a/src/math/dim_arm.s b/src/math/dim_arm.s index 642e485bf9c..c6f1d87fb5b 100644 --- a/src/math/dim_arm.s +++ b/src/math/dim_arm.s @@ -4,9 +4,6 @@ #include "textflag.h" -TEXT ·Dim(SB),NOSPLIT,$0 - B ·dim(SB) - TEXT ·Min(SB),NOSPLIT,$0 B ·min(SB) diff --git a/src/math/dim_arm64.s b/src/math/dim_arm64.s index 4b6b5929cd6..2cb866ff3e9 100644 --- a/src/math/dim_arm64.s +++ b/src/math/dim_arm64.s @@ -8,35 +8,6 @@ #define NaN 0x7FF8000000000001 #define NegInf 0xFFF0000000000000 -// func Dim(x, y float64) float64 -TEXT ·Dim(SB),NOSPLIT,$0 - // (+Inf, +Inf) special case - MOVD $PosInf, R0 - MOVD x+0(FP), R1 - MOVD y+8(FP), R2 - CMP R0, R1 - BNE dim2 - CMP R0, R2 - BEQ bothInf -dim2: // (-Inf, -Inf) special case - MOVD $NegInf, R0 - CMP R0, R1 - BNE dim3 - CMP R0, R2 - BEQ bothInf -dim3: // normal case - FMOVD R1, F0 - FMOVD R2, F1 - FMOVD $0.0, F2 - FSUBD F1, F0 - FMAXD F0, F2, F0 - FMOVD F0, ret+16(FP) - RET -bothInf: - MOVD $NaN, R0 - MOVD R0, ret+16(FP) - RET - // func ·Max(x, y float64) float64 TEXT ·Max(SB),NOSPLIT,$0 // +Inf special cases diff --git a/src/math/stubs_mips64x.s b/src/math/stubs_mips64x.s index a0e0e388100..b3ffa5b21ea 100644 --- a/src/math/stubs_mips64x.s +++ b/src/math/stubs_mips64x.s @@ -27,9 +27,6 @@ TEXT ·Atan(SB),NOSPLIT,$0 TEXT ·Atanh(SB),NOSPLIT,$0 JMP ·atanh(SB) -TEXT ·Dim(SB),NOSPLIT,$0 - JMP ·dim(SB) - TEXT ·Min(SB),NOSPLIT,$0 JMP ·min(SB) diff --git a/src/math/stubs_mipsx.s b/src/math/stubs_mipsx.s index e959f079bbc..129898eb5fa 100644 --- a/src/math/stubs_mipsx.s +++ b/src/math/stubs_mipsx.s @@ -27,9 +27,6 @@ TEXT ·Atan(SB),NOSPLIT,$0 TEXT ·Atanh(SB),NOSPLIT,$0 JMP ·atanh(SB) -TEXT ·Dim(SB),NOSPLIT,$0 - JMP ·dim(SB) - TEXT ·Min(SB),NOSPLIT,$0 JMP ·min(SB) diff --git a/src/math/stubs_ppc64x.s b/src/math/stubs_ppc64x.s index 30c51ddeaf4..dc5d6150883 100644 --- a/src/math/stubs_ppc64x.s +++ b/src/math/stubs_ppc64x.s @@ -27,9 +27,6 @@ TEXT ·Atan(SB),NOSPLIT,$0 TEXT ·Atanh(SB),NOSPLIT,$0 BR ·atanh(SB) -TEXT ·Dim(SB),NOSPLIT,$0 - BR ·dim(SB) - TEXT ·Min(SB),NOSPLIT,$0 BR ·min(SB) diff --git a/src/math/stubs_s390x.s b/src/math/stubs_s390x.s index 4dceddac632..889e248db9a 100644 --- a/src/math/stubs_s390x.s +++ b/src/math/stubs_s390x.s @@ -4,9 +4,6 @@ #include "textflag.h" -TEXT ·Dim(SB),NOSPLIT,$0 - BR ·dim(SB) - TEXT ·Exp2(SB),NOSPLIT,$0 BR ·exp2(SB)