// Inferno utils/8a/lex.c
// http://code.google.com/p/inferno-os/source/browse/utils/8a/lex.c
//
//	Copyright © 1994-1999 Lucent Technologies Inc.	All rights reserved.
//	Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
//	Portions Copyright © 1997-1999 Vita Nuova Limited
//	Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
//	Portions Copyright © 2004,2006 Bruce Ellis
//	Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
//	Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
//	Portions Copyright © 2009 The Go Authors.  All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//go:generate go tool yacc a.y

package main

import (
	"cmd/internal/asm"
	"cmd/internal/obj"
	"cmd/internal/obj/x86"
)

var (
	yyerror  = asm.Yyerror
	nullgen  obj.Addr
	stmtline int32
)

func main() {
	cinit()

	asm.LSCONST = LSCONST
	asm.LCONST = LCONST
	asm.LFCONST = LFCONST
	asm.LNAME = LNAME
	asm.LVAR = LVAR
	asm.LLAB = LLAB

	asm.Lexinit = lexinit
	asm.Cclean = cclean
	asm.Yyparse = yyparse

	asm.Thechar = '8'
	asm.Thestring = "386"
	asm.Thelinkarch = &x86.Link386

	asm.Main()
}

type yy struct{}

func (yy) Lex(v *yySymType) int {
	var av asm.Yylval
	tok := asm.Yylex(&av)
	v.sym = av.Sym
	v.lval = av.Lval
	v.sval = av.Sval
	v.dval = av.Dval
	return tok
}

func (yy) Error(msg string) {
	asm.Yyerror("%s", msg)
}

func yyparse() {
	yyParse(yy{})
}

