From 041c0ef4e4fdd2dcfb9b9f59a602a8c9a67d4ae9 Mon Sep 17 00:00:00 2001 From: Ruben Vermeersch Date: Mon, 22 Mar 2021 20:58:27 +0100 Subject: [PATCH] Fix AVX check Fixes #2 --- xor_amd64.go | 6 +++--- xor_amd64.s | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xor_amd64.go b/xor_amd64.go index a90a5d2..ba406d8 100644 --- a/xor_amd64.go +++ b/xor_amd64.go @@ -12,7 +12,7 @@ import ( func xorBytesSSE(dst, a, b []byte, n int) //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 { if a < b { @@ -32,8 +32,8 @@ func Bytes(dst, a, b []byte) int { return 0 } switch { - case cpu.X86.HasAVX: - xorBytesAVX(dst, a, b, n) + case cpu.X86.HasAVX2: + xorBytesAVX2(dst, a, b, n) case cpu.X86.HasSSE2: xorBytesSSE(dst, a, b, n) default: diff --git a/xor_amd64.s b/xor_amd64.s index 24a2e14..b765b4c 100644 --- a/xor_amd64.s +++ b/xor_amd64.s @@ -71,8 +71,8 @@ XOR_LOOP_FINAL_SSE: RET -// func xorBytesAVX(dst, a, b []byte, n int) -TEXT ·xorBytesAVX(SB), NOSPLIT ,$0 +// func xorBytesAVX2(dst, a, b []byte, n int) +TEXT ·xorBytesAVX2(SB), NOSPLIT ,$0 MOVQ dst_data+0(FP), Dst MOVQ a_data+24(FP), A MOVQ b_data+48(FP), B