Commit b80b4a23 authored by isharipo's avatar isharipo Committed by Brad Fitzpatrick

cmd/internal/obj/x86: add missing legacy insts

Minimizes the amount of "TODO" stuff in test suite
of cmd/asm/internal/asm/testdata/amd64enc.s.

Some instructions were already implemented, but
test cases for them were commented-out.

Does not enable MMX instructions, calls/jumps and some
segment registers instructions.

-- Affected instructions --
BLENDVPD, BLENDVPS
BSWAPW
CBW
CDQE
CLAC
CLFLUSHOPT
CMPXCHG16B
CRC32B, CRC32L, CRC32W
CWDE
FBLD
FBSTP
FCMOVB
FCMOVBE
FCMOVE
FCMOVNB
FCMOVNBE
FCMOVU
FCOMI
FCOMIP
IMUL3L, IMUL3Q, IMUL3W
ICEBP, INT
INVPCID
LARQ
LGDT, LIDT, LLDT
LMSW
LTR
LZCNTL, LZCNTQ, LZCNTW
MONITOR
MOVBELL, MOVBEQQ, MOVBEWW
MOVBQZX
MOVQ
MOVSWW, MOVZWW
MWAIT
NOPL, NOPW
PBLENDVB
PEXTRW
RDPKRU
RDRANDL, RDRANDQ, RDRANDW
RDSEEDL, RDSEEDQ, RDSEEDW
RDTSCP
SAHF
SGDT, SIDT
SLDTL, SLDTQ, SLDTW
SMSWL, SMSWQ, SMSWW
STAC
STRL, STRQ, STRW
SYSENTER, SYSENTER64
SYSEXIT, SYSEXIT64
SHA256RNDS2
TZCNTL, TZCNTQ, TZCNTW
UD1, UD2
WRPKRU
XRSTOR, XRSTOR64
XRSTORS, XRSTORS64
XSAVE, XSAVE64
XSAVEC, XSAVEC64
XSAVEOPT, XSAVEOPT64
XSAVES, XSAVES64
XSETBV

Fixes #6739

