1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:07:57 -07:00

all: match asm variable names to Go func declarations

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6548046
This commit is contained in:
Russ Cox 2012-09-21 00:35:56 -04:00
parent 4591cd631d
commit 8572950383
17 changed files with 132 additions and 132 deletions

View File

@ -3,31 +3,31 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·IndexByte(SB),7,$0 TEXT ·IndexByte(SB),7,$0
MOVL p+0(FP), SI MOVL s+0(FP), SI
MOVL len+4(FP), CX MOVL s+4(FP), CX
MOVB b+12(FP), AL MOVB c+12(FP), AL
MOVL SI, DI MOVL SI, DI
CLD; REPN; SCASB CLD; REPN; SCASB
JZ 3(PC) JZ 3(PC)
MOVL $-1, ret+16(FP) MOVL $-1, r+16(FP)
RET RET
SUBL SI, DI SUBL SI, DI
SUBL $1, DI SUBL $1, DI
MOVL DI, ret+16(FP) MOVL DI, r+16(FP)
RET RET
TEXT ·Equal(SB),7,$0 TEXT ·Equal(SB),7,$0
MOVL len+4(FP), BX MOVL a+4(FP), BX
MOVL len1+16(FP), CX MOVL b+16(FP), CX
MOVL $0, AX MOVL $0, AX
CMPL BX, CX CMPL BX, CX
JNE eqret JNE eqret
MOVL p+0(FP), SI MOVL a+0(FP), SI
MOVL q+12(FP), DI MOVL b+12(FP), DI
CLD CLD
REP; CMPSB REP; CMPSB
JNE eqret JNE eqret
MOVL $1, AX MOVL $1, AX
eqret: eqret:
MOVB AX, ret+24(FP) MOVB AX, r+24(FP)
RET RET

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·IndexByte(SB),7,$0 TEXT ·IndexByte(SB),7,$0
MOVQ p+0(FP), SI MOVQ s+0(FP), SI
MOVL len+8(FP), BX MOVL s+8(FP), BX
MOVB b+16(FP), AL MOVB c+16(FP), AL
MOVQ SI, DI MOVQ SI, DI
CMPL BX, $16 CMPL BX, $16
@ -63,7 +63,7 @@ condition:
JZ success JZ success
failure: failure:
MOVL $-1, ret+24(FP) MOVL $-1, r+24(FP)
RET RET
// handle for lengths < 16 // handle for lengths < 16
@ -71,7 +71,7 @@ small:
MOVL BX, CX MOVL BX, CX
REPN; SCASB REPN; SCASB
JZ success JZ success
MOVL $-1, ret+24(FP) MOVL $-1, r+24(FP)
RET RET
// we've found the chunk containing the byte // we've found the chunk containing the byte
@ -81,28 +81,28 @@ ssesuccess:
BSFW DX, DX BSFW DX, DX
SUBQ SI, DI SUBQ SI, DI
ADDQ DI, DX ADDQ DI, DX
MOVL DX, ret+24(FP) MOVL DX, r+24(FP)
RET RET
success: success:
SUBQ SI, DI SUBQ SI, DI
SUBL $1, DI SUBL $1, DI
MOVL DI, ret+24(FP) MOVL DI, r+24(FP)
RET RET
TEXT ·Equal(SB),7,$0 TEXT ·Equal(SB),7,$0
MOVL len+8(FP), BX MOVL a+8(FP), BX
MOVL len1+24(FP), CX MOVL b+24(FP), CX
MOVL $0, AX MOVL $0, AX
CMPL BX, CX CMPL BX, CX
JNE eqret JNE eqret
MOVQ p+0(FP), SI MOVQ a+0(FP), SI
MOVQ q+16(FP), DI MOVQ b+16(FP), DI
CLD CLD
REP; CMPSB REP; CMPSB
MOVL $1, DX MOVL $1, DX
CMOVLEQ DX, AX CMOVLEQ DX, AX
eqret: eqret:
MOVB AX, ret+32(FP) MOVB AX, r+32(FP)
RET RET

View File