var lexinit = []asm.Lextab{
	{"SP", LSP, obj.NAME_AUTO},
	{"SB", LSB, obj.NAME_EXTERN},
	{"FP", LFP, obj.NAME_PARAM},
	{"PC", LPC, obj.TYPE_BRANCH},
	{"AL", LBREG, x86.REG_AL},
	{"CL", LBREG, x86.REG_CL},
	{"DL", LBREG, x86.REG_DL},
	{"BL", LBREG, x86.REG_BL},
	{"AH", LBREG, x86.REG_AH},
	{"CH", LBREG, x86.REG_CH},
	{"DH", LBREG, x86.REG_DH},
	{"BH", LBREG, x86.REG_BH},
	{"AX", LLREG, x86.REG_AX},
	{"CX", LLREG, x86.REG_CX},
	{"DX", LLREG, x86.REG_DX},
	{"BX", LLREG, x86.REG_BX},
	/*	"SP",		LLREG,	REG_SP,	*/
	{"BP", LLREG, x86.REG_BP},
	{"SI", LLREG, x86.REG_SI},
	{"DI", LLREG, x86.REG_DI},
	{"F0", LFREG, x86.REG_F0 + 0},
	{"F1", LFREG, x86.REG_F0 + 1},
	{"F2", LFREG, x86.REG_F0 + 2},
	{"F3", LFREG, x86.REG_F0 + 3},
	{"F4", LFREG, x86.REG_F0 + 4},
	{"F5", LFREG, x86.REG_F0 + 5},
	{"F6", LFREG, x86.REG_F0 + 6},
	{"F7", LFREG, x86.REG_F0 + 7},
	{"X0", LXREG, x86.REG_X0 + 0},
	{"X1", LXREG, x86.REG_X0 + 1},
	{"X2", LXREG, x86.REG_X0 + 2},
	{"X3", LXREG, x86.REG_X0 + 3},
	{"X4", LXREG, x86.REG_X0 + 4},
	{"X5", LXREG, x86.REG_X0 + 5},
	{"X6", LXREG, x86.REG_X0 + 6},
	{"X7", LXREG, x86.REG_X0 + 7},
	{"CS", LSREG, x86.REG_CS},
	{"SS", LSREG, x86.REG_SS},
	{"DS", LSREG, x86.REG_DS},
	{"ES", LSREG, x86.REG_ES},
	{"FS", LSREG, x86.REG_FS},
	{"GS", LSREG, x86.REG_GS},
	{"TLS", LSREG, x86.REG_TLS},
	{"GDTR", LBREG, x86.REG_GDTR},
	{"IDTR", LBREG, x86.REG_IDTR},
	{"LDTR", LBREG, x86.REG_LDTR},
	{"MSW", LBREG, x86.REG_MSW},
	{"TASK", LBREG, x86.REG_TASK},
	{"CR0", LBREG, x86.REG_CR + 0},
	{"CR1", LBREG, x86.REG_CR + 1},
	{"CR2", LBREG, x86.REG_CR + 2},
	{"CR3", LBREG, x86.REG_CR + 3},
	{"CR4", LBREG, x86.REG_CR + 4},
	{"CR5", LBREG, x86.REG_CR + 5},
	{"CR6", LBREG, x86.REG_CR + 6},
	{"CR7", LBREG, x86.REG_CR + 7},
	{"DR0", LBREG, x86.REG_DR + 0},
	{"DR1", LBREG, x86.REG_DR + 1},
	{"DR2", LBREG, x86.REG_DR + 2},
	{"DR3", LBREG, x86.REG_DR + 3},
	{"DR4", LBREG, x86.REG_DR + 4},
	{"DR5", LBREG, x86.REG_DR + 5},
	{"DR6", LBREG, x86.REG_DR + 6},
	{"DR7", LBREG, x86.REG_DR + 7},
	{"TR0", LBREG, x86.REG_TR + 0},
	{"TR1", LBREG, x86.REG_TR + 1},
	{"TR2", LBREG, x86.REG_TR + 2},
	{"TR3", LBREG, x86.REG_TR + 3},
	{"TR4", LBREG, x86.REG_TR + 4},
	{"TR5", LBREG, x86.REG_TR + 5},
	{"TR6", LBREG, x86.REG_TR + 6},
	{"TR7", LBREG, x86.REG_TR + 7},
	{"AAA", LTYPE0, x86.AAAA},
	{"AAD", LTYPE0, x86.AAAD},
	{"AAM", LTYPE0, x86.AAAM},
	{"AAS", LTYPE0, x86.AAAS},
	{"ADCB", LTYPE3, x86.AADCB},
	{"ADCL", LTYPE3, x86.AADCL},
	{"ADCW", LTYPE3, x86.AADCW},
	{"ADDB", LTYPE3, x86.AADDB},
	{"ADDL", LTYPE3, x86.AADDL},
	{"ADDW", LTYPE3, x86.AADDW},
	{"ADJSP", LTYPE2, x86.AADJSP},
	{"ANDB", LTYPE3, x86.AANDB},
	{"ANDL", LTYPE3, x86.AANDL},
	{"ANDW", LTYPE3, x86.AANDW},
	{"ARPL", LTYPE3, x86.AARPL},
	{"BOUNDL", LTYPE3, x86.ABOUNDL},
	{"BOUNDW", LTYPE3, x86.ABOUNDW},
	{"BSFL", LTYPE3, x86.ABSFL},
	{"BSFW", LTYPE3, x86.ABSFW},
	{"BSRL", LTYPE3, x86.ABSRL},
	{"BSRW", LTYPE3, x86.ABSRW},
	{"BSWAPL", LTYPE1, x86.ABSWAPL},
	{"BTCL", LTYPE3, x86.ABTCL},
	{"BTCW", LTYPE3, x86.ABTCW},
	{"BTL", LTYPE3, x86.ABTL},
	{"BTRL", LTYPE3, x86.ABTRL},
	{"BTRW", LTYPE3, x86.ABTRW},
	{"BTSL", LTYPE3, x86.ABTSL},
	{"BTSW", LTYPE3, x86.ABTSW},
	{"BTW", LTYPE3, x86.ABTW},
	{"BYTE", LTYPE2, x86.ABYTE},
	{"CALL", LTYPEC, obj.ACALL},
	{"CLC", LTYPE0, x86.ACLC},
	{"CLD", LTYPE0, x86.ACLD},
	{"CLI", LTYPE0, x86.ACLI},
	{"CLTS", LTYPE0, x86.ACLTS},
	{"CMC", LTYPE0, x86.ACMC},
	{"CMPB", LTYPE4, x86.ACMPB},
	{"CMPL", LTYPE4, x86.ACMPL},
	{"CMPW", LTYPE4, x86.ACMPW},
	{"CMPSB", LTYPE0, x86.ACMPSB},
	{"CMPSL", LTYPE0, x86.ACMPSL},
	{"CMPSW", LTYPE0, x86.ACMPSW},
	{"CMPXCHG8B", LTYPE1, x86.ACMPXCHG8B},
	{"CMPXCHGB", LTYPE3, x86.ACMPXCHGB},
	{"CMPXCHGL", LTYPE3, x86.ACMPXCHGL},
	{"CMPXCHGW", LTYPE3, x86.ACMPXCHGW},
	{"CPUID", LTYPE0, x86.ACPUID},
	{"DAA", LTYPE0, x86.ADAA},
	{"DAS", LTYPE0, x86.ADAS},
	{"DATA", LTYPED, obj.ADATA},
	{"DECB", LTYPE1, x86.ADECB},
	{"DECL", LTYPE1, x86.ADECL},
	{"DECW", LTYPE1, x86.ADECW},
	{"DIVB", LTYPE2, x86.ADIVB},
	{"DIVL", LTYPE2, x86.ADIVL},
	{"DIVW", LTYPE2, x86.ADIVW},
	{"END", LTYPE0, obj.AEND},
	{"ENTER", LTYPE2, x86.AENTER},
	{"GLOBL", LTYPEG, obj.AGLOBL},
	{"HLT", LTYPE0, x86.AHLT},
	{"IDIVB", LTYPE2, x86.AIDIVB},
	{"IDIVL", LTYPE2, x86.AIDIVL},
	{"IDIVW", LTYPE2, x86.AIDIVW},
	{"IMULB", LTYPE2, x86.AIMULB},
	{"IMULL", LTYPEI, x86.AIMULL},
	{"IMULW", LTYPEI, x86.AIMULW},
	{"INB", LTYPE0, x86.AINB},
	{"INL", LTYPE0, x86.AINL},
	{"INW", LTYPE0, x86.AINW},
	{"INCB", LTYPE1, x86.AINCB},
	{"INCL", LTYPE1, x86.AINCL},
	{"INCW", LTYPE1, x86.AINCW},
	{"INSB", LTYPE0, x86.AINSB},
	{"INSL", LTYPE0, x86.AINSL},
	{"INSW", LTYPE0, x86.AINSW},
	{"INT", LTYPE2, x86.AINT},
	{"INTO", LTYPE0, x86.AINTO},
	{"IRETL", LTYPE0, x86.AIRETL},
	{"IRETW", LTYPE0, x86.AIRETW},
	{"JOS", LTYPER, x86.AJOS},  /* overflow set (OF = 1) */
	{"JO", LTYPER, x86.AJOS},   /* alternate */
	{"JOC", LTYPER, x86.AJOC},  /* overflow clear (OF = 0) */
	{"JNO", LTYPER, x86.AJOC},  /* alternate */
	{"JCS", LTYPER, x86.AJCS},  /* carry set (CF = 1) */
	{"JB", LTYPER, x86.AJCS},   /* alternate */
	{"JC", LTYPER, x86.AJCS},   /* alternate */
	{"JNAE", LTYPER, x86.AJCS}, /* alternate */
	{"JLO", LTYPER, x86.AJCS},  /* alternate */
	{"JCC", LTYPER, x86.AJCC},  /* carry clear (CF = 0) */
	{"JAE", LTYPER, x86.AJCC},  /* alternate */
	{"JNB", LTYPER, x86.AJCC},  /* alternate */
	{"JNC", LTYPER, x86.AJCC},  /* alternate */
	{"JHS", LTYPER, x86.AJCC},  /* alternate */
	{"JEQ", LTYPER, x86.AJEQ},  /* equal (ZF = 1) */
	{"JE", LTYPER, x86.AJEQ},   /* alternate */
	{"JZ", LTYPER, x86.AJEQ},   /* alternate */
	{"JNE", LTYPER, x86.AJNE},  /* not equal (ZF = 0) */
	{"JNZ", LTYPER, x86.AJNE},  /* alternate */
	{"JLS", LTYPER, x86.AJLS},  /* lower or same (unsigned) (CF = 1 || ZF = 1) */
	{"JBE", LTYPER, x86.AJLS},  /* alternate */
	{"JNA", LTYPER, x86.AJLS},  /* alternate */
	{"JHI", LTYPER, x86.AJHI},  /* higher (unsigned) (CF = 0 && ZF = 0) */
	{"JA", LTYPER, x86.AJHI},   /* alternate */
	{"JNBE", LTYPER, x86.AJHI}, /* alternate */
	{"JMI", LTYPER, x86.AJMI},  /* negative (minus) (SF = 1) */
	{"JS", LTYPER, x86.AJMI},   /* alternate */
	{"JPL", LTYPER, x86.AJPL},  /* non-negative (plus) (SF = 0) */
	{"JNS", LTYPER, x86.AJPL},  /* alternate */
	{"JPS", LTYPER, x86.AJPS},  /* parity set (PF = 1) */
	{"JP", LTYPER, x86.AJPS},   /* alternate */
	{"JPE", LTYPER, x86.AJPS},  /* alternate */
	{"JPC", LTYPER, x86.AJPC},  /* parity clear (PF = 0) */
	{"JNP", LTYPER, x86.AJPC},  /* alternate */
	{"JPO", LTYPER, x86.AJPC},  /* alternate */
	{"JLT", LTYPER, x86.AJLT},  /* less than (signed) (SF != OF) */
	{"JL", LTYPER, x86.AJLT},   /* alternate */
	{"JNGE", LTYPER, x86.AJLT}, /* alternate */
	{"JGE", LTYPER, x86.AJGE},  /* greater than or equal (signed) (SF = OF) */
	{"JNL", LTYPER, x86.AJGE},  /* alternate */
	{"JLE", LTYPER, x86.AJLE},  /* less than or equal (signed) (ZF = 1 || SF != OF) */
	{"JNG", LTYPER, x86.AJLE},  /* alternate */
	{"JGT", LTYPER, x86.AJGT},  /* greater than (signed) (ZF = 0 && SF = OF) */
	{"JG", LTYPER, x86.AJGT},   /* alternate */
	{"JNLE", LTYPER, x86.AJGT}, /* alternate */
	{"JCXZL", LTYPER, x86.AJCXZL},
	{"JCXZW", LTYPER, x86.AJCXZW},
	{"JMP", LTYPEC, obj.AJMP},
	{"LAHF", LTYPE0, x86.ALAHF},
	{"LARL", LTYPE3, x86.ALARL},
	{"LARW", LTYPE3, x86.ALARW},
	{"LEAL", LTYPE3, x86.ALEAL},
	{"LEAW", LTYPE3, x86.ALEAW},
	{"LEAVEL", LTYPE0, x86.ALEAVEL},
	{"LEAVEW", LTYPE0, x86.ALEAVEW},
	{"LOCK", LTYPE0, x86.ALOCK},
	{"LODSB", LTYPE0, x86.ALODSB},
	{"LODSL", LTYPE0, x86.ALODSL},
	{"LODSW", LTYPE0, x86.ALODSW},
	{"LONG", LTYPE2, x86.ALONG},
	{"LOOP", LTYPER, x86.ALOOP},
	{"LOOPEQ", LTYPER, x86.ALOOPEQ},
	{"LOOPNE", LTYPER, x86.ALOOPNE},
	{"LSLL", LTYPE3, x86.ALSLL},
	{"LSLW", LTYPE3, x86.ALSLW},
	{"MOVB", LTYPE3, x86.AMOVB},
	{"MOVL", LTYPEM, x86.AMOVL},
	{"MOVW", LTYPEM, x86.AMOVW},
	{"MOVQ", LTYPEM, x86.AMOVQ},
	{"MOVBLSX", LTYPE3, x86.AMOVBLSX},
	{"MOVBLZX", LTYPE3, x86.AMOVBLZX},
	{"MOVBWSX", LTYPE3, x86.AMOVBWSX},
	{"MOVBWZX", LTYPE3, x86.AMOVBWZX},
	{"MOVWLSX", LTYPE3, x86.AMOVWLSX},
	{"MOVWLZX", LTYPE3, x86.AMOVWLZX},
	{"MOVSB", LTYPE0, x86.AMOVSB},
	{"MOVSL", LTYPE0, x86.AMOVSL},
	{"MOVSW", LTYPE0, x86.AMOVSW},
	{"MULB", LTYPE2, x86.AMULB},
	{"MULL", LTYPE2, x86.AMULL},
	{"MULW", LTYPE2, x86.AMULW},
	{"NEGB", LTYPE1, x86.ANEGB},
	{"NEGL", LTYPE1, x86.ANEGL},
	{"NEGW", LTYPE1, x86.ANEGW},
	{"NOP", LTYPEN, obj.ANOP},
	{"NOTB", LTYPE1, x86.ANOTB},
	{"NOTL", LTYPE1, x86.ANOTL},
	{"NOTW", LTYPE1, x86.ANOTW},
	{"ORB", LTYPE3, x86.AORB},
	{"ORL", LTYPE3, x86.AORL},
	{"ORW", LTYPE3, x86.AORW},
	{"OUTB", LTYPE0, x86.AOUTB},
	{"OUTL", LTYPE0, x86.AOUTL},
	{"OUTW", LTYPE0, x86.AOUTW},
	{"OUTSB", LTYPE0, x86.AOUTSB},
	{"OUTSL", LTYPE0, x86.AOUTSL},
	{"OUTSW", LTYPE0, x86.AOUTSW},
	{"PAUSE", LTYPEN, x86.APAUSE},
	{"PINSRD", LTYPEX, x86.APINSRD},
	{"POPAL", LTYPE0, x86.APOPAL},
	{"POPAW", LTYPE0, x86.APOPAW},
	{"POPFL", LTYPE0, x86.APOPFL},
	{"POPFW", LTYPE0, x86.APOPFW},
	{"POPL", LTYPE1, x86.APOPL},
	{"POPW", LTYPE1, x86.APOPW},
	{"PUSHAL", LTYPE0, x86.APUSHAL},
	{"PUSHAW", LTYPE0, x86.APUSHAW},
	{"PUSHFL", LTYPE0, x86.APUSHFL},
	{"PUSHFW", LTYPE0, x86.APUSHFW},
	{"PUSHL", LTYPE2, x86.APUSHL},
	{"PUSHW", LTYPE2, x86.APUSHW},
	{"RCLB", LTYPE3, x86.ARCLB},
	{"RCLL", LTYPE3, x86.ARCLL},
	{"RCLW", LTYPE3, x86.ARCLW},
	{"RCRB", LTYPE3, x86.ARCRB},
	{"RCRL", LTYPE3, x86.ARCRL},
	{"RCRW", LTYPE3, x86.ARCRW},
	{"RDTSC", LTYPE0, x86.ARDTSC},
	{"REP", LTYPE0, x86.AREP},
	{"REPN", LTYPE0, x86.AREPN},
	{"RET", LTYPE0, obj.ARET},
	{"ROLB", LTYPE3, x86.AROLB},
	{"ROLL", LTYPE3, x86.AROLL},
	{"ROLW", LTYPE3, x86.AROLW},
	{"RORB", LTYPE3, x86.ARORB},
	{"RORL", LTYPE3, x86.ARORL},
	{"RORW", LTYPE3, x86.ARORW},
	{"SAHF", LTYPE0, x86.ASAHF},
	{"SALB", LTYPE3, x86.ASALB},
	{"SALL", LTYPE3, x86.ASALL},
	{"SALW", LTYPE3, x86.ASALW},
	{"SARB", LTYPE3, x86.ASARB},
	{"SARL", LTYPE3, x86.ASARL},
	{"SARW", LTYPE3, x86.ASARW},
	{"SBBB", LTYPE3, x86.ASBBB},
	{"SBBL", LTYPE3, x86.ASBBL},
	{"SBBW", LTYPE3, x86.ASBBW},
	{"SCASB", LTYPE0, x86.ASCASB},
	{"SCASL", LTYPE0, x86.ASCASL},
	{"SCASW", LTYPE0, x86.ASCASW},
	{"SETCC", LTYPE1, x86.ASETCC}, /* see JCC etc above for condition codes */
	{"SETCS", LTYPE1, x86.ASETCS},
	{"SETEQ", LTYPE1, x86.ASETEQ},
	{"SETGE", LTYPE1, x86.ASETGE},
	{"SETGT", LTYPE1, x86.ASETGT},
	{"SETHI", LTYPE1, x86.ASETHI},
	{"SETLE", LTYPE1, x86.ASETLE},
	{"SETLS", LTYPE1, x86.ASETLS},
	{"SETLT", LTYPE1, x86.ASETLT},
	{"SETMI", LTYPE1, x86.ASETMI},
	{"SETNE", LTYPE1, x86.ASETNE},
	{"SETOC", LTYPE1, x86.ASETOC},
	{"SETOS", LTYPE1, x86.ASETOS},
	{"SETPC", LTYPE1, x86.ASETPC},
	{"SETPL", LTYPE1, x86.ASETPL},
	{"SETPS", LTYPE1, x86.ASETPS},
	{"CDQ", LTYPE0, x86.ACDQ},
	{"CWD", LTYPE0, x86.ACWD},
	{"SHLB", LTYPE3, x86.ASHLB},
	{"SHLL", LTYPES, x86.ASHLL},
	{"SHLW", LTYPES, x86.ASHLW},
	{"SHRB", LTYPE3, x86.ASHRB},
	{"SHRL", LTYPES, x86.ASHRL},
	{"SHRW", LTYPES, x86.ASHRW},
	{"STC", LTYPE0, x86.ASTC},
	{"STD", LTYPE0, x86.ASTD},
	{"STI", LTYPE0, x86.ASTI},
	{"STOSB", LTYPE0, x86.ASTOSB},
	{"STOSL", LTYPE0, x86.ASTOSL},
	{"STOSW", LTYPE0, x86.ASTOSW},
	{"SUBB", LTYPE3, x86.ASUBB},
	{"SUBL", LTYPE3, x86.ASUBL},
	{"SUBW", LTYPE3, x86.ASUBW},
	{"SYSCALL", LTYPE0, x86.ASYSCALL},
	{"TESTB", LTYPE3, x86.ATESTB},
	{"TESTL", LTYPE3, x86.ATESTL},
	{"TESTW", LTYPE3, x86.ATESTW},
	{"TEXT", LTYPET, obj.ATEXT},
	{"VERR", LTYPE2, x86.AVERR},
	{"VERW", LTYPE2, x86.AVERW},
	{"WAIT", LTYPE0, x86.AWAIT},
	{"WORD", LTYPE2, x86.AWORD},
	{"XADDB", LTYPE3, x86.AXADDB},
	{"XADDL", LTYPE3, x86.AXADDL},
	{"XADDW", LTYPE3, x86.AXADDW},
	{"XCHGB", LTYPE3, x86.AXCHGB},
	{"XCHGL", LTYPE3, x86.AXCHGL},
	{"XCHGW", LTYPE3, x86.AXCHGW},
	{"XLAT", LTYPE2, x86.AXLAT},
	{"XORB", LTYPE3, x86.AXORB},
	{"XORL", LTYPE3, x86.AXORL},
	{"XORW", LTYPE3, x86.AXORW},
	{"CMOVLCC", LTYPE3, x86.ACMOVLCC},
	{"CMOVLCS", LTYPE3, x86.ACMOVLCS},
	{"CMOVLEQ", LTYPE3, x86.ACMOVLEQ},
	{"CMOVLGE", LTYPE3, x86.ACMOVLGE},
	{"CMOVLGT", LTYPE3, x86.ACMOVLGT},
	{"CMOVLHI", LTYPE3, x86.ACMOVLHI},
	{"CMOVLLE", LTYPE3, x86.ACMOVLLE},
	{"CMOVLLS", LTYPE3, x86.ACMOVLLS},
	{"CMOVLLT", LTYPE3, x86.ACMOVLLT},
	{"CMOVLMI", LTYPE3, x86.ACMOVLMI},
	{"CMOVLNE", LTYPE3, x86.ACMOVLNE},
	{"CMOVLOC", LTYPE3, x86.ACMOVLOC},
	{"CMOVLOS", LTYPE3, x86.ACMOVLOS},
	{"CMOVLPC", LTYPE3, x86.ACMOVLPC},
	{"CMOVLPL", LTYPE3, x86.ACMOVLPL},
	{"CMOVLPS", LTYPE3, x86.ACMOVLPS},
	{"CMOVWCC", LTYPE3, x86.ACMOVWCC},
	{"CMOVWCS", LTYPE3, x86.ACMOVWCS},
	{"CMOVWEQ", LTYPE3, x86.ACMOVWEQ},
	{"CMOVWGE", LTYPE3, x86.ACMOVWGE},
	{"CMOVWGT", LTYPE3, x86.ACMOVWGT},
	{"CMOVWHI", LTYPE3, x86.ACMOVWHI},
	{"CMOVWLE", LTYPE3, x86.ACMOVWLE},
	{"CMOVWLS", LTYPE3, x86.ACMOVWLS},
	{"CMOVWLT", LTYPE3, x86.ACMOVWLT},
	{"CMOVWMI", LTYPE3, x86.ACMOVWMI},
	{"CMOVWNE", LTYPE3, x86.ACMOVWNE},
	{"CMOVWOC", LTYPE3, x86.ACMOVWOC},
	{"CMOVWOS", LTYPE3, x86.ACMOVWOS},
	{"CMOVWPC", LTYPE3, x86.ACMOVWPC},
	{"CMOVWPL", LTYPE3, x86.ACMOVWPL},
	{"CMOVWPS", LTYPE3, x86.ACMOVWPS},
	{"FMOVB", LTYPE3, x86.AFMOVB},
	{"FMOVBP", LTYPE3, x86.AFMOVBP},
	{"FMOVD", LTYPE3, x86.AFMOVD},
	{"FMOVDP", LTYPE3, x86.AFMOVDP},
	{"FMOVF", LTYPE3, x86.AFMOVF},
	{"FMOVFP", LTYPE3, x86.AFMOVFP},
	{"FMOVL", LTYPE3, x86.AFMOVL},
	{"FMOVLP", LTYPE3, x86.AFMOVLP},
	{"FMOVV", LTYPE3, x86.AFMOVV},
	{"FMOVVP", LTYPE3, x86.AFMOVVP},
	{"FMOVW", LTYPE3, x86.AFMOVW},
	{"FMOVWP", LTYPE3, x86.AFMOVWP},
	{"FMOVX", LTYPE3, x86.AFMOVX},
	{"FMOVXP", LTYPE3, x86.AFMOVXP},
	{"FCMOVCC", LTYPE3, x86.AFCMOVCC},
	{"FCMOVCS", LTYPE3, x86.AFCMOVCS},
	{"FCMOVEQ", LTYPE3, x86.AFCMOVEQ},
	{"FCMOVHI", LTYPE3, x86.AFCMOVHI},
	{"FCMOVLS", LTYPE3, x86.AFCMOVLS},
	{"FCMOVNE", LTYPE3, x86.AFCMOVNE},
	{"FCMOVNU", LTYPE3, x86.AFCMOVNU},
	{"FCMOVUN", LTYPE3, x86.AFCMOVUN},
	{"FCOMB", LTYPE3, x86.AFCOMB},
	{"FCOMBP", LTYPE3, x86.AFCOMBP},
	{"FCOMD", LTYPE3, x86.AFCOMD},
	{"FCOMDP", LTYPE3, x86.AFCOMDP},
	{"FCOMDPP", LTYPE3, x86.AFCOMDPP},
	{"FCOMF", LTYPE3, x86.AFCOMF},
	{"FCOMFP", LTYPE3, x86.AFCOMFP},
	{"FCOMI", LTYPE3, x86.AFCOMI},
	{"FCOMIP", LTYPE3, x86.AFCOMIP},
	{"FCOML", LTYPE3, x86.AFCOML},
	{"FCOMLP", LTYPE3, x86.AFCOMLP},
	{"FCOMW", LTYPE3, x86.AFCOMW},
	{"FCOMWP", LTYPE3, x86.AFCOMWP},
	{"FUCOM", LTYPE3, x86.AFUCOM},
	{"FUCOMI", LTYPE3, x86.AFUCOMI},
	{"FUCOMIP", LTYPE3, x86.AFUCOMIP},
	{"FUCOMP", LTYPE3, x86.AFUCOMP},
	{"FUCOMPP", LTYPE3, x86.AFUCOMPP},
	{"FADDW", LTYPE3, x86.AFADDW},
	{"FADDL", LTYPE3, x86.AFADDL},
	{"FADDF", LTYPE3, x86.AFADDF},
	{"FADDD", LTYPE3, x86.AFADDD},
	{"FADDDP", LTYPE3, x86.AFADDDP},
	{"FSUBDP", LTYPE3, x86.AFSUBDP},
	{"FSUBW", LTYPE3, x86.AFSUBW},
	{"FSUBL", LTYPE3, x86.AFSUBL},
	{"FSUBF", LTYPE3, x86.AFSUBF},
	{"FSUBD", LTYPE3, x86.AFSUBD},
	{"FSUBRDP", LTYPE3, x86.AFSUBRDP},
	{"FSUBRW", LTYPE3, x86.AFSUBRW},
	{"FSUBRL", LTYPE3, x86.AFSUBRL},
	{"FSUBRF", LTYPE3, x86.AFSUBRF},
	{"FSUBRD", LTYPE3, x86.AFSUBRD},
	{"FMULDP", LTYPE3, x86.AFMULDP},
	{"FMULW", LTYPE3, x86.AFMULW},
	{"FMULL", LTYPE3, x86.AFMULL},
	{"FMULF", LTYPE3, x86.AFMULF},
	{"FMULD", LTYPE3, x86.AFMULD},
	{"FDIVDP", LTYPE3, x86.AFDIVDP},
	{"FDIVW", LTYPE3, x86.AFDIVW},
	{"FDIVL", LTYPE3, x86.AFDIVL},
	{"FDIVF", LTYPE3, x86.AFDIVF},
	{"FDIVD", LTYPE3, x86.AFDIVD},
	{"FDIVRDP", LTYPE3, x86.AFDIVRDP},
	{"FDIVRW", LTYPE3, x86.AFDIVRW},
	{"FDIVRL", LTYPE3, x86.AFDIVRL},
	{"FDIVRF", LTYPE3, x86.AFDIVRF},
	{"FDIVRD", LTYPE3, x86.AFDIVRD},
	{"FXCHD", LTYPE3, x86.AFXCHD},
	{"FFREE", LTYPE1, x86.AFFREE},
	{"FLDCW", LTYPE2, x86.AFLDCW},
	{"FLDENV", LTYPE1, x86.AFLDENV},
	{"FRSTOR", LTYPE2, x86.AFRSTOR},
	{"FSAVE", LTYPE1, x86.AFSAVE},
	{"FSTCW", LTYPE1, x86.AFSTCW},
	{"FSTENV", LTYPE1, x86.AFSTENV},
	{"FSTSW", LTYPE1, x86.AFSTSW},
	{"F2XM1", LTYPE0, x86.AF2XM1},
	{"FABS", LTYPE0, x86.AFABS},
	{"FCHS", LTYPE0, x86.AFCHS},
	{"FCLEX", LTYPE0, x86.AFCLEX},
	{"FCOS", LTYPE0, x86.AFCOS},
	{"FDECSTP", LTYPE0, x86.AFDECSTP},
	{"FINCSTP", LTYPE0, x86.AFINCSTP},
	{"FINIT", LTYPE0, x86.AFINIT},
	{"FLD1", LTYPE0, x86.AFLD1},
	{"FLDL2E", LTYPE0, x86.AFLDL2E},
	{"FLDL2T", LTYPE0, x86.AFLDL2T},
	{"FLDLG2", LTYPE0, x86.AFLDLG2},
	{"FLDLN2", LTYPE0, x86.AFLDLN2},
	{"FLDPI", LTYPE0, x86.AFLDPI},
	{"FLDZ", LTYPE0, x86.AFLDZ},
	{"FNOP", LTYPE0, x86.AFNOP},
	{"FPATAN", LTYPE0, x86.AFPATAN},
	{"FPREM", LTYPE0, x86.AFPREM},
	{"FPREM1", LTYPE0, x86.AFPREM1},
	{"FPTAN", LTYPE0, x86.AFPTAN},
	{"FRNDINT", LTYPE0, x86.AFRNDINT},
	{"FSCALE", LTYPE0, x86.AFSCALE},
	{"FSIN", LTYPE0, x86.AFSIN},
	{"FSINCOS", LTYPE0, x86.AFSINCOS},
	{"FSQRT", LTYPE0, x86.AFSQRT},
	{"FTST", LTYPE0, x86.AFTST},
	{"FXAM", LTYPE0, x86.AFXAM},
	{"FXTRACT", LTYPE0, x86.AFXTRACT},
	{"FYL2X", LTYPE0, x86.AFYL2X},
	{"FYL2XP1", LTYPE0, x86.AFYL2XP1},
	{"LFENCE", LTYPE0, x86.ALFENCE},
	{"MFENCE", LTYPE0, x86.AMFENCE},
	{"SFENCE", LTYPE0, x86.ASFENCE},
	{"EMMS", LTYPE0, x86.AEMMS},
	{"PREFETCHT0", LTYPE2, x86.APREFETCHT0},
	{"PREFETCHT1", LTYPE2, x86.APREFETCHT1},
	{"PREFETCHT2", LTYPE2, x86.APREFETCHT2},
	{"PREFETCHNTA", LTYPE2, x86.APREFETCHNTA},
	{"UNDEF", LTYPE0, obj.AUNDEF},
	{"ADDPD", LTYPE3, x86.AADDPD},
	{"ADDPS", LTYPE3, x86.AADDPS},
	{"ADDSD", LTYPE3, x86.AADDSD},
	{"ADDSS", LTYPE3, x86.AADDSS},
	{"AESENC", LTYPE3, x86.AAESENC},
	{"ANDNPD", LTYPE3, x86.AANDNPD},
	{"ANDNPS", LTYPE3, x86.AANDNPS},
	{"ANDPD", LTYPE3, x86.AANDPD},
	{"ANDPS", LTYPE3, x86.AANDPS},
	{"CMPPD", LTYPEXC, x86.ACMPPD},
	{"CMPPS", LTYPEXC, x86.ACMPPS},
	{"CMPSD", LTYPEXC, x86.ACMPSD},
	{"CMPSS", LTYPEXC, x86.ACMPSS},
	{"COMISD", LTYPE3, x86.ACOMISD},
	{"COMISS", LTYPE3, x86.ACOMISS},
	{"CVTPL2PD", LTYPE3, x86.ACVTPL2PD},
	{"CVTPL2PS", LTYPE3, x86.ACVTPL2PS},
	{"CVTPD2PL", LTYPE3, x86.ACVTPD2PL},
	{"CVTPD2PS", LTYPE3, x86.ACVTPD2PS},
	{"CVTPS2PL", LTYPE3, x86.ACVTPS2PL},
	{"CVTPS2PD", LTYPE3, x86.ACVTPS2PD},
	{"CVTSD2SL", LTYPE3, x86.ACVTSD2SL},
	{"CVTSD2SS", LTYPE3, x86.ACVTSD2SS},
	{"CVTSL2SD", LTYPE3, x86.ACVTSL2SD},
	{"CVTSL2SS", LTYPE3, x86.ACVTSL2SS},
	{"CVTSS2SD", LTYPE3, x86.ACVTSS2SD},
	{"CVTSS2SL", LTYPE3, x86.ACVTSS2SL},
	{"CVTTPD2PL", LTYPE3, x86.ACVTTPD2PL},
	{"CVTTPS2PL", LTYPE3, x86.ACVTTPS2PL},
	{"CVTTSD2SL", LTYPE3, x86.ACVTTSD2SL},
	{"CVTTSS2SL", LTYPE3, x86.ACVTTSS2SL},
	{"DIVPD", LTYPE3, x86.ADIVPD},
	{"DIVPS", LTYPE3, x86.ADIVPS},
	{"DIVSD", LTYPE3, x86.ADIVSD},
	{"DIVSS", LTYPE3, x86.ADIVSS},
	{"MASKMOVOU", LTYPE3, x86.AMASKMOVOU},
	{"MASKMOVDQU", LTYPE3, x86.AMASKMOVOU}, /* syn */
	{"MAXPD", LTYPE3, x86.AMAXPD},
	{"MAXPS", LTYPE3, x86.AMAXPS},
	{"MAXSD", LTYPE3, x86.AMAXSD},
	{"MAXSS", LTYPE3, x86.AMAXSS},
	{"MINPD", LTYPE3, x86.AMINPD},
	{"MINPS", LTYPE3, x86.AMINPS},
	{"MINSD", LTYPE3, x86.AMINSD},
	{"MINSS", LTYPE3, x86.AMINSS},
	{"MOVAPD", LTYPE3, x86.AMOVAPD},
	{"MOVAPS", LTYPE3, x86.AMOVAPS},
	{"MOVO", LTYPE3, x86.AMOVO},
	{"MOVOA", LTYPE3, x86.AMOVO}, /* syn */
	{"MOVOU", LTYPE3, x86.AMOVOU},
	{"MOVHLPS", LTYPE3, x86.AMOVHLPS},
	{"MOVHPD", LTYPE3, x86.AMOVHPD},
	{"MOVHPS", LTYPE3, x86.AMOVHPS},
	{"MOVLHPS", LTYPE3, x86.AMOVLHPS},
	{"MOVLPD", LTYPE3, x86.AMOVLPD},
	{"MOVLPS", LTYPE3, x86.AMOVLPS},
	{"MOVMSKPD", LTYPE3, x86.AMOVMSKPD},
	{"MOVMSKPS", LTYPE3, x86.AMOVMSKPS},
	{"MOVNTO", LTYPE3, x86.AMOVNTO},
	{"MOVNTDQ", LTYPE3, x86.AMOVNTO}, /* syn */
	{"MOVNTPD", LTYPE3, x86.AMOVNTPD},
	{"MOVNTPS", LTYPE3, x86.AMOVNTPS},
	{"MOVSD", LTYPE3, x86.AMOVSD},
	{"MOVSS", LTYPE3, x86.AMOVSS},
	{"MOVUPD", LTYPE3, x86.AMOVUPD},
	{"MOVUPS", LTYPE3, x86.AMOVUPS},
	{"MULPD", LTYPE3, x86.AMULPD},
	{"MULPS", LTYPE3, x86.AMULPS},
	{"MULSD", LTYPE3, x86.AMULSD},
	{"MULSS", LTYPE3, x86.AMULSS},
	{"ORPD", LTYPE3, x86.AORPD},
	{"ORPS", LTYPE3, x86.AORPS},
	{"PADDQ", LTYPE3, x86.APADDQ},
	{"PAND", LTYPE3, x86.APAND},
	{"PCMPEQB", LTYPE3, x86.APCMPEQB},
	{"PMAXSW", LTYPE3, x86.APMAXSW},
	{"PMAXUB", LTYPE3, x86.APMAXUB},
	{"PMINSW", LTYPE3, x86.APMINSW},
	{"PMINUB", LTYPE3, x86.APMINUB},
	{"PMOVMSKB", LTYPE3, x86.APMOVMSKB},
	{"PSADBW", LTYPE3, x86.APSADBW},
	{"PSHUFB", LTYPE3, x86.APSHUFB},
	{"PSHUFHW", LTYPEX, x86.APSHUFHW},
	{"PSHUFL", LTYPEX, x86.APSHUFL},
	{"PSHUFLW", LTYPEX, x86.APSHUFLW},
	{"PSUBB", LTYPE3, x86.APSUBB},
	{"PSUBL", LTYPE3, x86.APSUBL},
	{"PSUBQ", LTYPE3, x86.APSUBQ},
	{"PSUBSB", LTYPE3, x86.APSUBSB},
	{"PSUBSW", LTYPE3, x86.APSUBSW},
	{"PSUBUSB", LTYPE3, x86.APSUBUSB},
	{"PSUBUSW", LTYPE3, x86.APSUBUSW},
	{"PSUBW", LTYPE3, x86.APSUBW},
	{"PUNPCKHQDQ", LTYPE3, x86.APUNPCKHQDQ},
	{"PUNPCKLQDQ", LTYPE3, x86.APUNPCKLQDQ},
	{"PXOR", LTYPE3, x86.APXOR},
	{"RCPPS", LTYPE3, x86.ARCPPS},
	{"RCPSS", LTYPE3, x86.ARCPSS},
	{"RSQRTPS", LTYPE3, x86.ARSQRTPS},
	{"RSQRTSS", LTYPE3, x86.ARSQRTSS},
	{"SQRTPD", LTYPE3, x86.ASQRTPD},
	{"SQRTPS", LTYPE3, x86.ASQRTPS},
	{"SQRTSD", LTYPE3, x86.ASQRTSD},
	{"SQRTSS", LTYPE3, x86.ASQRTSS},
	{"SUBPD", LTYPE3, x86.ASUBPD},
	{"SUBPS", LTYPE3, x86.ASUBPS},
	{"SUBSD", LTYPE3, x86.ASUBSD},
	{"SUBSS", LTYPE3, x86.ASUBSS},
	{"UCOMISD", LTYPE3, x86.AUCOMISD},
	{"UCOMISS", LTYPE3, x86.AUCOMISS},
	{"UNPCKHPD", LTYPE3, x86.AUNPCKHPD},
	{"UNPCKHPS", LTYPE3, x86.AUNPCKHPS},
	{"UNPCKLPD", LTYPE3, x86.AUNPCKLPD},
	{"UNPCKLPS", LTYPE3, x86.AUNPCKLPS},
	{"XORPD", LTYPE3, x86.AXORPD},
	{"XORPS", LTYPE3, x86.AXORPS},
	{"USEFIELD", LTYPEN, obj.AUSEFIELD},
	{"PCDATA", LTYPEPC, obj.APCDATA},
	{"FUNCDATA", LTYPEF, obj.AFUNCDATA},
}