Change-Id: I8b125d9a5ea39bb4b9da7e66a63a16f609cef376
Reviewed-on: https://go-review.googlesource.com/97235
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent c55505ba
......@@ -235,5 +235,63 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
VPGATHERQQ Y0, 512(R13)(Y1*1), Y2 // c4c2fd91940d00020000
// Test low-8 register for /is4 "hr" operand.
VPBLENDVB X0, (BX), X1, X2 // c4e3714c1300
// <XMM0>/Yxr0 tests.
SHA256RNDS2 X0, (BX), X2 // 0f38cb13
SHA256RNDS2 X0, (R11), X2 // 410f38cb13
SHA256RNDS2 X0, X2, X2 // 0f38cbd2
SHA256RNDS2 X0, X11, X2 // 410f38cbd3
SHA256RNDS2 X0, (BX), X11 // 440f38cb1b
SHA256RNDS2 X0, (R11), X11 // 450f38cb1b
SHA256RNDS2 X0, X2, X11 // 440f38cbda
SHA256RNDS2 X0, X11, X11 // 450f38cbdb
// Rest SHA instructions tests.
SHA1MSG1 (BX), X2 // 0f38c913
SHA1MSG1 (R11), X2 // 410f38c913
SHA1MSG1 X2, X2 // 0f38c9d2
SHA1MSG1 X11, X2 // 410f38c9d3
SHA1MSG1 (BX), X11 // 440f38c91b
SHA1MSG1 (R11), X11 // 450f38c91b
SHA1MSG1 X2, X11 // 440f38c9da
SHA1MSG1 X11, X11 // 450f38c9db
SHA1MSG2 (BX), X2 // 0f38ca13
SHA1MSG2 (R11), X2 // 410f38ca13
SHA1MSG2 X2, X2 // 0f38cad2
SHA1MSG2 X11, X2 // 410f38cad3
SHA1MSG2 (BX), X11 // 440f38ca1b
SHA1MSG2 (R11), X11 // 450f38ca1b
SHA1MSG2 X2, X11 // 440f38cada
SHA1MSG2 X11, X11 // 450f38cadb
SHA1NEXTE (BX), X2 // 0f38c813
SHA1NEXTE (R11), X2 // 410f38c813
SHA1NEXTE X2, X2 // 0f38c8d2
SHA1NEXTE X11, X2 // 410f38c8d3
SHA1NEXTE (BX), X11 // 440f38c81b
SHA1NEXTE (R11), X11 // 450f38c81b
SHA1NEXTE X2, X11 // 440f38c8da
SHA1NEXTE X11, X11 // 450f38c8db
SHA1RNDS4 $0, (BX), X2 // 0f3acc1300
SHA1RNDS4 $0, (R11), X2 // 410f3acc1300
SHA1RNDS4 $1, X2, X2 // 0f3accd201
SHA1RNDS4 $1, X11, X2 // 410f3accd301
SHA1RNDS4 $2, (BX), X11 // 440f3acc1b02
SHA1RNDS4 $2, (R11), X11 // 450f3acc1b02
SHA1RNDS4 $3, X2, X11 // 440f3accda03
SHA1RNDS4 $3, X11, X11 // 450f3accdb03
SHA256MSG1 (BX), X2 // 0f38cc13
SHA256MSG1 (R11), X2 // 410f38cc13
SHA256MSG1 X2, X2 // 0f38ccd2
SHA256MSG1 X11, X2 // 410f38ccd3
SHA256MSG1 (BX), X11 // 440f38cc1b
SHA256MSG1 (R11), X11 // 450f38cc1b
SHA256MSG1 X2, X11 // 440f38ccda
SHA256MSG1 X11, X11 // 450f38ccdb
SHA256MSG2 (BX), X2 // 0f38cd13
SHA256MSG2 (R11), X2 // 410f38cd13
SHA256MSG2 X2, X2 // 0f38cdd2
SHA256MSG2 X11, X2 // 410f38cdd3
SHA256MSG2 (BX), X11 // 440f38cd1b
SHA256MSG2 (R11), X11 // 450f38cd1b
SHA256MSG2 X2, X11 // 440f38cdda
SHA256MSG2 X11, X11 // 450f38cddb
// End of tests.
RET
......@@ -32,4 +32,6 @@ TEXT errors(SB),$0
VPGATHERDQ X2, 664(X2*8), X7 // ERROR "mask, index, and destination registers should be distinct"
VPGATHERDQ X2, 664(X7*8), X2 // ERROR "mask, index, and destination registers should be distinct"
VPGATHERDQ X7, 664(X2*8), X2 // ERROR "mask, index, and destination registers should be distinct"
// Non-X0 for Yxr0 should produce an error
BLENDVPD X1, (BX), X2 // ERROR "invalid instruction"
RET
......@@ -51,6 +51,8 @@ const (
ABEXTRQ
ABLENDPD
ABLENDPS
ABLENDVPD
ABLENDVPS
ABLSIL
ABLSIQ
ABLSMSKL
......@@ -67,6 +69,7 @@ const (
ABSRW
ABSWAPL
ABSWAPQ
ABSWAPW
ABTCL
ABTCQ
ABTCW
......@@ -82,10 +85,14 @@ const (
ABYTE
ABZHIL
ABZHIQ
ACBW
ACDQ
ACDQE
ACLAC
ACLC
ACLD
ACLFLUSH
ACLFLUSHOPT
ACLI
ACLTS
ACMC
......@@ -149,6 +156,7 @@ const (
ACMPSS
ACMPSW
ACMPW
ACMPXCHG16B
ACMPXCHG8B
ACMPXCHGB
ACMPXCHGL
......@@ -159,7 +167,9 @@ const (
ACPUID
ACQO
ACRC32B
ACRC32L
ACRC32Q
ACRC32W
ACVTPD2PL
ACVTPD2PS
ACVTPL2PD
......@@ -183,6 +193,7 @@ const (
ACVTTSS2SL
ACVTTSS2SQ
ACWD
ACWDE
ADAA
ADAS
ADECB
......@@ -209,15 +220,23 @@ const (
AFADDF
AFADDL
AFADDW
AFBLD
AFBSTP
AFCHS
AFCLEX
AFCMOVB
AFCMOVBE
AFCMOVCC
AFCMOVCS
AFCMOVE
AFCMOVEQ
AFCMOVHI
AFCMOVLS
AFCMOVNB
AFCMOVNBE
AFCMOVNE
AFCMOVNU
AFCMOVU
AFCMOVUN
AFCOMD
AFCOMDP
......@@ -318,11 +337,14 @@ const (
AHLT
AHSUBPD
AHSUBPS
AICEBP
AIDIVB
AIDIVL
AIDIVQ
AIDIVW
AIMUL3L
AIMUL3Q
AIMUL3W
AIMULB
AIMULL
AIMULQ
......@@ -341,6 +363,7 @@ const (
AINTO
AINVD
AINVLPG
AINVPCID
AINW
AIRETL
AIRETQ
......@@ -366,6 +389,7 @@ const (
AJPS // parity set
ALAHF
ALARL
ALARQ
ALARW
ALDDQU
ALDMXCSR
......@@ -376,6 +400,16 @@ const (
ALEAVEW
ALEAW
ALFENCE
ALFSL
ALFSQ
ALFSW
ALGDT
ALGSL
ALGSQ
ALGSW
ALIDT
ALLDT
ALMSW
ALOCK
ALODSB
ALODSL
......@@ -386,7 +420,15 @@ const (
ALOOPEQ
ALOOPNE
ALSLL
ALSLQ
ALSLW
ALSSL
ALSSQ
ALSSW
ALTR
ALZCNTL
ALZCNTQ
ALZCNTW
AMASKMOVOU
AMASKMOVQ
AMAXPD
......@@ -398,9 +440,13 @@ const (
AMINPS
AMINSD
AMINSS
AMONITOR
AMOVAPD
AMOVAPS
AMOVB
AMOVBELL
AMOVBEQQ
AMOVBEWW
AMOVBLSX
AMOVBLZX
AMOVBQSX
......@@ -439,6 +485,7 @@ const (
AMOVSQ
AMOVSS
AMOVSW
AMOVSWW
AMOVUPD
AMOVUPS
AMOVW
......@@ -446,6 +493,7 @@ const (
AMOVWLZX
AMOVWQSX
AMOVWQZX
AMOVZWW
AMPSADBW
AMULB
AMULL
......@@ -457,10 +505,13 @@ const (
AMULW
AMULXL
AMULXQ
AMWAIT
ANEGB
ANEGL
ANEGQ
ANEGW
ANOPL
ANOPW
ANOTB
ANOTL
ANOTQ
......@@ -498,6 +549,7 @@ const (
APAUSE
APAVGB
APAVGW
APBLENDVB
APBLENDW
APCLMULQDQ
APCMPEQB
......@@ -638,9 +690,21 @@ const (
ARCRL
ARCRQ
ARCRW
ARDFSBASEL
ARDFSBASEQ
ARDGSBASEL
ARDGSBASEQ
ARDMSR
ARDPKRU
ARDPMC
ARDRANDL
ARDRANDQ
ARDRANDW
ARDSEEDL
ARDSEEDQ
ARDSEEDW
ARDTSC
ARDTSCP
AREP
AREPN
ARETFL
......@@ -699,6 +763,14 @@ const (
ASETPL
ASETPS
ASFENCE
ASGDT
ASHA1MSG1
ASHA1MSG2
ASHA1NEXTE
ASHA1RNDS4
ASHA256MSG1
ASHA256MSG2
ASHA256RNDS2
ASHLB
ASHLL
ASHLQ
......@@ -713,10 +785,18 @@ const (
ASHRXQ
ASHUFPD
ASHUFPS
ASIDT
ASLDTL
ASLDTQ
ASLDTW
ASMSWL
ASMSWQ
ASMSWW
ASQRTPD
ASQRTPS
ASQRTSD
ASQRTSS
ASTAC
ASTC
ASTD
ASTI
......@@ -725,6 +805,9 @@ const (
ASTOSL
ASTOSQ
ASTOSW
ASTRL
ASTRQ
ASTRW
ASUBB
ASUBL
ASUBPD
......@@ -735,13 +818,22 @@ const (
ASUBW
ASWAPGS
ASYSCALL
ASYSENTER
ASYSENTER64
ASYSEXIT
ASYSEXIT64
ASYSRET
ATESTB
ATESTL
ATESTQ
ATESTW
ATZCNTL
ATZCNTQ
ATZCNTW
AUCOMISD
AUCOMISS
AUD1
AUD2
AUNPCKHPD
AUNPCKHPS
AUNPCKLPD
......@@ -1109,7 +1201,12 @@ const (
AWAIT
AWBINVD
AWORD
AWRFSBASEL
AWRFSBASEQ
AWRGSBASEL
AWRGSBASEQ
AWRMSR
AWRPKRU
AXABORT
AXACQUIRE
AXADDB
......@@ -1131,6 +1228,19 @@ const (
AXORQ
AXORW
AXRELEASE
AXRSTOR
AXRSTOR64
AXRSTORS
AXRSTORS64
AXSAVE
AXSAVE64
AXSAVEC
AXSAVEC64
AXSAVEOPT
AXSAVEOPT64
AXSAVES
AXSAVES64
AXSETBV
AXTEST
ALAST
)
......@@ -50,6 +50,8 @@ var Anames = []string{
"BEXTRQ",
"BLENDPD",
"BLENDPS",
"BLENDVPD",
"BLENDVPS",
"BLSIL",
"BLSIQ",
"BLSMSKL",
......@@ -66,6 +68,7 @@ var Anames = []string{
"BSRW",
"BSWAPL",
"BSWAPQ",
"BSWAPW",
"BTCL",
"BTCQ",
"BTCW",
......@@ -81,10 +84,14 @@ var Anames = []string{
"BYTE",
"BZHIL",
"BZHIQ",
"CBW",
"CDQ",
"CDQE",
"CLAC",
"CLC",
"CLD",
"CLFLUSH",
"CLFLUSHOPT",
"CLI",
"CLTS",
"CMC",
......@@ -148,6 +155,7 @@ var Anames = []string{
"CMPSS",
"CMPSW",
"CMPW",
"CMPXCHG16B",
"CMPXCHG8B",
"CMPXCHGB",
"CMPXCHGL",
......@@ -158,7 +166,9 @@ var Anames = []string{
"CPUID",
"CQO",
"CRC32B",
"CRC32L",
"CRC32Q",
"CRC32W",
"CVTPD2PL",
"CVTPD2PS",
"CVTPL2PD",
......@@ -182,6 +192,7 @@ var Anames = []string{
"CVTTSS2SL",
"CVTTSS2SQ",
"CWD",
"CWDE",
"DAA",
"DAS",
"DECB",
......@@ -208,15 +219,23 @@ var Anames = []string{
"FADDF",
"FADDL",
"FADDW",
"FBLD",
"FBSTP",
"FCHS",
"FCLEX",
"FCMOVB",
"FCMOVBE",
"FCMOVCC",
"FCMOVCS",
"FCMOVE",
"FCMOVEQ",
"FCMOVHI",
"FCMOVLS",
"FCMOVNB",
"FCMOVNBE",
"FCMOVNE",
"FCMOVNU",
"FCMOVU",
"FCMOVUN",
"FCOMD",
"FCOMDP",
......@@ -317,11 +336,14 @@ var Anames = []string{
"HLT",
"HSUBPD",
"HSUBPS",
"ICEBP",
"IDIVB",
"IDIVL",
"IDIVQ",
"IDIVW",
"IMUL3L",
"IMUL3Q",
"IMUL3W",
"IMULB",
"IMULL",
"IMULQ",
......@@ -340,6 +362,7 @@ var Anames = []string{
"INTO",
"INVD",
"INVLPG",
"INVPCID",
"INW",
"IRETL",
"IRETQ",
......@@ -365,6 +388,7 @@ var Anames = []string{
"JPS",
"LAHF",
"LARL",
"LARQ",
"LARW",
"LDDQU",
"LDMXCSR",
......@@ -375,6 +399,16 @@ var Anames = []string{
"LEAVEW",
"LEAW",
"LFENCE",
"LFSL",
"LFSQ",
"LFSW",
"LGDT",
"LGSL",
"LGSQ",
"LGSW",
"LIDT",
"LLDT",
"LMSW",
"LOCK",
"LODSB",
"LODSL",
......@@ -385,7 +419,15 @@ var Anames = []string{
"LOOPEQ",
"LOOPNE",
"LSLL",
"LSLQ",
"LSLW",
"LSSL",
"LSSQ",
"LSSW",
"LTR",
"LZCNTL",
"LZCNTQ",
"LZCNTW",
"MASKMOVOU",
"MASKMOVQ",
"MAXPD",
......@@ -397,9 +439,13 @@ var Anames = []string{
"MINPS",
"MINSD",
"MINSS",
"MONITOR",
"MOVAPD",
"MOVAPS",
"MOVB",
"MOVBELL",
"MOVBEQQ",
"MOVBEWW",
"MOVBLSX",
"MOVBLZX",
"MOVBQSX",
......@@ -438,6 +484,7 @@ var Anames = []string{
"MOVSQ",
"MOVSS",
"MOVSW",
"MOVSWW",
"MOVUPD",
"MOVUPS",
"MOVW",
......@@ -445,6 +492,7 @@ var Anames = []string{
"MOVWLZX",
"MOVWQSX",
"MOVWQZX",
"MOVZWW",
"MPSADBW",
"MULB",
"MULL",
......@@ -456,10 +504,13 @@ var Anames = []string{
"MULW",
"MULXL",
"MULXQ",
"MWAIT",
"NEGB",
"NEGL",
"NEGQ",
"NEGW",
"NOPL",
"NOPW",
"NOTB",
"NOTL",
"NOTQ",
......@@ -497,6 +548,7 @@ var Anames = []string{
"PAUSE",
"PAVGB",
"PAVGW",
"PBLENDVB",
"PBLENDW",
"PCLMULQDQ",
"PCMPEQB",
......@@ -637,9 +689,21 @@ var Anames = []string{
"RCRL",
"RCRQ",
"RCRW",
"RDFSBASEL",
"RDFSBASEQ",
"RDGSBASEL",
"RDGSBASEQ",
"RDMSR",
"RDPKRU",
"RDPMC",
"RDRANDL",
"RDRANDQ",
"RDRANDW",
"RDSEEDL",
"RDSEEDQ",
"RDSEEDW",
"RDTSC",
"RDTSCP",
"REP",
"REPN",
"RETFL",
......@@ -698,6 +762,14 @@ var Anames = []string{
"SETPL",
"SETPS",
"SFENCE",
"SGDT",
"SHA1MSG1",
"SHA1MSG2",
"SHA1NEXTE",
"SHA1RNDS4",
"SHA256MSG1",
"SHA256MSG2",
"SHA256RNDS2",
"SHLB",
"SHLL",
"SHLQ",
......@@ -712,10 +784,18 @@ var Anames = []string{
"SHRXQ",
"SHUFPD",
"SHUFPS",
"SIDT",
"SLDTL",
"SLDTQ",
"SLDTW",
"SMSWL",
"SMSWQ",
"SMSWW",
"SQRTPD",
"SQRTPS",
"SQRTSD",
"SQRTSS",
"STAC",
"STC",
"STD",
"STI",
......@@ -724,6 +804,9 @@ var Anames = []string{
"STOSL",
"STOSQ",
"STOSW",
"STRL",
"STRQ",
"STRW",
"SUBB",
"SUBL",
"SUBPD",
......@@ -734,13 +817,22 @@ var Anames = []string{
"SUBW",
"SWAPGS",
"SYSCALL",
"SYSENTER",
"SYSENTER64",
"SYSEXIT",
"SYSEXIT64",
"SYSRET",
"TESTB",
"TESTL",
"TESTQ",
"TESTW",
"TZCNTL",
"TZCNTQ",
"TZCNTW",
"UCOMISD",
"UCOMISS",
"UD1",
"UD2",
"UNPCKHPD",
"UNPCKHPS",
"UNPCKLPD",
......@@ -1108,7 +1200,12 @@ var Anames = []string{
"WAIT",
"WBINVD",
"WORD",
"WRFSBASEL",
"WRFSBASEQ",
"WRGSBASEL",
"WRGSBASEQ",
"WRMSR",
"WRPKRU",
"XABORT",
"XACQUIRE",
"XADDB",
......@@ -1130,6 +1227,19 @@ var Anames = []string{
"XORQ",
"XORW",
"XRELEASE",
"XRSTOR",
"XRSTOR64",
"XRSTORS",
"XRSTORS64",
"XSAVE",
"XSAVE64",
"XSAVEC",
"XSAVEC64",
"XSAVEOPT",
"XSAVEOPT64",
"XSAVES",
"XSAVES64",
"XSETBV",
"XTEST",
"LAST",
}
This diff is collapsed.
......@@ -1186,54 +1186,87 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA
}
var unaryDst = map[obj.As]bool{
ABSWAPL: true,
ABSWAPQ: true,
ACLFLUSH: true,
ACMPXCHG8B: true,
ADECB: true,
ADECL: true,
ADECQ: true,
ADECW: true,
AINCB: true,
AINCL: true,
AINCQ: true,
AINCW: true,
ANEGB: true,
ANEGL: true,
ANEGQ: true,
ANEGW: true,
ANOTB: true,
ANOTL: true,
ANOTQ: true,
ANOTW: true,
APOPL: true,
APOPQ: true,
APOPW: true,
ASETCC: true,
ASETCS: true,
ASETEQ: true,
ASETGE: true,
ASETGT: true,
ASETHI: true,
ASETLE: true,
ASETLS: true,
ASETLT: true,
ASETMI: true,
ASETNE: true,
ASETOC: true,
ASETOS: true,
ASETPC: true,
ASETPL: true,
ASETPS: true,
AFFREE: true,
AFLDENV: true,
AFSAVE: true,
AFSTCW: true,
AFSTENV: true,
AFSTSW: true,
AFXSAVE: true,
AFXSAVE64: true,
ASTMXCSR: true,
ABSWAPL: true,
ABSWAPQ: true,
ABSWAPW: true,
ACLFLUSH: true,
ACLFLUSHOPT: true,
ACMPXCHG16B: true,
ACMPXCHG8B: true,
ADECB: true,
ADECL: true,
ADECQ: true,
ADECW: true,
AFBSTP: true,
AFFREE: true,
AFLDENV: true,
AFSAVE: true,
AFSTCW: true,
AFSTENV: true,
AFSTSW: true,
AFXSAVE64: true,
AFXSAVE: true,
AINCB: true,
AINCL: true,
AINCQ: true,
AINCW: true,
ANEGB: true,
ANEGL: true,
ANEGQ: true,
ANEGW: true,
ANOTB: true,
ANOTL: true,
ANOTQ: true,
ANOTW: true,
APOPL: true,
APOPQ: true,
APOPW: true,
ARDFSBASEL: true,
ARDFSBASEQ: true,
ARDGSBASEL: true,
ARDGSBASEQ: true,
ARDRANDL: true,
ARDRANDQ: true,
ARDRANDW: true,
ARDSEEDL: true,
ARDSEEDQ: true,
ARDSEEDW: true,
ASETCC: true,
ASETCS: true,
ASETEQ: true,
ASETGE: true,
ASETGT: true,
ASETHI: true,
ASETLE: true,
ASETLS: true,
ASETLT: true,
ASETMI: true,
ASETNE: true,
ASETOC: true,
ASETOS: true,
ASETPC: true,
ASETPL: true,
ASETPS: true,
ASGDT: true,
ASIDT: true,
ASLDTL: true,
ASLDTQ: true,
ASLDTW: true,
ASMSWL: true,
ASMSWQ: true,
ASMSWW: true,
ASTMXCSR: true,
ASTRL: true,
ASTRQ: true,
ASTRW: true,
AXSAVE64: true,
AXSAVE: true,
AXSAVEC64: true,
AXSAVEC: true,
AXSAVEOPT64: true,
AXSAVEOPT: true,
AXSAVES64: true,
AXSAVES: true,
}
var Linkamd64 = obj.LinkArch{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment