i386.md

来自「gcc3.2.1源代码」· Markdown 代码 · 共 2,041 行 · 第 1/5 页

MD
2,041 行
字号
		       (match_operand 1 "nonimmediate_operand" "xm")))]  "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))   && GET_MODE (operands[0]) == GET_MODE (operands[1])"  "* return output_fp_compare (insn, operands, 1, 1);"  [(set_attr "type" "sse")   (set_attr "mode" "unknownfp")   (set_attr "athlon_decode" "vector")]);; Move instructions.;; General case of fullword move.(define_expand "movsi"  [(set (match_operand:SI 0 "nonimmediate_operand" "")	(match_operand:SI 1 "general_operand" ""))]  ""  "ix86_expand_move (SImode, operands); DONE;");; Push/pop instructions.  They are separate since autoinc/dec is not a;; general_operand.;;;; %%% We don't use a post-inc memory reference because x86 is not a ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.;; Changing this impacts compiler performance on other non-AUTO_INC_DEC;; targets without our curiosities, and it is just as easy to represent;; this differently.(define_insn "*pushsi2"  [(set (match_operand:SI 0 "push_operand" "=<")	(match_operand:SI 1 "general_no_elim_operand" "ri*m"))]  "!TARGET_64BIT"  "push{l}\t%1"  [(set_attr "type" "push")   (set_attr "mode" "SI")]);; For 64BIT abi we always round up to 8 bytes.(define_insn "*pushsi2_rex64"  [(set (match_operand:SI 0 "push_operand" "=X")	(match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]  "TARGET_64BIT"  "push{q}\t%q1"  [(set_attr "type" "push")   (set_attr "mode" "SI")])(define_insn "*pushsi2_prologue"  [(set (match_operand:SI 0 "push_operand" "=<")	(match_operand:SI 1 "general_no_elim_operand" "ri*m"))   (clobber (mem:BLK (scratch)))]  "!TARGET_64BIT"  "push{l}\t%1"  [(set_attr "type" "push")   (set_attr "mode" "SI")])(define_insn "*popsi1_epilogue"  [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")	(mem:SI (reg:SI 7)))   (set (reg:SI 7)	(plus:SI (reg:SI 7) (const_int 4)))   (clobber (mem:BLK (scratch)))]  "!TARGET_64BIT"  "pop{l}\t%0"  [(set_attr "type" "pop")   (set_attr "mode" "SI")])(define_insn "popsi1"  [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")	(mem:SI (reg:SI 7)))   (set (reg:SI 7)	(plus:SI (reg:SI 7) (const_int 4)))]  "!TARGET_64BIT"  "pop{l}\t%0"  [(set_attr "type" "pop")   (set_attr "mode" "SI")])(define_insn "*movsi_xor"  [(set (match_operand:SI 0 "register_operand" "=r")	(match_operand:SI 1 "const0_operand" "i"))   (clobber (reg:CC 17))]  "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"  "xor{l}\t{%0, %0|%0, %0}"  [(set_attr "type" "alu1")   (set_attr "mode" "SI")   (set_attr "length_immediate" "0")])(define_insn "*movsi_or"  [(set (match_operand:SI 0 "register_operand" "=r")	(match_operand:SI 1 "immediate_operand" "i"))   (clobber (reg:CC 17))]  "reload_completed && GET_CODE (operands[1]) == CONST_INT   && INTVAL (operands[1]) == -1   && (TARGET_PENTIUM || optimize_size)"{  operands[1] = constm1_rtx;  return "or{l}\t{%1, %0|%0, %1}";}  [(set_attr "type" "alu1")   (set_attr "mode" "SI")   (set_attr "length_immediate" "1")]); The first alternative is used only to compute proper length of instruction.; Reload's algorithm does not take into account the cost of spill instructions; needed to free register in given class, so avoid it from choosing the first; alternative when eax is not available.(define_insn "*movsi_1"  [(set (match_operand:SI 0 "nonimmediate_operand" "=*?a,r,*?a,m,!*y,!rm,!*y,!*Y,!rm,!*Y")	(match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,rm,*y,*y,rm,*Y,*Y"))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"{  switch (get_attr_type (insn))    {    case TYPE_SSE:      if (get_attr_mode (insn) == TImode)        return "movdqa\t{%1, %0|%0, %1}";      return "movd\t{%1, %0|%0, %1}";    case TYPE_MMX:      if (get_attr_mode (insn) == DImode)	return "movq\t{%1, %0|%0, %1}";      return "movd\t{%1, %0|%0, %1}";    case TYPE_LEA:      return "lea{l}\t{%1, %0|%0, %1}";    default:      if (flag_pic && SYMBOLIC_CONST (operands[1]))	abort();      return "mov{l}\t{%1, %0|%0, %1}";    }}  [(set (attr "type")     (cond [(eq_attr "alternative" "4,5,6")	      (const_string "mmx")	    (eq_attr "alternative" "7,8,9")	      (const_string "sse")	    (and (ne (symbol_ref "flag_pic") (const_int 0))		 (match_operand:SI 1 "symbolic_operand" ""))	      (const_string "lea")	   ]	   (const_string "imov")))   (set_attr "modrm" "0,*,0,*,*,*,*,*,*,*")   (set_attr "mode" "SI,SI,SI,SI,SI,SI,DI,TI,SI,SI")]);; Stores and loads of ax to arbitary constant address.;; We fake an second form of instruction to force reload to load address;; into register when rax is not available(define_insn "*movabssi_1_rex64"  [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))	(match_operand:SI 1 "nonmemory_operand" "a,er,i"))]  "TARGET_64BIT"  "@   movabs{l}\t{%1, %P0|%P0, %1}   mov{l}\t{%1, %a0|%a0, %1}   movabs{l}\t{%1, %a0|%a0, %1}"  [(set_attr "type" "imov")   (set_attr "modrm" "0,*,*")   (set_attr "length_address" "8,0,0")   (set_attr "length_immediate" "0,*,*")   (set_attr "memory" "store")   (set_attr "mode" "SI")])(define_insn "*movabssi_2_rex64"  [(set (match_operand:SI 0 "register_operand" "=a,r")        (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]  "TARGET_64BIT"  "@   movabs{l}\t{%P1, %0|%0, %P1}   mov{l}\t{%a1, %0|%0, %a1}"  [(set_attr "type" "imov")   (set_attr "modrm" "0,*")   (set_attr "length_address" "8,0")   (set_attr "length_immediate" "0")   (set_attr "memory" "load")   (set_attr "mode" "SI")])(define_insn "*swapsi"  [(set (match_operand:SI 0 "register_operand" "+r")	(match_operand:SI 1 "register_operand" "+r"))   (set (match_dup 1)	(match_dup 0))]  ""  "xchg{l}\t%1, %0"  [(set_attr "type" "imov")   (set_attr "pent_pair" "np")   (set_attr "athlon_decode" "vector")   (set_attr "mode" "SI")   (set_attr "modrm" "0")   (set_attr "ppro_uops" "few")])(define_expand "movhi"  [(set (match_operand:HI 0 "nonimmediate_operand" "")        (match_operand:HI 1 "general_operand" ""))]  ""  "ix86_expand_move (HImode, operands); DONE;")(define_insn "*pushhi2"  [(set (match_operand:HI 0 "push_operand" "=<,<")	(match_operand:HI 1 "general_no_elim_operand" "n,r*m"))]  "!TARGET_64BIT"  "@   push{w}\t{|WORD PTR }%1   push{w}\t%1"  [(set_attr "type" "push")   (set_attr "mode" "HI")]);; For 64BIT abi we always round up to 8 bytes.(define_insn "*pushhi2_rex64"  [(set (match_operand:HI 0 "push_operand" "=X")	(match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]  "TARGET_64BIT"  "push{q}\t%q1"  [(set_attr "type" "push")   (set_attr "mode" "QI")]); The first alternative is used only to compute proper length of instruction.; Reload's algorithm does not take into account the cost of spill instructions; needed to free register in given class, so avoid it from choosing the first; alternative when eax is not available.(define_insn "*movhi_1"  [(set (match_operand:HI 0 "nonimmediate_operand" "=*?a,r,r,*?a,r,m")	(match_operand:HI 1 "general_operand" "i,r,rn,rm,rm,rn"))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"{  switch (get_attr_type (insn))    {    case TYPE_IMOVX:      /* movzwl is faster than movw on p2 due to partial word stalls,	 though not as fast as an aligned movl.  */      return "movz{wl|x}\t{%1, %k0|%k0, %1}";    default:      if (get_attr_mode (insn) == MODE_SI)        return "mov{l}\t{%k1, %k0|%k0, %k1}";      else        return "mov{w}\t{%1, %0|%0, %1}";    }}  [(set (attr "type")     (cond [(and (eq_attr "alternative" "0,1")		 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")			  (const_int 0))		      (eq (symbol_ref "TARGET_HIMODE_MATH")			  (const_int 0))))	      (const_string "imov")	    (and (eq_attr "alternative" "2,3,4")		 (match_operand:HI 1 "aligned_operand" ""))	      (const_string "imov")	    (and (ne (symbol_ref "TARGET_MOVX")		     (const_int 0))		 (eq_attr "alternative" "0,1,3,4"))	      (const_string "imovx")	   ]	   (const_string "imov")))    (set (attr "mode")      (cond [(eq_attr "type" "imovx")	       (const_string "SI")	     (and (eq_attr "alternative" "2,3,4")		  (match_operand:HI 1 "aligned_operand" ""))	       (const_string "SI")	     (and (eq_attr "alternative" "0,1")		  (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")			   (const_int 0))		       (eq (symbol_ref "TARGET_HIMODE_MATH")			   (const_int 0))))	       (const_string "SI")	    ]	    (const_string "HI")))   (set_attr "modrm" "0,*,*,0,*,*")]);; Stores and loads of ax to arbitary constant address.;; We fake an second form of instruction to force reload to load address;; into register when rax is not available(define_insn "*movabshi_1_rex64"  [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))	(match_operand:HI 1 "nonmemory_operand" "a,er,i"))]  "TARGET_64BIT"  "@   movabs{w}\t{%1, %P0|%P0, %1}   mov{w}\t{%1, %a0|%a0, %1}   movabs{w}\t{%1, %a0|%a0, %1}"  [(set_attr "type" "imov")   (set_attr "modrm" "0,*,*")   (set_attr "length_address" "8,0,0")   (set_attr "length_immediate" "0,*,*")   (set_attr "memory" "store")   (set_attr "mode" "HI")])(define_insn "*movabshi_2_rex64"  [(set (match_operand:HI 0 "register_operand" "=a,r")        (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]  "TARGET_64BIT"  "@   movabs{w}\t{%P1, %0|%0, %P1}   mov{w}\t{%a1, %0|%0, %a1}"  [(set_attr "type" "imov")   (set_attr "modrm" "0,*")   (set_attr "length_address" "8,0")   (set_attr "length_immediate" "0")   (set_attr "memory" "load")   (set_attr "mode" "HI")])(define_insn "*swaphi_1"  [(set (match_operand:HI 0 "register_operand" "+r")	(match_operand:HI 1 "register_operand" "+r"))   (set (match_dup 1)	(match_dup 0))]  "TARGET_PARTIAL_REG_STALL"  "xchg{w}\t%1, %0"  [(set_attr "type" "imov")   (set_attr "pent_pair" "np")   (set_attr "mode" "HI")   (set_attr "modrm" "0")   (set_attr "ppro_uops" "few")])(define_insn "*swaphi_2"  [(set (match_operand:HI 0 "register_operand" "+r")	(match_operand:HI 1 "register_operand" "+r"))   (set (match_dup 1)	(match_dup 0))]  "! TARGET_PARTIAL_REG_STALL"  "xchg{l}\t%k1, %k0"  [(set_attr "type" "imov")   (set_attr "pent_pair" "np")   (set_attr "mode" "SI")   (set_attr "modrm" "0")   (set_attr "ppro_uops" "few")])(define_expand "movstricthi"  [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))	(match_operand:HI 1 "general_operand" ""))]  "! TARGET_PARTIAL_REG_STALL || optimize_size"{  /* Don't generate memory->memory moves, go through a register */  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    operands[1] = force_reg (HImode, operands[1]);})(define_insn "*movstricthi_1"  [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))	(match_operand:HI 1 "general_operand" "rn,m"))]  "(! TARGET_PARTIAL_REG_STALL || optimize_size)   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"  "mov{w}\t{%1, %0|%0, %1}"  [(set_attr "type" "imov")   (set_attr "mode" "HI")])(define_insn "*movstricthi_xor"  [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))	(match_operand:HI 1 "const0_operand" "i"))   (clobber (reg:CC 17))]  "reload_completed   && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"  "xor{w}\t{%0, %0|%0, %0}"  [(set_attr "type" "alu1")   (set_attr "mode" "HI")   (set_attr "length_immediate" "0")])(define_expand "movqi"  [(set (match_operand:QI 0 "nonimmediate_operand" "")	(match_operand:QI 1 "general_operand" ""))]  ""  "ix86_expand_move (QImode, operands); DONE;");; emit_push_insn when it calls move_by_pieces requires an insn to;; "push a byte".  But actually we use pushw, which has the effect;; of rounding the amount pushed up to a halfword.(define_insn "*pushqi2"  [(set (match_operand:QI 0 "push_operand" "=X,X")	(match_operand:QI 1 "nonmemory_no_elim_operand" "n,r"))]  "!TARGET_64BIT"  "@   push{w}\t{|word ptr }%1   push{w}\t%w1"  [(set_attr "type" "push")   (set_attr "mode" "HI")]);; For 64BIT abi we always round up to 8 bytes.(define_insn "*pushqi2_rex64"  [(set (match_operand:QI 0 "push_operand" "=X")	(match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]  "TARGET_64BIT"  "push{q}\t%q1"  [(set_attr "type" "push")   (set_attr "mode" "QI")]);; Situation is quite tricky about when to choose full sized (SImode) move;; over QImode moves.  For Q_REG -> Q_REG move we use full size only for;; partial register dependency machines (such as AMD Athlon), where QImode;; moves issue extra dependency and for partial register stalls machines;; that don't use QImode patterns (and QImode move cause stall on the next;; instruction).;;;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial;; register stall machines with, where we use QImode instructions, since;; partial register stall can be caused there.  Then we use movzx.(define_insn "*movqi_1"  [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")	(match_operand:QI 1 "general_operand"      " q,qn,qm,q,rn,qm,qn"))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"{  switch (get_attr_type (insn))    {    case TYPE_IMOVX:      if (!ANY_QI_REG_P (operands[1]) 

⌨️ 快捷键说明

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