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

📄 mips.md

📁 linux下编程用 编译软件
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; from the same template.(define_mode_macro GPR [SI (DI "TARGET_64BIT")]);; This mode macro allows :P to be used for patterns that operate on;; pointer-sized quantities.  Exactly one of the two alternatives will match.(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")]);; This mode macro allows :MOVECC to be used anywhere that a;; conditional-move-type condition is needed.(define_mode_macro MOVECC [SI (DI "TARGET_64BIT") (CC "TARGET_HARD_FLOAT")]);; This mode macro allows the QI and HI extension patterns to be defined from;; the same template.(define_mode_macro SHORT [QI HI]);; This mode macro allows :ANYF to be used wherever a scalar or vector;; floating-point mode is allowed.(define_mode_macro ANYF [(SF "TARGET_HARD_FLOAT")			 (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")			 (V2SF "TARGET_PAIRED_SINGLE_FLOAT")]);; Like ANYF, but only applies to scalar modes.(define_mode_macro SCALARF [(SF "TARGET_HARD_FLOAT")			    (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")]);; In GPR templates, a string like "<d>subu" will expand to "subu" in the;; 32-bit version and "dsubu" in the 64-bit version.(define_mode_attr d [(SI "") (DI "d")]);; This attribute gives the length suffix for a sign- or zero-extension;; instruction.(define_mode_attr size [(QI "b") (HI "h")]);; This attributes gives the mode mask of a SHORT.(define_mode_attr mask [(QI "0x00ff") (HI "0xffff")]);; Mode attributes for GPR loads and stores.(define_mode_attr load [(SI "lw") (DI "ld")])(define_mode_attr store [(SI "sw") (DI "sd")]);; Similarly for MIPS IV indexed FPR loads and stores.(define_mode_attr loadx [(SF "lwxc1") (DF "ldxc1") (V2SF "ldxc1")])(define_mode_attr storex [(SF "swxc1") (DF "sdxc1") (V2SF "sdxc1")]);; The unextended ranges of the MIPS16 addiu and daddiu instructions;; are different.  Some forms of unextended addiu have an 8-bit immediate;; field but the equivalent daddiu has only a 5-bit field.(define_mode_attr si8_di5 [(SI "8") (DI "5")]);; This attribute gives the best constraint to use for registers of;; a given mode.(define_mode_attr reg [(SI "d") (DI "d") (CC "z")]);; This attribute gives the format suffix for floating-point operations.(define_mode_attr fmt [(SF "s") (DF "d") (V2SF "ps")]);; This attribute gives the upper-case mode name for one unit of a;; floating-point mode.(define_mode_attr UNITMODE [(SF "SF") (DF "DF") (V2SF "SF")]);; This attribute works around the early SB-1 rev2 core "F2" erratum:;;;; In certain cases, div.s and div.ps may have a rounding error;; and/or wrong inexact flag.;;;; Therefore, we only allow div.s if not working around SB-1 rev2;; errata or if a slight loss of precision is OK.(define_mode_attr divide_condition  [DF (SF "!TARGET_FIX_SB1 || flag_unsafe_math_optimizations")   (V2SF "TARGET_SB1 && (!TARGET_FIX_SB1 || flag_unsafe_math_optimizations)")]); This attribute gives the condition for which sqrt instructions exist.(define_mode_attr sqrt_condition  [(SF "!ISA_MIPS1") (DF "!ISA_MIPS1") (V2SF "TARGET_SB1")]); This attribute gives the condition for which recip and rsqrt instructions; exist.(define_mode_attr recip_condition  [(SF "ISA_HAS_FP4") (DF "ISA_HAS_FP4") (V2SF "TARGET_SB1")]);; This code macro allows all branch instructions to be generated from;; a single define_expand template.(define_code_macro any_cond [unordered ordered unlt unge uneq ltgt unle ungt			     eq ne gt ge lt le gtu geu ltu leu]);; This code macro allows signed and unsigned widening multiplications;; to use the same template.(define_code_macro any_extend [sign_extend zero_extend]);; This code macro allows the three shift instructions to be generated;; from the same template.(define_code_macro any_shift [ashift ashiftrt lshiftrt]);; This code macro allows all native floating-point comparisons to be;; generated from the same template.(define_code_macro fcond [unordered uneq unlt unle eq lt le]);; This code macro is used for comparisons that can be implemented;; by swapping the operands.(define_code_macro swapped_fcond [ge gt unge ungt]);; <u> expands to an empty string when doing a signed operation and;; "u" when doing an unsigned operation.(define_code_attr u [(sign_extend "") (zero_extend "u")]);; <su> is like <u>, but the signed form expands to "s" rather than "".(define_code_attr su [(sign_extend "s") (zero_extend "u")]);; <optab> expands to the name of the optab for a particular code.(define_code_attr optab [(ashift "ashl")			 (ashiftrt "ashr")			 (lshiftrt "lshr")]);; <insn> expands to the name of the insn that implements a particular code.(define_code_attr insn [(ashift "sll")			(ashiftrt "sra")			(lshiftrt "srl")]);; <fcond> is the c.cond.fmt condition associated with a particular code.(define_code_attr fcond [(unordered "un")			 (uneq "ueq")			 (unlt "ult")			 (unle "ule")			 (eq "eq")			 (lt "lt")			 (le "le")]);; Similar, but for swapped conditions.(define_code_attr swapped_fcond [(ge "le")				 (gt "lt")				 (unge "ule")				 (ungt "ult")]);; .........................;;;;	Branch, call and jump delay slots;;;; .........................(define_delay (and (eq_attr "type" "branch")		   (eq (symbol_ref "TARGET_MIPS16") (const_int 0)))  [(eq_attr "can_delay" "yes")   (nil)   (and (eq_attr "branch_likely" "yes")	(eq_attr "can_delay" "yes"))])(define_delay (eq_attr "type" "jump")  [(eq_attr "can_delay" "yes")   (nil)   (nil)])(define_delay (and (eq_attr "type" "call")		   (eq_attr "jal_macro" "no"))  [(eq_attr "can_delay" "yes")   (nil)   (nil)]);; Pipeline descriptions.;;;; generic.md provides a fallback for processors without a specific;; pipeline description.  It is derived from the old define_function_unit;; version and uses the "alu" and "imuldiv" units declared below.;;;; Some of the processor-specific files are also derived from old;; define_function_unit descriptions and simply override the parts of;; generic.md that don't apply.  The other processor-specific files;; are self-contained.(define_automaton "alu,imuldiv")(define_cpu_unit "alu" "alu")(define_cpu_unit "imuldiv" "imuldiv")(include "4k.md")(include "5k.md")(include "24k.md")(include "3000.md")(include "4000.md")(include "4100.md")(include "4130.md")(include "4300.md")(include "4600.md")(include "5000.md")(include "5400.md")(include "5500.md")(include "6000.md")(include "7000.md")(include "9000.md")(include "sb1.md")(include "sr71k.md")(include "generic.md");;;;  ....................;;;;	CONDITIONAL TRAPS;;;;  ....................;;(define_insn "trap"  [(trap_if (const_int 1) (const_int 0))]  ""{  if (ISA_HAS_COND_TRAP)    return "teq\t$0,$0";  else if (TARGET_MIPS16)    return "break 0";  else    return "break";}  [(set_attr "type" "trap")])(define_expand "conditional_trap"  [(trap_if (match_operator 0 "comparison_operator"			    [(match_dup 2) (match_dup 3)])	    (match_operand 1 "const_int_operand"))]  "ISA_HAS_COND_TRAP"{  if (GET_MODE_CLASS (GET_MODE (cmp_operands[0])) == MODE_INT      && operands[1] == const0_rtx)    {      mips_gen_conditional_trap (operands);      DONE;    }  else    FAIL;})(define_insn "*conditional_trap<mode>"  [(trap_if (match_operator:GPR 0 "trap_comparison_operator"				[(match_operand:GPR 1 "reg_or_0_operand" "dJ")				 (match_operand:GPR 2 "arith_operand" "dI")])	    (const_int 0))]  "ISA_HAS_COND_TRAP"  "t%C0\t%z1,%2"  [(set_attr "type" "trap")]);;;;  ....................;;;;	ADDITION;;;;  ....................;;(define_insn "add<mode>3"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(plus:ANYF (match_operand:ANYF 1 "register_operand" "f")		   (match_operand:ANYF 2 "register_operand" "f")))]  ""  "add.<fmt>\t%0,%1,%2"  [(set_attr "type" "fadd")   (set_attr "mode" "<UNITMODE>")])(define_expand "add<mode>3"  [(set (match_operand:GPR 0 "register_operand")	(plus:GPR (match_operand:GPR 1 "register_operand")		  (match_operand:GPR 2 "arith_operand")))]  "")(define_insn "*add<mode>3"  [(set (match_operand:GPR 0 "register_operand" "=d,d")	(plus:GPR (match_operand:GPR 1 "register_operand" "d,d")		  (match_operand:GPR 2 "arith_operand" "d,Q")))]  "!TARGET_MIPS16"  "@    <d>addu\t%0,%1,%2    <d>addiu\t%0,%1,%2"  [(set_attr "type" "arith")   (set_attr "mode" "<MODE>")]);; We need to recognize MIPS16 stack pointer additions explicitly, since;; we don't have a constraint for $sp.  These insns will be generated by;; the save_restore_insns functions.(define_insn "*add<mode>3_sp1"  [(set (reg:GPR 29)	(plus:GPR (reg:GPR 29)		  (match_operand:GPR 0 "const_arith_operand" "")))]  "TARGET_MIPS16"  "<d>addiu\t%$,%$,%0"  [(set_attr "type" "arith")   (set_attr "mode" "<MODE>")   (set (attr "length") (if_then_else (match_operand 0 "m16_simm8_8")				      (const_int 4)				      (const_int 8)))])(define_insn "*add<mode>3_sp2"  [(set (match_operand:GPR 0 "register_operand" "=d")	(plus:GPR (reg:GPR 29)		  (match_operand:GPR 1 "const_arith_operand" "")))]  "TARGET_MIPS16"  "<d>addiu\t%0,%$,%1"  [(set_attr "type" "arith")   (set_attr "mode" "<MODE>")   (set (attr "length") (if_then_else (match_operand 1 "m16_uimm<si8_di5>_4")				      (const_int 4)				      (const_int 8)))])(define_insn "*add<mode>3_mips16"  [(set (match_operand:GPR 0 "register_operand" "=d,d,d")	(plus:GPR (match_operand:GPR 1 "register_operand" "0,d,d")		  (match_operand:GPR 2 "arith_operand" "Q,O,d")))]  "TARGET_MIPS16"  "@    <d>addiu\t%0,%2    <d>addiu\t%0,%1,%2    <d>addu\t%0,%1,%2"  [(set_attr "type" "arith")   (set_attr "mode" "<MODE>")   (set_attr_alternative "length"		[(if_then_else (match_operand 2 "m16_simm<si8_di5>_1")			       (const_int 4)			       (const_int 8))		 (if_then_else (match_operand 2 "m16_simm4_1")			       (const_int 4)			       (const_int 8))		 (const_int 4)])]);; On the mips16, we can sometimes split an add of a constant which is;; a 4 byte instruction into two adds which are both 2 byte;; instructions.  There are two cases: one where we are adding a;; constant plus a register to another register, and one where we are;; simply adding a constant to a register.(define_split  [(set (match_operand:SI 0 "register_operand")	(plus:SI (match_dup 0)		 (match_operand:SI 1 "const_int_operand")))]  "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE   && REG_P (operands[0])   && M16_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == CONST_INT   && ((INTVAL (operands[1]) > 0x7f	&& INTVAL (operands[1]) <= 0x7f + 0x7f)       || (INTVAL (operands[1]) < - 0x80	   && INTVAL (operands[1]) >= - 0x80 - 0x80))"  [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]{  HOST_WIDE_INT val = INTVAL (operands[1]);  if (val >= 0)    {      operands[1] = GEN_INT (0x7f);      operands[2] = GEN_INT (val - 0x7f);    }  else    {      operands[1] = GEN_INT (- 0x80);      operands[2] = GEN_INT (val + 0x80);    }})(define_split  [(set (match_operand:SI 0 "register_operand")	(plus:SI (match_operand:SI 1 "register_operand")		 (match_operand:SI 2 "const_int_operand")))]  "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE   && REG_P (operands[0])   && M16_REG_P (REGNO (operands[0]))   && REG_P (operands[1])   && M16_REG_P (REGNO (operands[1]))   && REGNO (operands[0]) != REGNO (operands[1])   && GET_CODE (operands[2]) == CONST_INT   && ((INTVAL (operands[2]) > 0x7	&& INTVAL (operands[2]) <= 0x7 + 0x7f)       || (INTVAL (operands[2]) < - 0x8	   && INTVAL (operands[2]) >= - 0x8 - 0x80))"  [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]{  HOST_WIDE_INT val = INTVAL (operands[2]);  if (val >= 0)    {      operands[2] = GEN_INT (0x7);      operands[3] = GEN_INT (val - 0x7);    }  else    {      operands[2] = GEN_INT (- 0x8);      operands[3] = GEN_INT (val + 0x8);    }})(define_split  [(set (match_operand:DI 0 "register_operand")	(plus:DI (match_dup 0)		 (match_operand:DI 1 "const_int_operand")))]  "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE   && REG_P (operands[0])   && M16_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == CONST_INT   && ((INTVAL (operands[1]) > 0xf	&& INTVAL (operands[1]) <= 0xf + 0xf)       || (INTVAL (operands[1]) < - 0x10	   && INTVAL (operands[1]) >= - 0x10 - 0x10))"  [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))

⌨️ 快捷键说明

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