aboutsummaryrefslogtreecommitdiff
path: root/src/internal/bytealg
diff options
context:
space:
mode:
authorMartin Möhrmann <moehrmann@google.com>2018-08-24 11:02:00 +0200
committerMartin Möhrmann <moehrmann@google.com>2018-08-24 18:40:16 +0000
commit05c02444eb2d8b8d3ecd949c4308d8e2323ae087 (patch)
treee578be0855d35afba810156ae16f37dc656da453 /src/internal/bytealg
parent961eb13b6781907b5bfe4a7b22f68206020c4468 (diff)
downloadgo-05c02444eb2d8b8d3ecd949c4308d8e2323ae087.tar.xz
all: align cpu feature variable offset naming
Add an "offset_" prefix to all cpu feature variable offset constants to signify that they are not boolean cpu feature variables. Remove _ from offset constant names. Change-Id: I6e22a79ebcbe6e2ae54c4ac8764f9260bb3223ff Reviewed-on: https://go-review.googlesource.com/131215 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/internal/bytealg')
-rw-r--r--src/internal/bytealg/bytealg.go11
-rw-r--r--src/internal/bytealg/compare_amd64.s2
-rw-r--r--src/internal/bytealg/count_amd64.s6
-rw-r--r--src/internal/bytealg/equal_386.s2
-rw-r--r--src/internal/bytealg/equal_amd64.s2
-rw-r--r--src/internal/bytealg/index_amd64.s2
-rw-r--r--src/internal/bytealg/indexbyte_amd64.s2
-rw-r--r--src/internal/bytealg/indexbyte_s390x.s2
8 files changed, 15 insertions, 14 deletions
diff --git a/src/internal/bytealg/bytealg.go b/src/internal/bytealg/bytealg.go
index 1ab7c30f4e..9ecd8eb004 100644
--- a/src/internal/bytealg/bytealg.go
+++ b/src/internal/bytealg/bytealg.go
@@ -11,11 +11,12 @@ import (
// Offsets into internal/cpu records for use in assembly.
const (
- x86_HasSSE2 = unsafe.Offsetof(cpu.X86.HasSSE2)
- x86_HasSSE42 = unsafe.Offsetof(cpu.X86.HasSSE42)
- x86_HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)
- x86_HasPOPCNT = unsafe.Offsetof(cpu.X86.HasPOPCNT)
- s390x_HasVX = unsafe.Offsetof(cpu.S390X.HasVX)
+ offsetX86HasSSE2 = unsafe.Offsetof(cpu.X86.HasSSE2)
+ offsetX86HasSSE42 = unsafe.Offsetof(cpu.X86.HasSSE42)
+ offsetX86HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)
+ offsetX86HasPOPCNT = unsafe.Offsetof(cpu.X86.HasPOPCNT)
+
+ offsetS390xHasVX = unsafe.Offsetof(cpu.S390X.HasVX)
)
// MaxLen is the maximum length of the string to be searched for (argument b) in Index.
diff --git a/src/internal/bytealg/compare_amd64.s b/src/internal/bytealg/compare_amd64.s
index 277d77c545..05bef4aad9 100644
--- a/src/internal/bytealg/compare_amd64.s
+++ b/src/internal/bytealg/compare_amd64.s
@@ -47,7 +47,7 @@ TEXT cmpbody<>(SB),NOSPLIT,$0-0
CMPQ R8, $63
JBE loop
- CMPB internal∕cpu·X86+const_x86_HasAVX2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
JEQ big_loop_avx2
JMP big_loop
loop:
diff --git a/src/internal/bytealg/count_amd64.s b/src/internal/bytealg/count_amd64.s
index cecba11cf9..fa864c4c76 100644
--- a/src/internal/bytealg/count_amd64.s
+++ b/src/internal/bytealg/count_amd64.s
@@ -6,7 +6,7 @@
#include "textflag.h"
TEXT ·Count(SB),NOSPLIT,$0-40
- CMPB internal∕cpu·X86+const_x86_HasPOPCNT(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasPOPCNT(SB), $1
JEQ 2(PC)
JMP ·countGeneric(SB)
MOVQ b_base+0(FP), SI
@@ -16,7 +16,7 @@ TEXT ·Count(SB),NOSPLIT,$0-40
JMP countbody<>(SB)
TEXT ·CountString(SB),NOSPLIT,$0-32
- CMPB internal∕cpu·X86+const_x86_HasPOPCNT(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasPOPCNT(SB), $1
JEQ 2(PC)
JMP ·countGenericString(SB)
MOVQ s_base+0(FP), SI
@@ -151,7 +151,7 @@ endofpage:
RET
avx2:
- CMPB internal∕cpu·X86+const_x86_HasAVX2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
JNE sse
MOVD AX, X0
LEAQ -32(SI)(BX*1), R11
diff --git a/src/internal/bytealg/equal_386.s b/src/internal/bytealg/equal_386.s
index c048b6cebc..273389284e 100644
--- a/src/internal/bytealg/equal_386.s
+++ b/src/internal/bytealg/equal_386.s
@@ -80,7 +80,7 @@ TEXT memeqbody<>(SB),NOSPLIT,$0-0
hugeloop:
CMPL BX, $64
JB bigloop
- CMPB internal∕cpu·X86+const_x86_HasSSE2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasSSE2(SB), $1
JNE bigloop
MOVOU (SI), X0
MOVOU (DI), X1
diff --git a/src/internal/bytealg/equal_amd64.s b/src/internal/bytealg/equal_amd64.s
index cbc62dc1d8..5263d3040d 100644
--- a/src/internal/bytealg/equal_amd64.s
+++ b/src/internal/bytealg/equal_amd64.s
@@ -77,7 +77,7 @@ TEXT memeqbody<>(SB),NOSPLIT,$0-0
JB small
CMPQ BX, $64
JB bigloop
- CMPB internal∕cpu·X86+const_x86_HasAVX2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
JE hugeloop_avx2
// 64 bytes at a time using xmm registers
diff --git a/src/internal/bytealg/index_amd64.s b/src/internal/bytealg/index_amd64.s
index f7297c0cab..4459820801 100644
--- a/src/internal/bytealg/index_amd64.s
+++ b/src/internal/bytealg/index_amd64.s
@@ -233,7 +233,7 @@ success_avx2:
VZEROUPPER
JMP success
sse42:
- CMPB internal∕cpu·X86+const_x86_HasSSE42(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasSSE42(SB), $1
JNE no_sse42
CMPQ AX, $12
// PCMPESTRI is slower than normal compare,
diff --git a/src/internal/bytealg/indexbyte_amd64.s b/src/internal/bytealg/indexbyte_amd64.s
index 359f38904b..5bf8866476 100644
--- a/src/internal/bytealg/indexbyte_amd64.s
+++ b/src/internal/bytealg/indexbyte_amd64.s
@@ -139,7 +139,7 @@ endofpage:
RET
avx2:
- CMPB internal∕cpu·X86+const_x86_HasAVX2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
JNE sse
MOVD AX, X0
LEAQ -32(SI)(BX*1), R11
diff --git a/src/internal/bytealg/indexbyte_s390x.s b/src/internal/bytealg/indexbyte_s390x.s
index 15fd2935b4..24f5ce17fa 100644
--- a/src/internal/bytealg/indexbyte_s390x.s
+++ b/src/internal/bytealg/indexbyte_s390x.s
@@ -64,7 +64,7 @@ notfound:
RET
large:
- MOVBZ internal∕cpu·S390X+const_s390x_HasVX(SB), R1
+ MOVBZ internal∕cpu·S390X+const_offsetS390xHasVX(SB), R1
CMPBNE R1, $0, vectorimpl
srstimpl: // no vector facility