cmd/internal/obj/x86: add new instructions, cleanup.
Add several instructions that were used via BYTE and use them.
Instructions added: PEXTRB, PEXTRD, PEXTRQ, PINSRB, XGETBV, POPCNT.
Change-Id: I5a80cd390dc01f3555dbbe856a475f74b5e6df65
Reviewed-on: https://go-review.googlesource.com/18593
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index 6ebe0dc..cac032c 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -56,7 +56,7 @@
JNE noavx
MOVL $0, CX
// For XGETBV, OSXSAVE bit is required and sufficient
- BYTE $0x0F; BYTE $0x01; BYTE $0xD0
+ XGETBV
ANDL $6, AX
CMPL AX, $6 // Check for OS support of YMM registers
JNE noavx
@@ -822,10 +822,10 @@
TEXT runtime·cputicks(SB),NOSPLIT,$0-0
CMPB runtime·lfenceBeforeRdtsc(SB), $1
JNE mfence
- BYTE $0x0f; BYTE $0xae; BYTE $0xe8 // LFENCE
+ LFENCE
JMP done
mfence:
- BYTE $0x0f; BYTE $0xae; BYTE $0xf0 // MFENCE
+ MFENCE
done:
RDTSC
SHLQ $32, DX