@ -3,8 +3,8 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·IndexByte(SB),7,$0 TEXT ·IndexByte(SB),7,$0
MOVW base+0(FP), R0 MOVW s+0(FP), R0
MOVW len+4(FP), R1 MOVW s+4(FP), R1
MOVBU c+12(FP), R2 // byte to find MOVBU c+12(FP), R2 // byte to find
MOVW R0, R4 // store base for later MOVW R0, R4 // store base for later
ADD R0, R1 // end ADD R0, R1 // end
@ -18,23 +18,23 @@ _loop:
SUB $1, R0 // R0 will be one beyond the position we want SUB $1, R0 // R0 will be one beyond the position we want
SUB R4, R0 // remove base SUB R4, R0 // remove base
MOVW R0, index+16(FP) MOVW R0, r+16(FP)
RET RET
_notfound: _notfound:
MOVW $-1, R0 MOVW $-1, R0
MOVW R0, index+16(FP) MOVW R0, r+16(FP)
RET RET
TEXT ·Equal(SB),7,$0 TEXT ·Equal(SB),7,$0
MOVW alen+4(FP), R1 MOVW a+4(FP), R1
MOVW blen+16(FP), R3 MOVW b+16(FP), R3
CMP R1, R3 // unequal lengths are not equal CMP R1, R3 // unequal lengths are not equal
B.NE _notequal B.NE _notequal
MOVW aptr+0(FP), R0 MOVW a+0(FP), R0
MOVW bptr+12(FP), R2 MOVW b+12(FP), R2
ADD R0, R1 // end ADD R0, R1 // end
_next: _next:
@ -47,10 +47,10 @@ _next:
_notequal: _notequal:
MOVW $0, R0 MOVW $0, R0
MOVW R0, equal+24(FP) MOVBU R0, r+24(FP)
RET RET
_equal: _equal:
MOVW $1, R0 MOVW $1, R0
MOVW R0, equal+24(FP) MOVBU R0, r+24(FP)
RET RET

View File

@ -13,7 +13,7 @@ func haveSSE42() bool
// castagnoliSSE42 is defined in crc_amd64.s and uses the SSE4.2 CRC32 // castagnoliSSE42 is defined in crc_amd64.s and uses the SSE4.2 CRC32
// instruction. // instruction.
func castagnoliSSE42(uint32, []byte) uint32 func castagnoliSSE42(crc uint32, p []byte) uint32
var sse42 = haveSSE42() var sse42 = haveSSE42()

View File

@ -47,7 +47,7 @@ cleanup:
done: done:
NOTL AX NOTL AX
MOVL AX, ret+24(FP) MOVL AX, r+24(FP)
RET RET
// func haveSSE42() bool // func haveSSE42() bool
@ -57,6 +57,6 @@ TEXT ·haveSSE42(SB),7,$0
CPUID CPUID
SHRQ $20, CX SHRQ $20, CX
ANDQ $1, CX ANDQ $1, CX
MOVB CX, ret+0(FP) MOVB CX, r+0(FP)
RET RET

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Abs(SB),7,$0 TEXT ·Abs(SB),7,$0
MOVW lo+0(FP), R0 MOVW x+0(FP), R0
MOVW hi+4(FP), R1 MOVW x+4(FP), R1
AND $((1<<31)-1), R1 AND $((1<<31)-1), R1
MOVW R0, resultlo+8(FP) MOVW R0, r+8(FP)
MOVW R1, resulthi+12(FP) MOVW R1, r+12(FP)
RET RET

View File

@ -29,7 +29,7 @@ TEXT ·addVV(SB),7,$0
MOVL z+0(FP), DI MOVL z+0(FP), DI
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), CX MOVL y+24(FP), CX
MOVL n+4(FP), BP MOVL z+4(FP), BP
MOVL $0, BX // i = 0 MOVL $0, BX // i = 0
MOVL $0, DX // c = 0 MOVL $0, DX // c = 0
JMP E1 JMP E1
@ -54,7 +54,7 @@ TEXT ·subVV(SB),7,$0
MOVL z+0(FP), DI MOVL z+0(FP), DI
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), CX MOVL y+24(FP), CX
MOVL n+4(FP), BP MOVL z+4(FP), BP
MOVL $0, BX // i = 0 MOVL $0, BX // i = 0
MOVL $0, DX // c = 0 MOVL $0, DX // c = 0
JMP E2 JMP E2
@ -78,7 +78,7 @@ TEXT ·addVW(SB),7,$0
MOVL z+0(FP), DI MOVL z+0(FP), DI
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), AX // c = y MOVL y+24(FP), AX // c = y
MOVL n+4(FP), BP MOVL z+4(FP), BP
MOVL $0, BX // i = 0 MOVL $0, BX // i = 0
JMP E3 JMP E3
@ -100,7 +100,7 @@ TEXT ·subVW(SB),7,$0
MOVL z+0(FP), DI MOVL z+0(FP), DI
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), AX // c = y MOVL y+24(FP), AX // c = y
MOVL n+4(FP), BP MOVL z+4(FP), BP
MOVL $0, BX // i = 0 MOVL $0, BX // i = 0
JMP E4 JMP E4
@ -120,7 +120,7 @@ E4: CMPL BX, BP // i < n
// func shlVU(z, x []Word, s uint) (c Word) // func shlVU(z, x []Word, s uint) (c Word)
TEXT ·shlVU(SB),7,$0 TEXT ·shlVU(SB),7,$0
MOVL n+4(FP), BX // i = n MOVL z+4(FP), BX // i = z
SUBL $1, BX // i-- SUBL $1, BX // i--
JL X8b // i < 0 (n <= 0) JL X8b // i < 0 (n <= 0)
@ -155,7 +155,7 @@ X8b: MOVL $0, c+28(FP)
// func shrVU(z, x []Word, s uint) (c Word) // func shrVU(z, x []Word, s uint) (c Word)
TEXT ·shrVU(SB),7,$0 TEXT ·shrVU(SB),7,$0
MOVL n+4(FP), BP MOVL z+4(FP), BP
SUBL $1, BP // n-- SUBL $1, BP // n--
JL X9b // n < 0 (n <= 0) JL X9b // n < 0 (n <= 0)
@ -196,7 +196,7 @@ TEXT ·mulAddVWW(SB),7,$0
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), BP MOVL y+24(FP), BP
MOVL r+28(FP), CX // c = r MOVL r+28(FP), CX // c = r
MOVL n+4(FP), BX MOVL z+4(FP), BX
LEAL (DI)(BX*4), DI LEAL (DI)(BX*4), DI
LEAL (SI)(BX*4), SI LEAL (SI)(BX*4), SI
NEGL BX // i = -n NEGL BX // i = -n
@ -222,7 +222,7 @@ TEXT ·addMulVVW(SB),7,$0
MOVL z+0(FP), DI MOVL z+0(FP), DI
MOVL x+12(FP), SI MOVL x+12(FP), SI
MOVL y+24(FP), BP MOVL y+24(FP), BP
MOVL n+4(FP), BX MOVL z+4(FP), BX
LEAL (DI)(BX*4), DI LEAL (DI)(BX*4), DI
LEAL (SI)(BX*4), SI LEAL (SI)(BX*4), SI
NEGL BX // i = -n NEGL BX // i = -n
@ -251,7 +251,7 @@ TEXT ·divWVW(SB),7,$0
MOVL xn+12(FP), DX // r = xn MOVL xn+12(FP), DX // r = xn
MOVL x+16(FP), SI MOVL x+16(FP), SI
MOVL y+28(FP), CX MOVL y+28(FP), CX
MOVL n+4(FP), BX // i = n MOVL z+4(FP), BX // i = z
JMP E7 JMP E7
L7: MOVL (SI)(BX*4), AX L7: MOVL (SI)(BX*4), AX

View File

