Skip to content

Commit 668c84e

Browse files
authored
Add SM3, SM4 detection on x86 (#157)
cpuid: Add SM3, SM4 detection on x86 Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
1 parent 243c6f1 commit 668c84e

3 files changed

Lines changed: 88 additions & 80 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ Exit Code 1
421421
| SHA | Intel SHA Extensions |
422422
| SME | AMD Secure Memory Encryption supported |
423423
| SME_COHERENT | AMD Hardware cache coherency across encryption domains enforced |
424+
| SM3_X86 | SM3 instructions |
425+
| SM4_X86 | SM4 instructions |
424426
| SPEC_CTRL_SSBD | Speculative Store Bypass Disable |
425427
| SRBDS_CTRL | SRBDS mitigation MSR available |
426428
| SSE | SSE functions |

cpuid.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ const (
223223
SHA // Intel SHA Extensions
224224
SME // AMD Secure Memory Encryption supported
225225
SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced
226+
SM3_X86 // SM3 instructions
227+
SM4_X86 // SM4 instructions
226228
SPEC_CTRL_SSBD // Speculative Store Bypass Disable
227229
SRBDS_CTRL // SRBDS mitigation MSR available
228230
SRSO_MSR_FIX // Indicates that software may use MSR BP_CFG[BpSpecReduce] to mitigate SRSO.
@@ -1280,6 +1282,8 @@ func support() flagSet {
12801282
// CPUID.(EAX=7, ECX=1).EAX
12811283
eax1, _, _, edx1 := cpuidex(7, 1)
12821284
fs.setIf(fs.inSet(AVX) && eax1&(1<<4) != 0, AVXVNNI)
1285+
fs.setIf(eax1&(1<<1) != 0, SM3_X86)
1286+
fs.setIf(eax1&(1<<2) != 0, SM4_X86)
12831287
fs.setIf(eax1&(1<<7) != 0, CMPCCXADD)
12841288
fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL)
12851289
fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT)

featureid_string.go

Lines changed: 82 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)