⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i386.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; GCC machine description for IA-32 and x86-64.;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,;; 2001, 2002, 2003;; Free Software Foundation, Inc.;; Mostly by William Schelter.;; x86_64 support added by Jan Hubicka;;;; This file is part of GNU CC.;;;; GNU CC is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;;;; GNU CC is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;; GNU General Public License for more details.;;;; You should have received a copy of the GNU General Public License;; along with GNU CC; see the file COPYING.  If not, write to;; the Free Software Foundation, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.  */;;;; The original PO technology requires these to be ordered by speed,;; so that assigner will pick the fastest.;;;; See file "rtl.def" for documentation on define_insn, match_*, et. al.;;;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code;; updates for most instructions.;;;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register;; constraint letters.;;;; The special asm out single letter directives following a '%' are:;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of;;     operands[1].;; 'L' Print the opcode suffix for a 32-bit integer opcode.;; 'W' Print the opcode suffix for a 16-bit integer opcode.;; 'B' Print the opcode suffix for an 8-bit integer opcode.;; 'Q' Print the opcode suffix for a 64-bit float opcode.;; 'S' Print the opcode suffix for a 32-bit float opcode.;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.;; 'J' Print the appropriate jump operand.;;;; 'b' Print the QImode name of the register for the indicated operand.;;     %b0 would print %al if operands[0] is reg 0.;; 'w' Likewise, print the HImode name of the register.;; 'k' Likewise, print the SImode name of the register.;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.;; 'y' Print "st(0)" instead of "st" as a register.;; UNSPEC usage:(define_constants  [; Relocation specifiers   (UNSPEC_GOT			0)   (UNSPEC_GOTOFF		1)   (UNSPEC_GOTPCREL		2)   (UNSPEC_GOTTPOFF		3)   (UNSPEC_TPOFF		4)   (UNSPEC_NTPOFF		5)   (UNSPEC_DTPOFF		6)   (UNSPEC_GOTNTPOFF		7)   (UNSPEC_INDNTPOFF		8)   ; Prologue support   (UNSPEC_STACK_PROBE		10)   (UNSPEC_STACK_ALLOC		11)   (UNSPEC_SET_GOT		12)   (UNSPEC_SSE_PROLOGUE_SAVE	13)   ; TLS support   (UNSPEC_TP			15)   (UNSPEC_TLS_GD		16)   (UNSPEC_TLS_LD_BASE		17)   ; Other random patterns   (UNSPEC_SCAS			20)   (UNSPEC_SIN			21)   (UNSPEC_COS			22)   (UNSPEC_BSF			23)   (UNSPEC_FNSTSW		24)   (UNSPEC_SAHF			25)   (UNSPEC_FSTCW		26)   (UNSPEC_ADD_CARRY		27)   (UNSPEC_FLDCW		28)   ; For SSE/MMX support:   (UNSPEC_FIX			30)   (UNSPEC_MASKMOV		32)   (UNSPEC_MOVMSK		33)   (UNSPEC_MOVNT		34)   (UNSPEC_MOVA			38)   (UNSPEC_MOVU			39)   (UNSPEC_SHUFFLE		41)   (UNSPEC_RCP			42)   (UNSPEC_RSQRT		43)   (UNSPEC_SFENCE		44)   (UNSPEC_NOP			45)	; prevents combiner cleverness   (UNSPEC_PAVGUSB		49)   (UNSPEC_PFRCP		50)   (UNSPEC_PFRCPIT1		51)   (UNSPEC_PFRCPIT2		52)   (UNSPEC_PFRSQRT		53)   (UNSPEC_PFRSQIT1		54)   (UNSPEC_PSHUFLW		55)   (UNSPEC_PSHUFHW		56)   (UNSPEC_MFENCE		59)   (UNSPEC_LFENCE		60)   (UNSPEC_PSADBW		61)  ])(define_constants  [(UNSPECV_BLOCKAGE		0)   (UNSPECV_EH_RETURN		13)   (UNSPECV_EMMS		31)   (UNSPECV_LDMXCSR		37)   (UNSPECV_STMXCSR		40)   (UNSPECV_FEMMS		46)   (UNSPECV_CLFLUSH		57)  ]);; Insns whose names begin with "x86_" are emitted by gen_FOO calls;; from i386.c.;; In C guard expressions, put expressions which may be compile-time;; constants first.  This allows for better optimization.  For;; example, write "TARGET_64BIT && reload_completed", not;; "reload_completed && TARGET_64BIT".;; Processor type.  This attribute must exactly match the processor_type;; enumeration in i386.h.(define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4"  (const (symbol_ref "ix86_cpu")));; A basic instruction type.  Refinements due to arguments to be;; provided in other attributes.(define_attr "type"  "other,multi,   alu,alu1,negnot,imov,imovx,lea,   incdec,ishift,ishift1,rotate,rotate1,imul,idiv,   icmp,test,ibr,setcc,icmov,   push,pop,call,callv,   str,cld,   fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,   sselog,sseiadd,sseishft,sseimul,   sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,   mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"  (const_string "other"));; Main data type used by the insn(define_attr "mode"  "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"  (const_string "unknown"));; The CPU unit operations uses.(define_attr "unit" "integer,i387,sse,mmx,unknown"  (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")	   (const_string "i387")	 (eq_attr "type" "sselog,sseiadd,sseishft,sseimul,			  sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv")	   (const_string "sse")	 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")	   (const_string "mmx")	 (eq_attr "type" "other")	   (const_string "unknown")]	 (const_string "integer")));; The (bounding maximum) length of an instruction immediate.(define_attr "length_immediate" ""  (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv")	   (const_int 0)	 (eq_attr "unit" "i387,sse,mmx")	   (const_int 0)	 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,			  imul,icmp,push,pop")	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")	 (eq_attr "type" "imov,test")	   (symbol_ref "ix86_attr_length_immediate_default(insn,0)")	 (eq_attr "type" "call")	   (if_then_else (match_operand 0 "constant_call_address_operand" "")	     (const_int 4)	     (const_int 0))	 (eq_attr "type" "callv")	   (if_then_else (match_operand 1 "constant_call_address_operand" "")	     (const_int 4)	     (const_int 0))	 ;; We don't know the size before shorten_branches.  Expect	 ;; the instruction to fit for better scheduling.	 (eq_attr "type" "ibr")	   (const_int 1)	 ]	 (symbol_ref "/* Update immediate_length and other attributes! */		      abort(),1")));; The (bounding maximum) length of an instruction address.(define_attr "length_address" ""  (cond [(eq_attr "type" "str,cld,other,multi,fxch")	   (const_int 0)	 (and (eq_attr "type" "call")	      (match_operand 0 "constant_call_address_operand" ""))	     (const_int 0)	 (and (eq_attr "type" "callv")	      (match_operand 1 "constant_call_address_operand" ""))	     (const_int 0)	 ]	 (symbol_ref "ix86_attr_length_address_default (insn)")));; Set when length prefix is used.(define_attr "prefix_data16" ""  (if_then_else (ior (eq_attr "mode" "HI")		     (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))    (const_int 1)    (const_int 0)));; Set when string REP prefix is used.(define_attr "prefix_rep" ""   (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))    (const_int 1)    (const_int 0)));; Set when 0f opcode prefix is used.(define_attr "prefix_0f" ""  (if_then_else     (eq_attr "type"              "imovx,setcc,icmov,              sselog,sseiadd,sseishft,sseimul,              sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,              mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")    (const_int 1)    (const_int 0)));; Set when modrm byte is used.(define_attr "modrm" ""  (cond [(eq_attr "type" "str,cld")	   (const_int 0)	 (eq_attr "unit" "i387")	   (const_int 0)         (and (eq_attr "type" "incdec")	      (ior (match_operand:SI 1 "register_operand" "")		   (match_operand:HI 1 "register_operand" "")))	   (const_int 0)	 (and (eq_attr "type" "push")	      (not (match_operand 1 "memory_operand" "")))	   (const_int 0)	 (and (eq_attr "type" "pop")	      (not (match_operand 0 "memory_operand" "")))	   (const_int 0)	 (and (eq_attr "type" "imov")	      (and (match_operand 0 "register_operand" "")	           (match_operand 1 "immediate_operand" "")))	   (const_int 0)	 (and (eq_attr "type" "call")	      (match_operand 0 "constant_call_address_operand" ""))	     (const_int 0)	 (and (eq_attr "type" "callv")	      (match_operand 1 "constant_call_address_operand" ""))	     (const_int 0)	 ]	 (const_int 1)));; The (bounding maximum) length of an instruction in bytes.;; ??? fistp is in fact fldcw/fistp/fldcw sequence.  Later we may want;; to split it and compute proper length as for other insns.(define_attr "length" ""  (cond [(eq_attr "type" "other,multi,fistp")	   (const_int 16)	 (eq_attr "type" "fcmp")	   (const_int 4)	 (eq_attr "unit" "i387")	   (plus (const_int 2)		 (plus (attr "prefix_data16")		       (attr "length_address")))]	 (plus (plus (attr "modrm")		     (plus (attr "prefix_0f")			   (const_int 1)))	       (plus (attr "prefix_rep")		     (plus (attr "prefix_data16")			   (plus (attr "length_immediate")				 (attr "length_address")))))));; The `memory' attribute is `none' if no memory is referenced, `load' or;; `store' if there is a simple memory reference therein, or `unknown';; if the instruction is complex.(define_attr "memory" "none,load,store,both,unknown"  (cond [(eq_attr "type" "other,multi,str")	   (const_string "unknown")	 (eq_attr "type" "lea,fcmov,fpspc,cld")	   (const_string "none")	 (eq_attr "type" "fistp")	   (const_string "both")	 (eq_attr "type" "push")	   (if_then_else (match_operand 1 "memory_operand" "")	     (const_string "both")	     (const_string "store"))	 (eq_attr "type" "pop,setcc")	   (if_then_else (match_operand 0 "memory_operand" "")	     (const_string "both")	     (const_string "load"))	 (eq_attr "type" "icmp,test,ssecmp,mmxcmp,fcmp")	   (if_then_else (ior (match_operand 0 "memory_operand" "")			      (match_operand 1 "memory_operand" ""))	     (const_string "load")	     (const_string "none"))	 (eq_attr "type" "ibr")	   (if_then_else (match_operand 0 "memory_operand" "")	     (const_string "load")	     (const_string "none"))	 (eq_attr "type" "call")	   (if_then_else (match_operand 0 "constant_call_address_operand" "")	     (const_string "none")	     (const_string "load"))	 (eq_attr "type" "callv")	   (if_then_else (match_operand 1 "constant_call_address_operand" "")	     (const_string "none")	     (const_string "load"))	 (and (eq_attr "type" "alu1,negnot")	      (match_operand 1 "memory_operand" ""))	   (const_string "both")	 (and (match_operand 0 "memory_operand" "")	      (match_operand 1 "memory_operand" ""))	   (const_string "both")	 (match_operand 0 "memory_operand" "")	   (const_string "store")	 (match_operand 1 "memory_operand" "")	   (const_string "load")	 (and (eq_attr "type"		 "!alu1,negnot,		   imov,imovx,icmp,test,		   fmov,fcmp,fsgn,		   sse,ssemov,ssecmp,ssecvt,		   mmx,mmxmov,mmxcmp,mmxcvt")	      (match_operand 2 "memory_operand" ""))	   (const_string "load")	 (and (eq_attr "type" "icmov")	      (match_operand 3 "memory_operand" ""))	   (const_string "load")	]	(const_string "none")));; Indicates if an instruction has both an immediate and a displacement.(define_attr "imm_disp" "false,true,unknown"  (cond [(eq_attr "type" "other,multi")	   (const_string "unknown")	 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")	      (and (match_operand 0 "memory_displacement_operand" "")		   (match_operand 1 "immediate_operand" "")))	   (const_string "true")	 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")	      (and (match_operand 0 "memory_displacement_operand" "")		   (match_operand 2 "immediate_operand" "")))	   (const_string "true")	]	(const_string "false")));; Indicates if an FP operation has an integer source.(define_attr "fp_int_src" "false,true"  (const_string "false"));; Describe a user's asm statement.(define_asm_attributes  [(set_attr "length" "128")   (set_attr "type" "multi")])(include "pentium.md")(include "ppro.md")(include "k6.md")(include "athlon.md");; Compare instructions.;; All compare insns have expanders that save the operands away without;; actually generating RTL.  The bCOND or sCOND (emitted immediately;; after the cmp) will actually emit the cmpM.(define_expand "cmpdi"  [(set (reg:CC 17)	(compare:CC (match_operand:DI 0 "nonimmediate_operand" "")		    (match_operand:DI 1 "x86_64_general_operand" "")))]  ""{  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    operands[0] = force_reg (DImode, operands[0]);  ix86_compare_op0 = operands[0];  ix86_compare_op1 = operands[1];  DONE;})(define_expand "cmpsi"  [(set (reg:CC 17)	(compare:CC (match_operand:SI 0 "cmpsi_operand" "")		    (match_operand:SI 1 "general_operand" "")))]  ""{  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    operands[0] = force_reg (SImode, operands[0]);  ix86_compare_op0 = operands[0];  ix86_compare_op1 = operands[1];  DONE;})(define_expand "cmphi"  [(set (reg:CC 17)	(compare:CC (match_operand:HI 0 "nonimmediate_operand" "")		    (match_operand:HI 1 "general_operand" "")))]  ""

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -