From 63515b42dcdf9544f4e6a02fd7632793fde2f72d Mon Sep 17 00:00:00 2001 From: zhangyunhao Date: Sun, 20 Jun 2021 22:29:02 +0800 Subject: [PATCH] cpu: add support for detecting cmpxchg16b MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I892de938e85205c0506aa82e31297b7a99e48e44 Reviewed-on: https://go-review.googlesource.com/c/sys/+/329450 Trust: Martin Möhrmann Trust: Tobias Klauser Run-TryBot: Martin Möhrmann TryBot-Result: Go Bot Reviewed-by: Martin Möhrmann --- cpu/cpu.go | 1 + cpu/cpu_x86.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cpu/cpu.go b/cpu/cpu.go index abbec2d4..b56886f2 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -56,6 +56,7 @@ var X86 struct { HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions HasBMI1 bool // Bit manipulation instruction set 1 HasBMI2 bool // Bit manipulation instruction set 2 + HasCX16 bool // Compare and exchange 16 Bytes HasERMS bool // Enhanced REP for MOVSB and STOSB HasFMA bool // Fused-multiply-add instructions HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. diff --git a/cpu/cpu_x86.go b/cpu/cpu_x86.go index 54ca4667..5ea287b7 100644 --- a/cpu/cpu_x86.go +++ b/cpu/cpu_x86.go @@ -39,6 +39,7 @@ func initOptions() { {Name: "avx512bf16", Feature: &X86.HasAVX512BF16}, {Name: "bmi1", Feature: &X86.HasBMI1}, {Name: "bmi2", Feature: &X86.HasBMI2}, + {Name: "cx16", Feature: &X86.HasCX16}, {Name: "erms", Feature: &X86.HasERMS}, {Name: "fma", Feature: &X86.HasFMA}, {Name: "osxsave", Feature: &X86.HasOSXSAVE}, @@ -73,6 +74,7 @@ func archInit() { X86.HasPCLMULQDQ = isSet(1, ecx1) X86.HasSSSE3 = isSet(9, ecx1) X86.HasFMA = isSet(12, ecx1) + X86.HasCX16 = isSet(13, ecx1) X86.HasSSE41 = isSet(19, ecx1) X86.HasSSE42 = isSet(20, ecx1) X86.HasPOPCNT = isSet(23, ecx1)