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

📄 i386.md

📁 gcc库的原代码,对编程有很大帮助.
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; GCC machine description for Intel X86.;; Copyright (C) 1988, 1994, 1995 Free Software Foundation, Inc.;; Mostly by William Schelter.;; 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.;; 'S' Print the opcode suffix for a 32-bit float opcode.;; 'Q' Print the opcode suffix for a 64-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:;; 0  This is a `scas' operation.  The mode of the UNSPEC is always SImode.;;    operand 0 is the memory address to scan.;;    operand 1 is a register containing the value to scan for.  The mode;;       of the scas opcode will be the same as the mode of this operand.;;    operand 2 is the known alignment of operand 0.;; 1  This is a `sin' operation.  The mode of the UNSPEC is MODE_FLOAT.;;    operand 0 is the argument for `sin'.;; 2  This is a `cos' operation.  The mode of the UNSPEC is MODE_FLOAT.;;    operand 0 is the argument for `cos'.;; "movl MEM,REG / testl REG,REG" is faster on a 486 than "cmpl $0,MEM".;; But restricting MEM here would mean that gcc could not remove a redundant;; test in cases like "incl MEM / je TARGET".;;;; We don't want to allow a constant operand for test insns because;; (set (cc0) (const_int foo)) has no mode information.  Such insns will;; be folded while optimizing anyway.;; All test insns have expanders that save the operands away without;; actually generating RTL.  The bCOND or sCOND (emitted immediately;; after the tstM or cmp) will actually emit the tstM or cmpM.(define_insn "tstsi_1"  [(set (cc0)	(match_operand:SI 0 "nonimmediate_operand" "rm"))]  ""  "*{  if (REG_P (operands[0]))    return AS2 (test%L0,%0,%0);  operands[1] = const0_rtx;  return AS2 (cmp%L0,%1,%0);}")(define_expand "tstsi"  [(set (cc0)	(match_operand:SI 0 "nonimmediate_operand" ""))]  ""  "{  i386_compare_gen = gen_tstsi_1;  i386_compare_op0 = operands[0];  DONE;}")(define_insn "tsthi_1"  [(set (cc0)	(match_operand:HI 0 "nonimmediate_operand" "rm"))]  ""  "*{  if (REG_P (operands[0]))    return AS2 (test%W0,%0,%0);  operands[1] = const0_rtx;  return AS2 (cmp%W0,%1,%0);}")(define_expand "tsthi"  [(set (cc0)	(match_operand:HI 0 "nonimmediate_operand" ""))]  ""  "{  i386_compare_gen = gen_tsthi_1;  i386_compare_op0 = operands[0];  DONE;}")(define_insn "tstqi_1"  [(set (cc0)	(match_operand:QI 0 "nonimmediate_operand" "qm"))]  ""  "*{  if (REG_P (operands[0]))    return AS2 (test%B0,%0,%0);  operands[1] = const0_rtx;  return AS2 (cmp%B0,%1,%0);}")(define_expand "tstqi"  [(set (cc0)	(match_operand:QI 0 "nonimmediate_operand" ""))]  ""  "{  i386_compare_gen = gen_tstqi_1;  i386_compare_op0 = operands[0];  DONE;}")(define_insn "tstsf_cc"  [(set (cc0)	(match_operand:SF 0 "register_operand" "f"))   (clobber (match_scratch:HI 1 "=a"))]  "TARGET_80387 && ! TARGET_IEEE_FP"  "*{  if (! STACK_TOP_P (operands[0]))    abort ();  output_asm_insn (\"ftst\", operands);  if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))    output_asm_insn (AS1 (fstp,%y0), operands);  return output_fp_cc0_set (insn);}");; Don't generate tstsf if generating IEEE code, since the `ftst' opcode;; isn't IEEE compliant.(define_expand "tstsf"  [(parallel [(set (cc0)		   (match_operand:SF 0 "register_operand" ""))	      (clobber (match_scratch:HI 1 ""))])]  "TARGET_80387 && ! TARGET_IEEE_FP"  "{  i386_compare_gen = gen_tstsf_cc;  i386_compare_op0 = operands[0];  DONE;}")(define_insn "tstdf_cc"  [(set (cc0)	(match_operand:DF 0 "register_operand" "f"))   (clobber (match_scratch:HI 1 "=a"))]  "TARGET_80387 && ! TARGET_IEEE_FP"  "*{  if (! STACK_TOP_P (operands[0]))    abort ();  output_asm_insn (\"ftst\", operands);  if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))    output_asm_insn (AS1 (fstp,%y0), operands);  return output_fp_cc0_set (insn);}");; Don't generate tstdf if generating IEEE code, since the `ftst' opcode;; isn't IEEE compliant.(define_expand "tstdf"  [(parallel [(set (cc0)		   (match_operand:DF 0 "register_operand" ""))	      (clobber (match_scratch:HI 1 ""))])]  "TARGET_80387 && ! TARGET_IEEE_FP"  "{  i386_compare_gen = gen_tstdf_cc;  i386_compare_op0 = operands[0];  DONE;}")(define_insn "tstxf_cc"  [(set (cc0)	(match_operand:XF 0 "register_operand" "f"))   (clobber (match_scratch:HI 1 "=a"))]  "TARGET_80387 && ! TARGET_IEEE_FP"  "*{  if (! STACK_TOP_P (operands[0]))    abort ();  output_asm_insn (\"ftst\", operands);  if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))    output_asm_insn (AS1 (fstp,%y0), operands);  return output_fp_cc0_set (insn);}");; Don't generate tstdf if generating IEEE code, since the `ftst' opcode;; isn't IEEE compliant.(define_expand "tstxf"  [(parallel [(set (cc0)		   (match_operand:XF 0 "register_operand" ""))	      (clobber (match_scratch:HI 1 ""))])]  "TARGET_80387 && ! TARGET_IEEE_FP"  "{  i386_compare_gen = gen_tstxf_cc;  i386_compare_op0 = operands[0];  DONE;}");;- compare instructions.  See comments above tstM patterns about;;  expansion of these insns.(define_insn "cmpsi_1"  [(set (cc0)	(compare (match_operand:SI 0 "nonimmediate_operand" "mr,r")		 (match_operand:SI 1 "general_operand" "ri,mr")))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"  "*{  if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)    {      cc_status.flags |= CC_REVERSED;      return AS2 (cmp%L0,%0,%1);    }  return AS2 (cmp%L0,%1,%0);}")(define_expand "cmpsi"  [(set (cc0)	(compare (match_operand:SI 0 "nonimmediate_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]);  i386_compare_gen = gen_cmpsi_1;  i386_compare_op0 = operands[0];  i386_compare_op1 = operands[1];  DONE;}")(define_insn "cmphi_1"  [(set (cc0)	(compare (match_operand:HI 0 "nonimmediate_operand" "mr,r")		 (match_operand:HI 1 "general_operand" "ri,mr")))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"  "*{  if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)    {      cc_status.flags |= CC_REVERSED;      return AS2 (cmp%W0,%0,%1);    }  return AS2 (cmp%W0,%1,%0);}")(define_expand "cmphi"  [(set (cc0)	(compare (match_operand:HI 0 "nonimmediate_operand" "")		 (match_operand:HI 1 "general_operand" "")))]  ""  "{  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    operands[0] = force_reg (HImode, operands[0]);  i386_compare_gen = gen_cmphi_1;  i386_compare_op0 = operands[0];  i386_compare_op1 = operands[1];  DONE;}")(define_insn "cmpqi_1"  [(set (cc0)	(compare (match_operand:QI 0 "nonimmediate_operand" "q,mq")		 (match_operand:QI 1 "general_operand" "qm,nq")))]  "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"  "*{  if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)    {      cc_status.flags |= CC_REVERSED;      return AS2 (cmp%B0,%0,%1);    }  return AS2 (cmp%B0,%1,%0);}")(define_expand "cmpqi"  [(set (cc0)	(compare (match_operand:QI 0 "nonimmediate_operand" "")		 (match_operand:QI 1 "general_operand" "")))]  ""  "{  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    operands[0] = force_reg (QImode, operands[0]);  i386_compare_gen = gen_cmpqi_1;  i386_compare_op0 = operands[0];  i386_compare_op1 = operands[1];  DONE;}");; These implement float point compares.  For each of DFmode and;; SFmode, there is the normal insn, and an insn where the second operand;; is converted to the desired mode.(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:XF 0 "nonimmediate_operand" "f")			 (match_operand:XF 1 "nonimmediate_operand" "f")]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:XF 0 "register_operand" "f")			 (float:XF			  (match_operand:SI 1 "nonimmediate_operand" "rm"))]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(float:XF			  (match_operand:SI 0 "nonimmediate_operand" "rm"))			 (match_operand:XF 1 "register_operand" "f")]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:XF 0 "register_operand" "f")			 (float_extend:XF			  (match_operand:DF 1 "nonimmediate_operand" "fm"))]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:XF 0 "register_operand" "f")			 (float_extend:XF			  (match_operand:SF 1 "nonimmediate_operand" "fm"))]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(compare:CCFPEQ (match_operand:XF 0 "register_operand" "f")			(match_operand:XF 1 "register_operand" "f")))   (clobber (match_scratch:HI 2 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:DF 0 "nonimmediate_operand" "f,fm")			 (match_operand:DF 1 "nonimmediate_operand" "fm,f")]))   (clobber (match_scratch:HI 3 "=a,a"))]  "TARGET_80387   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:DF 0 "register_operand" "f")			 (float:DF			  (match_operand:SI 1 "nonimmediate_operand" "rm"))]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(float:DF			  (match_operand:SI 0 "nonimmediate_operand" "rm"))			 (match_operand:DF 1 "register_operand" "f")]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(match_operand:DF 0 "register_operand" "f")			 (float_extend:DF			  (match_operand:SF 1 "nonimmediate_operand" "fm"))]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(match_operator 2 "VOIDmode_compare_op"			[(float_extend:DF			  (match_operand:SF 0 "nonimmediate_operand" "fm"))			 (match_operand:DF 1 "register_operand" "f")]))   (clobber (match_scratch:HI 3 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);")(define_insn ""  [(set (cc0)	(compare:CCFPEQ (match_operand:DF 0 "register_operand" "f")			(match_operand:DF 1 "register_operand" "f")))   (clobber (match_scratch:HI 2 "=a"))]  "TARGET_80387"  "* return output_float_compare (insn, operands);");; These two insns will never be generated by combine due to the mode of;; the COMPARE.;(define_insn "";  [(set (cc0);	(compare:CCFPEQ (match_operand:DF 0 "register_operand" "f");			(float_extend:DF;			 (match_operand:SF 1 "register_operand" "f"))));   (clobber (match_scratch:HI 2 "=a"))];  "TARGET_80387";  "* return output_float_compare (insn, operands);");;(define_insn "";  [(set (cc0);	(compare:CCFPEQ (float_extend:DF;			 (match_operand:SF 0 "register_operand" "f"));			(match_operand:DF 1 "register_operand" "f")));   (clobber (match_scratch:HI 2 "=a"))];  "TARGET_80387";  "* return output_float_compare (insn, operands);")

⌨️ 快捷键说明

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