@ -36,7 +36,7 @@ TEXT ·divWW(SB),7,$0
// func addVV(z, x, y []Word) (c Word) // func addVV(z, x, y []Word) (c Word)
TEXT ·addVV(SB),7,$0 TEXT ·addVV(SB),7,$0
MOVL n+8(FP), DI MOVL z+8(FP), DI
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), R9 MOVQ y+32(FP), R9
MOVQ z+0(FP), R10 MOVQ z+0(FP), R10
@ -90,7 +90,7 @@ E1: MOVQ CX, c+48(FP) // return c
// func subVV(z, x, y []Word) (c Word) // func subVV(z, x, y []Word) (c Word)
// (same as addVV except for SBBQ instead of ADCQ and label names) // (same as addVV except for SBBQ instead of ADCQ and label names)
TEXT ·subVV(SB),7,$0 TEXT ·subVV(SB),7,$0
MOVL n+8(FP), DI MOVL z+8(FP), DI
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), R9 MOVQ y+32(FP), R9
MOVQ z+0(FP), R10 MOVQ z+0(FP), R10
@ -143,7 +143,7 @@ E2: MOVQ CX, c+48(FP) // return c
// func addVW(z, x []Word, y Word) (c Word) // func addVW(z, x []Word, y Word) (c Word)
TEXT ·addVW(SB),7,$0 TEXT ·addVW(SB),7,$0
MOVL n+8(FP), DI MOVL z+8(FP), DI
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), CX // c = y MOVQ y+32(FP), CX // c = y
MOVQ z+0(FP), R10 MOVQ z+0(FP), R10
@ -195,7 +195,7 @@ E3: MOVQ CX, c+40(FP) // return c
// func subVW(z, x []Word, y Word) (c Word) // func subVW(z, x []Word, y Word) (c Word)
// (same as addVW except for SUBQ/SBBQ instead of ADDQ/ADCQ and label names) // (same as addVW except for SUBQ/SBBQ instead of ADDQ/ADCQ and label names)
TEXT ·subVW(SB),7,$0 TEXT ·subVW(SB),7,$0
MOVL n+8(FP), DI MOVL z+8(FP), DI
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), CX // c = y MOVQ y+32(FP), CX // c = y
MOVQ z+0(FP), R10 MOVQ z+0(FP), R10
@ -247,7 +247,7 @@ E4: MOVQ CX, c+40(FP) // return c
// func shlVU(z, x []Word, s uint) (c Word) // func shlVU(z, x []Word, s uint) (c Word)
TEXT ·shlVU(SB),7,$0 TEXT ·shlVU(SB),7,$0
MOVL n+8(FP), BX // i = n MOVL z+8(FP), BX // i = z
SUBL $1, BX // i-- SUBL $1, BX // i--
JL X8b // i < 0 (n <= 0) JL X8b // i < 0 (n <= 0)
@ -282,7 +282,7 @@ X8b: MOVQ $0, c+40(FP)
// func shrVU(z, x []Word, s uint) (c Word) // func shrVU(z, x []Word, s uint) (c Word)
TEXT ·shrVU(SB),7,$0 TEXT ·shrVU(SB),7,$0
MOVL n+8(FP), R11 MOVL z+8(FP), R11
SUBL $1, R11 // n-- SUBL $1, R11 // n--
JL X9b // n < 0 (n <= 0) JL X9b // n < 0 (n <= 0)
@ -323,7 +323,7 @@ TEXT ·mulAddVWW(SB),7,$0
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), R9 MOVQ y+32(FP), R9
MOVQ r+40(FP), CX // c = r MOVQ r+40(FP), CX // c = r
MOVL n+8(FP), R11 MOVL z+8(FP), R11
MOVQ $0, BX // i = 0 MOVQ $0, BX // i = 0
JMP E5 JMP E5
@ -347,7 +347,7 @@ TEXT ·addMulVVW(SB),7,$0
MOVQ z+0(FP), R10 MOVQ z+0(FP), R10
MOVQ x+16(FP), R8 MOVQ x+16(FP), R8
MOVQ y+32(FP), R9 MOVQ y+32(FP), R9
MOVL n+8(FP), R11 MOVL z+8(FP), R11
MOVQ $0, BX // i = 0 MOVQ $0, BX // i = 0
MOVQ $0, CX // c = 0 MOVQ $0, CX // c = 0
JMP E6 JMP E6
@ -374,7 +374,7 @@ TEXT ·divWVW(SB),7,$0
MOVQ xn+16(FP), DX // r = xn MOVQ xn+16(FP), DX // r = xn
MOVQ x+24(FP), R8 MOVQ x+24(FP), R8
MOVQ y+40(FP), R9 MOVQ y+40(FP), R9
MOVL n+8(FP), BX // i = n MOVL z+8(FP), BX // i = z
JMP E7 JMP E7
L7: MOVQ (R8)(BX*8), AX L7: MOVQ (R8)(BX*8), AX

View File

@ -13,7 +13,7 @@ TEXT ·addVV(SB),7,$0
MOVW z+0(FP), R1 MOVW z+0(FP), R1
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW n+4(FP), R4 MOVW z+4(FP), R4
MOVW R4<<2, R4 MOVW R4<<2, R4
ADD R1, R4 ADD R1, R4
B E1 B E1
@ -41,7 +41,7 @@ TEXT ·subVV(SB),7,$0
MOVW z+0(FP), R1 MOVW z+0(FP), R1
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW n+4(FP), R4 MOVW z+4(FP), R4
MOVW R4<<2, R4 MOVW R4<<2, R4
ADD R1, R4 ADD R1, R4
B E2 B E2
@ -68,7 +68,7 @@ TEXT ·addVW(SB),7,$0
MOVW z+0(FP), R1 MOVW z+0(FP), R1
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW n+4(FP), R4 MOVW z+4(FP), R4
MOVW R4<<2, R4 MOVW R4<<2, R4
ADD R1, R4 ADD R1, R4
CMP R1, R4 CMP R1, R4
@ -102,7 +102,7 @@ TEXT ·subVW(SB),7,$0
MOVW z+0(FP), R1 MOVW z+0(FP), R1
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW n+4(FP), R4 MOVW z+4(FP), R4
MOVW R4<<2, R4 MOVW R4<<2, R4
ADD R1, R4 ADD R1, R4
CMP R1, R4 CMP R1, R4
@ -134,7 +134,7 @@ E4:
// func shlVU(z, x []Word, s uint) (c Word) // func shlVU(z, x []Word, s uint) (c Word)
TEXT ·shlVU(SB),7,$0 TEXT ·shlVU(SB),7,$0
MOVW n+4(FP), R5 MOVW z+4(FP), R5
CMP $0, R5 CMP $0, R5
BEQ X7 BEQ X7
@ -183,7 +183,7 @@ X7:
// func shrVU(z, x []Word, s uint) (c Word) // func shrVU(z, x []Word, s uint) (c Word)
TEXT ·shrVU(SB),7,$0 TEXT ·shrVU(SB),7,$0
MOVW n+4(FP), R5 MOVW z+4(FP), R5
CMP $0, R5 CMP $0, R5
BEQ X6 BEQ X6
@ -238,7 +238,7 @@ TEXT ·mulAddVWW(SB),7,$0
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW r+28(FP), R4 MOVW r+28(FP), R4
MOVW n+4(FP), R5 MOVW z+4(FP), R5
MOVW R5<<2, R5 MOVW R5<<2, R5
ADD R1, R5 ADD R1, R5
B E8 B E8
@ -265,7 +265,7 @@ TEXT ·addMulVVW(SB),7,$0
MOVW z+0(FP), R1 MOVW z+0(FP), R1
MOVW x+12(FP), R2 MOVW x+12(FP), R2
MOVW y+24(FP), R3 MOVW y+24(FP), R3
MOVW n+4(FP), R5 MOVW z+4(FP), R5
MOVW R5<<2, R5 MOVW R5<<2, R5
ADD R1, R5 ADD R1, R5
MOVW $0, R4 MOVW $0, R4

View File

@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// func Frexp(x float64) (f float64, e int) // func Frexp(f float64) (frac float64, exp int)
TEXT ·Frexp(SB),7,$0 TEXT ·Frexp(SB),7,$0
FMOVD x+0(FP), F0 // F0=x FMOVD f+0(FP), F0 // F0=f
FXAM FXAM
FSTSW AX FSTSW AX
SAHF SAHF
@ -12,12 +12,12 @@ TEXT ·Frexp(SB),7,$0
JCS nan_zero_inf JCS nan_zero_inf
FXTRACT // F0=f (0<=f<1), F1=e FXTRACT // F0=f (0<=f<1), F1=e
FMULD $(0.5), F0 // F0=f (0.5<=f<1), F1=e FMULD $(0.5), F0 // F0=f (0.5<=f<1), F1=e
FMOVDP F0, f+8(FP) // F0=e FMOVDP F0, frac+8(FP) // F0=e
FLD1 // F0=1, F1=e FLD1 // F0=1, F1=e
FADDDP F0, F1 // F0=e+1 FADDDP F0, F1 // F0=e+1
FMOVLP F0, e+16(FP) // (int=int32) FMOVLP F0, exp+16(FP) // (int=int32)
RET RET
nan_zero_inf: nan_zero_inf:
FMOVDP F0, f+8(FP) // F0=e FMOVDP F0, frac+8(FP) // F0=e
MOVL $0, e+16(FP) // e=0 MOVL $0, exp+16(FP) // exp=0
RET RET

View File

@ -2,35 +2,35 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// func Hypot(x, y float64) float64 // func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0 TEXT ·Hypot(SB),7,$0
// test bits for not-finite // test bits for not-finite
MOVL xh+4(FP), AX // high word x MOVL p+4(FP), AX // high word p
ANDL $0x7ff00000, AX ANDL $0x7ff00000, AX
CMPL AX, $0x7ff00000 CMPL AX, $0x7ff00000
JEQ not_finite JEQ not_finite
MOVL yh+12(FP), AX // high word y MOVL q+12(FP), AX // high word q
ANDL $0x7ff00000, AX ANDL $0x7ff00000, AX
CMPL AX, $0x7ff00000 CMPL AX, $0x7ff00000
JEQ not_finite JEQ not_finite
FMOVD x+0(FP), F0 // F0=x FMOVD p+0(FP), F0 // F0=p
FABS // F0=|x| FABS // F0=|p|
FMOVD y+8(FP), F0 // F0=y, F1=|x| FMOVD q+8(FP), F0 // F0=q, F1=|p|
FABS // F0=|y|, F1=|x| FABS // F0=|q|, F1=|p|
FUCOMI F0, F1 // compare F0 to F1 FUCOMI F0, F1 // compare F0 to F1
JCC 2(PC) // jump if F0 >= F1 JCC 2(PC) // jump if F0 >= F1
FXCHD F0, F1 // F0=|x| (larger), F1=|y| (smaller) FXCHD F0, F1 // F0=|p| (larger), F1=|q| (smaller)
FTST // compare F0 to 0 FTST // compare F0 to 0
FSTSW AX FSTSW AX
ANDW $0x4000, AX ANDW $0x4000, AX
JNE 10(PC) // jump if F0 = 0 JNE 10(PC) // jump if F0 = 0
FXCHD F0, F1 // F0=y (smaller), F1=x (larger) FXCHD F0, F1 // F0=q (smaller), F1=p (larger)
FDIVD F1, F0 // F0=y(=y/x), F1=x FDIVD F1, F0 // F0=q(=q/p), F1=p
FMULD F0, F0 // F0=y*y, F1=x FMULD F0, F0 // F0=q*q, F1=p
FLD1 // F0=1, F1=y*y, F2=x FLD1 // F0=1, F1=q*q, F2=p
FADDDP F0, F1 // F0=1+y*y, F1=x FADDDP F0, F1 // F0=1+q*q, F1=p
FSQRT // F0=sqrt(1+y*y), F1=x FSQRT // F0=sqrt(1+q*q), F1=p
FMULDP F0, F1 // F0=x*sqrt(1+y*y) FMULDP F0, F1 // F0=p*sqrt(1+q*q)
FMOVDP F0, r+16(FP) FMOVDP F0, r+16(FP)
RET RET
FMOVDP F0, F1 // F0=0 FMOVDP F0, F1 // F0=0
@ -38,20 +38,20 @@ TEXT ·Hypot(SB),7,$0
RET RET
not_finite: not_finite:
// test bits for -Inf or +Inf // test bits for -Inf or +Inf
MOVL xh+4(FP), AX // high word x MOVL p+4(FP), AX // high word p
ORL xl+0(FP), AX // low word x ORL p+0(FP), AX // low word p
ANDL $0x7fffffff, AX ANDL $0x7fffffff, AX
CMPL AX, $0x7ff00000 CMPL AX, $0x7ff00000
JEQ is_inf JEQ is_inf
MOVL yh+12(FP), AX // high word y MOVL q+12(FP), AX // high word q
ORL yl+8(FP), AX // low word y ORL q+8(FP), AX // low word q
ANDL $0x7fffffff, AX ANDL $0x7fffffff, AX
CMPL AX, $0x7ff00000 CMPL AX, $0x7ff00000
JEQ is_inf JEQ is_inf
MOVL $0x7ff80000, rh+20(FP) // return NaN = 0x7FF8000000000001 MOVL $0x7ff80000, r+20(FP) // return NaN = 0x7FF8000000000001
MOVL $0x00000001, rl+16(FP) MOVL $0x00000001, r+16(FP)
RET RET
is_inf: is_inf:
MOVL AX, rh+20(FP) // return +Inf = 0x7FF0000000000000 MOVL AX, r+20(FP) // return +Inf = 0x7FF0000000000000
MOVL $0x00000000, rl+16(FP) MOVL $0x00000000, r+16(FP)
RET RET

View File

@ -5,14 +5,14 @@
#define PosInf 0x7FF0000000000000 #define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001 #define NaN 0x7FF8000000000001
// func Hypot(x, y float64) float64 // func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0 TEXT ·Hypot(SB),7,$0
// test bits for special cases // test bits for special cases
MOVQ x+0(FP), BX MOVQ p+0(FP), BX
MOVQ $~(1<<63), AX MOVQ $~(1<<63), AX
ANDQ AX, BX // x = |x| ANDQ AX, BX // p = |p|
MOVQ y+8(FP), CX MOVQ q+8(FP), CX
ANDQ AX, CX // y = |y| ANDQ AX, CX // q = |q|
MOVQ $PosInf, AX MOVQ $PosInf, AX
CMPQ AX, BX CMPQ AX, BX
JLE isInfOrNaN JLE isInfOrNaN

View File

@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// func Ldexp(f float64, e int) float64 // func Ldexp(frac float64, exp int) float64
TEXT ·Ldexp(SB),7,$0 TEXT ·Ldexp(SB),7,$0
FMOVL e+8(FP), F0 // F0=e FMOVL exp+8(FP), F0 // F0=exp
FMOVD x+0(FP), F0 // F0=x, F1=e FMOVD frac+0(FP), F0 // F0=frac, F1=e
FSCALE // F0=x*2**e, F1=e FSCALE // F0=x*2**e, F1=e
FMOVDP F0, F1 // F0=x*2**e FMOVDP F0, F1 // F0=x*2**e
FMOVDP F0, r+12(FP) FMOVDP F0, r+12(FP)

View File

