+3
-3
@@ -12,7 +12,7 @@ import (
|
|||||||
func xorBytesSSE(dst, a, b []byte, n int)
|
func xorBytesSSE(dst, a, b []byte, n int)
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func xorBytesAVX(dst, a, b []byte, n int)
|
func xorBytesAVX2(dst, a, b []byte, n int)
|
||||||
|
|
||||||
func min(a, b, c int) int {
|
func min(a, b, c int) int {
|
||||||
if a < b {
|
if a < b {
|
||||||
@@ -32,8 +32,8 @@ func Bytes(dst, a, b []byte) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case cpu.X86.HasAVX:
|
case cpu.X86.HasAVX2:
|
||||||
xorBytesAVX(dst, a, b, n)
|
xorBytesAVX2(dst, a, b, n)
|
||||||
case cpu.X86.HasSSE2:
|
case cpu.X86.HasSSE2:
|
||||||
xorBytesSSE(dst, a, b, n)
|
xorBytesSSE(dst, a, b, n)
|
||||||
default:
|
default:
|
||||||
|
|||||||
+2
-2
@@ -71,8 +71,8 @@ XOR_LOOP_FINAL_SSE:
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
|
|
||||||
// func xorBytesAVX(dst, a, b []byte, n int)
|
// func xorBytesAVX2(dst, a, b []byte, n int)
|
||||||
TEXT ·xorBytesAVX(SB), NOSPLIT ,$0
|
TEXT ·xorBytesAVX2(SB), NOSPLIT ,$0
|
||||||
MOVQ dst_data+0(FP), Dst
|
MOVQ dst_data+0(FP), Dst
|
||||||
MOVQ a_data+24(FP), A
|
MOVQ a_data+24(FP), A
|
||||||
MOVQ b_data+48(FP), B
|
MOVQ b_data+48(FP), B
|
||||||
|
|||||||
Reference in New Issue
Block a user