func cinit() {
	nullgen.Type = x86.REG_NONE
	nullgen.Index = x86.REG_NONE
}

func checkscale(scale int16) {
	switch scale {
	case 1,
		2,
		4,
		8:
		return
	}

	yyerror("scale must be 1248: %d", scale)
}

func syminit(s *asm.Sym) {
	s.Type = LNAME
	s.Value = 0
}

func cclean() {
	var g2 Addr2

	g2.from = nullgen
	g2.to = nullgen
	outcode(obj.AEND, &g2)
}

var lastpc *obj.Prog

type Addr2 struct {
	from obj.Addr
	to   obj.Addr
}

func outcode(a int, g2 *Addr2) {
	var p *obj.Prog
	var pl *obj.Plist

	if asm.Pass == 1 {
		goto out
	}

	p = new(obj.Prog)
	*p = obj.Prog{}
	p.Ctxt = asm.Ctxt
	p.As = int16(a)
	p.Lineno = stmtline
	p.From = g2.from
	p.To = g2.to
	p.Pc = int64(asm.PC)

	if lastpc == nil {
		pl = obj.Linknewplist(asm.Ctxt)
		pl.Firstpc = p
	} else {

		lastpc.Link = p
	}
	lastpc = p

out:
	if a != obj.AGLOBL && a != obj.ADATA {
		asm.PC++
	}
}