@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// func Modf(x float64) (int float64, frac float64) // func Modf(f float64) (int float64, frac float64)
TEXT ·Modf(SB),7,$0 TEXT ·Modf(SB),7,$0
FMOVD x+0(FP), F0 // F0=x FMOVD f+0(FP), F0 // F0=f
FMOVD F0, F1 // F0=x, F1=x FMOVD F0, F1 // F0=f, F1=f
FSTCW -2(SP) // save old Control Word FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX MOVW -2(SP), AX
ORW $0x0c00, AX // Rounding Control set to truncate ORW $0x0c00, AX // Rounding Control set to truncate
MOVW AX, -4(SP) // store new Control Word MOVW AX, -4(SP) // store new Control Word
FLDCW -4(SP) // load new Control Word FLDCW -4(SP) // load new Control Word
FRNDINT // F0=trunc(x), F1=x FRNDINT // F0=trunc(f), F1=f
FLDCW -2(SP) // load old Control Word FLDCW -2(SP) // load old Control Word
FSUBD F0, F1 // F0=trunc(x), F1=x-trunc(x) FSUBD F0, F1 // F0=trunc(f), F1=f-trunc(f)
FMOVDP F0, i+8(FP) // F0=x-trunc(x) FMOVDP F0, int+8(FP) // F0=f-trunc(f)
FMOVDP F0, f+16(FP) FMOVDP F0, frac+16(FP)
RET RET

View File

@ -9,8 +9,8 @@ TEXT ·Sincos(SB),7,$0
FSTSW AX // AX=status word FSTSW AX // AX=status word
ANDW $0x0400, AX ANDW $0x0400, AX
JNE 4(PC) // jump if x outside range JNE 4(PC) // jump if x outside range
FMOVDP F0, c+16(FP) // F0=sin(x) FMOVDP F0, cos+16(FP) // F0=sin(x)
FMOVDP F0, s+8(FP) FMOVDP F0, sin+8(FP)
RET RET
FLDPI // F0=Pi, F1=x FLDPI // F0=Pi, F1=x
FADDD F0, F0 // F0=2*Pi, F1=x FADDD F0, F0 // F0=2*Pi, F1=x
@ -21,6 +21,6 @@ TEXT ·Sincos(SB),7,$0
JNE -3(PC) // jump if reduction incomplete JNE -3(PC) // jump if reduction incomplete
FMOVDP F0, F1 // F0=reduced_x FMOVDP F0, F1 // F0=reduced_x
FSINCOS // F0=cos(reduced_x), F1=sin(reduced_x) FSINCOS // F0=cos(reduced_x), F1=sin(reduced_x)
FMOVDP F0, c+16(FP) // F0=sin(reduced_x) FMOVDP F0, cos+16(FP) // F0=sin(reduced_x)
FMOVDP F0, s+8(FP) FMOVDP F0, sin+8(FP)
RET RET

View File

@ -12,7 +12,7 @@ TEXT ·CompareAndSwapUint32(SB),7,$0
// CMPXCHGL was introduced on the 486. // CMPXCHGL was introduced on the 486.
LOCK LOCK
CMPXCHGL CX, 0(BP) CMPXCHGL CX, 0(BP)
SETEQ ret+12(FP) SETEQ swapped+12(FP)
RET RET
TEXT ·CompareAndSwapUintptr(SB),7,$0 TEXT ·CompareAndSwapUintptr(SB),7,$0
@ -26,14 +26,14 @@ TEXT ·CompareAndSwapInt64(SB),7,$0
TEXT ·CompareAndSwapUint64(SB),7,$0 TEXT ·CompareAndSwapUint64(SB),7,$0
MOVL addr+0(FP), BP MOVL addr+0(FP), BP
MOVL oldlo+4(FP), AX MOVL old+4(FP), AX
MOVL oldhi+8(FP), DX MOVL old+8(FP), DX
MOVL newlo+12(FP), BX MOVL new+12(FP), BX
MOVL newhi+16(FP), CX MOVL new+16(FP), CX
// CMPXCHG8B was introduced on the Pentium. // CMPXCHG8B was introduced on the Pentium.
LOCK LOCK
CMPXCHG8B 0(BP) CMPXCHG8B 0(BP)
SETEQ ret+20(FP) SETEQ swapped+20(FP)
RET RET
TEXT ·AddInt32(SB),7,$0 TEXT ·AddInt32(SB),7,$0
@ -47,7 +47,7 @@ TEXT ·AddUint32(SB),7,$0
LOCK LOCK
XADDL AX, 0(BP) XADDL AX, 0(BP)
ADDL AX, CX ADDL AX, CX
MOVL CX, ret+8(FP) MOVL CX, new+8(FP)
RET RET
TEXT ·AddUintptr(SB),7,$0 TEXT ·AddUintptr(SB),7,$0
@ -60,8 +60,8 @@ TEXT ·AddUint64(SB),7,$0
// no XADDQ so use CMPXCHG8B loop // no XADDQ so use CMPXCHG8B loop
MOVL addr+0(FP), BP MOVL addr+0(FP), BP
// DI:SI = delta // DI:SI = delta
MOVL deltalo+4(FP), SI MOVL delta+4(FP), SI
MOVL deltahi+8(FP), DI MOVL delta+8(FP), DI
// DX:AX = *addr // DX:AX = *addr
MOVL 0(BP), AX MOVL 0(BP), AX
MOVL 4(BP), DX MOVL 4(BP), DX
@ -85,8 +85,8 @@ addloop:
// success // success
// return CX:BX // return CX:BX
MOVL BX, retlo+12(FP) MOVL BX, new+12(FP)
MOVL CX, rethi+16(FP) MOVL CX, new+16(FP)
RET RET
TEXT ·LoadInt32(SB),7,$0 TEXT ·LoadInt32(SB),7,$0
@ -95,7 +95,7 @@ TEXT ·LoadInt32(SB),7,$0
TEXT ·LoadUint32(SB),7,$0 TEXT ·LoadUint32(SB),7,$0
MOVL addr+0(FP), AX MOVL addr+0(FP), AX
MOVL 0(AX), AX MOVL 0(AX), AX
MOVL AX, ret+4(FP) MOVL AX, val+4(FP)
RET RET
TEXT ·LoadInt64(SB),7,$0 TEXT ·LoadInt64(SB),7,$0

