2014-02-06 18:43:22 -07:00
|
|
|
// Copyright 2014 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-03-12 19:12:25 -06:00
|
|
|
// +build !plan9
|
|
|
|
|
2014-09-04 21:05:18 -06:00
|
|
|
#include "textflag.h"
|
2014-02-06 18:43:22 -07:00
|
|
|
|
2014-09-09 15:12:05 -06:00
|
|
|
// NOTE: Windows externalthreadhandler expects memclr to preserve DX.
|
|
|
|
|
2014-02-06 18:43:22 -07:00
|
|
|
// void runtime·memclr(void*, uintptr)
|
|
|
|
TEXT runtime·memclr(SB), NOSPLIT, $0-16
|
|
|
|
MOVQ ptr+0(FP), DI
|
|
|
|
MOVQ n+8(FP), BX
|
|
|
|
XORQ AX, AX
|
|
|
|
|
|
|
|
// MOVOU seems always faster than REP STOSQ.
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
tail:
|
2014-02-06 18:43:22 -07:00
|
|
|
TESTQ BX, BX
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JEQ _0
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $2
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _1or2
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $4
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _3or4
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $8
|
2015-11-05 13:39:56 -07:00
|
|
|
JB _5through7
|
|
|
|
JE _8
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $16
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _9through16
|
2014-02-06 18:43:22 -07:00
|
|
|
PXOR X0, X0
|
|
|
|
CMPQ BX, $32
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _17through32
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $64
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _33through64
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $128
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _65through128
|
2014-02-06 18:43:22 -07:00
|
|
|
CMPQ BX, $256
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JBE _129through256
|
2014-02-06 18:43:22 -07:00
|
|
|
// TODO: use branch table and BSR to make this just a single dispatch
|
|
|
|
// TODO: for really big clears, use MOVNTDQ.
|
|
|
|
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
loop:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVOU X0, 0(DI)
|
|
|
|
MOVOU X0, 16(DI)
|
|
|
|
MOVOU X0, 32(DI)
|
|
|
|
MOVOU X0, 48(DI)
|
|
|
|
MOVOU X0, 64(DI)
|
|
|
|
MOVOU X0, 80(DI)
|
|
|
|
MOVOU X0, 96(DI)
|
|
|
|
MOVOU X0, 112(DI)
|
|
|
|
MOVOU X0, 128(DI)
|
|
|
|
MOVOU X0, 144(DI)
|
|
|
|
MOVOU X0, 160(DI)
|
|
|
|
MOVOU X0, 176(DI)
|
|
|
|
MOVOU X0, 192(DI)
|
|
|
|
MOVOU X0, 208(DI)
|
|
|
|
MOVOU X0, 224(DI)
|
|
|
|
MOVOU X0, 240(DI)
|
|
|
|
SUBQ $256, BX
|
|
|
|
ADDQ $256, DI
|
|
|
|
CMPQ BX, $256
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JAE loop
|
|
|
|
JMP tail
|
2014-02-06 18:43:22 -07:00
|
|
|
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_1or2:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVB AX, (DI)
|
|
|
|
MOVB AX, -1(DI)(BX*1)
|
2014-08-01 07:21:08 -06:00
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_0:
|
2014-02-06 18:43:22 -07:00
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_3or4:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVW AX, (DI)
|
|
|
|
MOVW AX, -2(DI)(BX*1)
|
|
|
|
RET
|
2015-11-05 13:39:56 -07:00
|
|
|
_5through7:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVL AX, (DI)
|
|
|
|
MOVL AX, -4(DI)(BX*1)
|
|
|
|
RET
|
2015-11-05 13:39:56 -07:00
|
|
|
_8:
|
|
|
|
// We need a separate case for 8 to make sure we clear pointers atomically.
|
|
|
|
MOVQ AX, (DI)
|
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_9through16:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVQ AX, (DI)
|
|
|
|
MOVQ AX, -8(DI)(BX*1)
|
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_17through32:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVOU X0, (DI)
|
|
|
|
MOVOU X0, -16(DI)(BX*1)
|
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_33through64:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVOU X0, (DI)
|
|
|
|
MOVOU X0, 16(DI)
|
|
|
|
MOVOU X0, -32(DI)(BX*1)
|
|
|
|
MOVOU X0, -16(DI)(BX*1)
|
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_65through128:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVOU X0, (DI)
|
|
|
|
MOVOU X0, 16(DI)
|
|
|
|
MOVOU X0, 32(DI)
|
|
|
|
MOVOU X0, 48(DI)
|
|
|
|
MOVOU X0, -64(DI)(BX*1)
|
|
|
|
MOVOU X0, -48(DI)(BX*1)
|
|
|
|
MOVOU X0, -32(DI)(BX*1)
|
|
|
|
MOVOU X0, -16(DI)(BX*1)
|
|
|
|
RET
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
_129through256:
|
2014-02-06 18:43:22 -07:00
|
|
|
MOVOU X0, (DI)
|
|
|
|
MOVOU X0, 16(DI)
|
|
|
|
MOVOU X0, 32(DI)
|
|
|
|
MOVOU X0, 48(DI)
|
|
|
|
MOVOU X0, 64(DI)
|
|
|
|
MOVOU X0, 80(DI)
|
|
|
|
MOVOU X0, 96(DI)
|
|
|
|
MOVOU X0, 112(DI)
|
|
|
|
MOVOU X0, -128(DI)(BX*1)
|
|
|
|
MOVOU X0, -112(DI)(BX*1)
|
|
|
|
MOVOU X0, -96(DI)(BX*1)
|
|
|
|
MOVOU X0, -80(DI)(BX*1)
|
|
|
|
MOVOU X0, -64(DI)(BX*1)
|
|
|
|
MOVOU X0, -48(DI)(BX*1)
|
|
|
|
MOVOU X0, -32(DI)(BX*1)
|
|
|
|
MOVOU X0, -16(DI)(BX*1)
|
|
|
|
RET
|