View File

@ -11,7 +11,7 @@ TEXT ·CompareAndSwapUint32(SB),7,$0
MOVL new+12(FP), CX MOVL new+12(FP), CX
LOCK LOCK
CMPXCHGL CX, 0(BP) CMPXCHGL CX, 0(BP)
SETEQ ret+16(FP) SETEQ swapped+16(FP)
RET RET
TEXT ·CompareAndSwapUintptr(SB),7,$0 TEXT ·CompareAndSwapUintptr(SB),7,$0
@ -29,7 +29,7 @@ TEXT ·CompareAndSwapUint64(SB),7,$0
MOVQ new+16(FP), CX MOVQ new+16(FP), CX
LOCK LOCK
CMPXCHGQ CX, 0(BP) CMPXCHGQ CX, 0(BP)
SETEQ ret+24(FP) SETEQ swapped+24(FP)
RET RET
TEXT ·AddInt32(SB),7,$0 TEXT ·AddInt32(SB),7,$0
@ -42,7 +42,7 @@ TEXT ·AddUint32(SB),7,$0
LOCK LOCK
XADDL AX, 0(BP) XADDL AX, 0(BP)
ADDL AX, CX ADDL AX, CX
MOVL CX, ret+16(FP) MOVL CX, new+16(FP)
RET RET
TEXT ·AddUintptr(SB),7,$0 TEXT ·AddUintptr(SB),7,$0
@ -58,7 +58,7 @@ TEXT ·AddUint64(SB),7,$0
LOCK LOCK
XADDQ AX, 0(BP) XADDQ AX, 0(BP)
ADDQ AX, CX ADDQ AX, CX
MOVQ CX, ret+16(FP) MOVQ CX, new+16(FP)
RET RET
TEXT ·LoadInt32(SB),7,$0 TEXT ·LoadInt32(SB),7,$0
@ -67,7 +67,7 @@ TEXT ·LoadInt32(SB),7,$0
TEXT ·LoadUint32(SB),7,$0 TEXT ·LoadUint32(SB),7,$0
MOVQ addr+0(FP), AX MOVQ addr+0(FP), AX
MOVL 0(AX), AX MOVL 0(AX), AX
MOVL AX, ret+8(FP) MOVL AX, val+8(FP)
RET RET
TEXT ·LoadInt64(SB),7,$0 TEXT ·LoadInt64(SB),7,$0
@ -76,7 +76,7 @@ TEXT ·LoadInt64(SB),7,$0
TEXT ·LoadUint64(SB),7,$0 TEXT ·LoadUint64(SB),7,$0
MOVQ addr+0(FP), AX MOVQ addr+0(FP), AX
MOVQ 0(AX), AX MOVQ 0(AX), AX
MOVQ AX, ret+8(FP) MOVQ AX, val+8(FP)
RET RET
TEXT ·LoadUintptr(SB),7,$0 TEXT ·LoadUintptr(SB),7,$0
@ -85,7 +85,7 @@ TEXT ·LoadUintptr(SB),7,$0
TEXT ·LoadPointer(SB),7,$0 TEXT ·LoadPointer(SB),7,$0
MOVQ addr+0(FP), AX MOVQ addr+0(FP), AX
MOVQ 0(AX), AX MOVQ 0(AX), AX
MOVQ AX, ret+8(FP) MOVQ AX, val+8(FP)
RET RET
TEXT ·StoreInt32(SB),7,$0 TEXT ·StoreInt32(SB),7,$0