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

📄 mips.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
(define_expand "adddi3"  [(parallel [(set (match_operand:DI 0 "register_operand" "")		   (plus:DI (match_operand:DI 1 "se_register_operand" "")			    (match_operand:DI 2 "se_arith_operand" "")))	      (clobber (match_dup 3))])]  "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"  "{  /* The mips16 assembler handles -32768 correctly, and so does gas,     but some other MIPS assemblers think that -32768 needs to be     loaded into a register before it can be added in.  */  if (! TARGET_MIPS16      && ! TARGET_GAS      && GET_CODE (operands[2]) == CONST_INT      && INTVAL (operands[2]) == -32768)    operands[2] = force_reg (DImode, operands[2]);  /* If a large stack adjustment was forced into a register, we may be     asked to generate rtx such as:	(set (reg:DI sp) (plus:DI (reg:DI sp) (reg:DI pseudo)))     but no such instruction is available in mips16.  Handle it by     using a temporary.  */  if (TARGET_MIPS16      && REGNO (operands[0]) == STACK_POINTER_REGNUM      && ((GET_CODE (operands[1]) == REG	   && REGNO (operands[1]) != STACK_POINTER_REGNUM)	  || GET_CODE (operands[2]) != CONST_INT))    {      rtx tmp = gen_reg_rtx (DImode);      emit_move_insn (tmp, operands[1]);      emit_insn (gen_addsi3 (tmp, tmp, operands[2]));      emit_move_insn (operands[0], tmp);      DONE;    }  if (TARGET_64BIT)    {      emit_insn (gen_adddi3_internal_3 (operands[0], operands[1],					operands[2]));      DONE;    }  operands[3] = gen_reg_rtx (SImode);}")(define_insn "adddi3_internal_1"  [(set (match_operand:DI 0 "register_operand" "=d,&d")	(plus:DI (match_operand:DI 1 "register_operand" "0,d")		 (match_operand:DI 2 "register_operand" "d,d")))   (clobber (match_operand:SI 3 "register_operand" "=d,d"))]  "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"  "*{  return (REGNO (operands[0]) == REGNO (operands[1])	  && REGNO (operands[0]) == REGNO (operands[2]))    ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"    : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";}"  [(set_attr "type"	"darith")   (set_attr "mode"	"DI")   (set_attr "length"	"16")])(define_split  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "register_operand" "")))   (clobber (match_operand:SI 3 "register_operand" ""))]  "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT   && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16   && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))   && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))   && (REGNO (operands[0]) != REGNO (operands[1])       || REGNO (operands[0]) != REGNO (operands[2]))"  [(set (subreg:SI (match_dup 0) 0)	(plus:SI (subreg:SI (match_dup 1) 0)		 (subreg:SI (match_dup 2) 0)))   (set (match_dup 3)	(ltu:SI (subreg:SI (match_dup 0) 0)		(subreg:SI (match_dup 2) 0)))   (set (subreg:SI (match_dup 0) 4)	(plus:SI (subreg:SI (match_dup 1) 4)		 (subreg:SI (match_dup 2) 4)))   (set (subreg:SI (match_dup 0) 4)	(plus:SI (subreg:SI (match_dup 0) 4)		 (match_dup 3)))]  "")(define_split  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "register_operand" "")))   (clobber (match_operand:SI 3 "register_operand" ""))]  "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT   && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16   && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))   && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))   && (REGNO (operands[0]) != REGNO (operands[1])       || REGNO (operands[0]) != REGNO (operands[2]))"  [(set (subreg:SI (match_dup 0) 4)	(plus:SI (subreg:SI (match_dup 1) 4)		 (subreg:SI (match_dup 2) 4)))   (set (match_dup 3)	(ltu:SI (subreg:SI (match_dup 0) 4)		(subreg:SI (match_dup 2) 4)))   (set (subreg:SI (match_dup 0) 0)	(plus:SI (subreg:SI (match_dup 1) 0)		 (subreg:SI (match_dup 2) 0)))   (set (subreg:SI (match_dup 0) 0)	(plus:SI (subreg:SI (match_dup 0) 0)		 (match_dup 3)))]  "")(define_insn "adddi3_internal_2"  [(set (match_operand:DI 0 "register_operand" "=d,d,d")	(plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")		 (match_operand:DI 2 "small_int" "P,J,N")))   (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]  "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16   && (TARGET_GAS       || GET_CODE (operands[2]) != CONST_INT       || INTVAL (operands[2]) != -32768)"  "@   addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3   move\\t%L0,%L1\;move\\t%M0,%M1   subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"  [(set_attr "type"	"darith")   (set_attr "mode"	"DI")   (set_attr "length"	"12,8,16")])(define_split  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "small_int" "")))   (clobber (match_operand:SI 3 "register_operand" ""))]  "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT   && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16   && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))   && INTVAL (operands[2]) > 0"  [(set (subreg:SI (match_dup 0) 0)	(plus:SI (subreg:SI (match_dup 1) 0)		 (match_dup 2)))   (set (match_dup 3)	(ltu:SI (subreg:SI (match_dup 0) 0)		(match_dup 2)))   (set (subreg:SI (match_dup 0) 4)	(plus:SI (subreg:SI (match_dup 1) 4)		 (match_dup 3)))]  "")(define_split  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "small_int" "")))   (clobber (match_operand:SI 3 "register_operand" ""))]  "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT   && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16   && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))   && INTVAL (operands[2]) > 0"  [(set (subreg:SI (match_dup 0) 4)	(plus:SI (subreg:SI (match_dup 1) 4)		 (match_dup 2)))   (set (match_dup 3)	(ltu:SI (subreg:SI (match_dup 0) 4)		(match_dup 2)))   (set (subreg:SI (match_dup 0) 0)	(plus:SI (subreg:SI (match_dup 1) 0)		 (match_dup 3)))]  "")(define_insn "adddi3_internal_3"  [(set (match_operand:DI 0 "register_operand" "=d")	(plus:DI (match_operand:DI 1 "se_reg_or_0_operand" "dJ")		 (match_operand:DI 2 "se_arith_operand" "dI")))]  "TARGET_64BIT   && !TARGET_MIPS16   && (TARGET_GAS       || GET_CODE (operands[2]) != CONST_INT       || INTVAL (operands[2]) != -32768)"  "*{  return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)    ? \"dsubu\\t%0,%z1,%n2\"    : \"daddu\\t%0,%z1,%2\";}"  [(set_attr "type"	"darith")   (set_attr "mode"	"DI")]);; For the mips16, we need to recognize 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 ""  [(set (reg:DI 29)	(plus:DI (reg:DI 29)		 (match_operand:DI 0 "small_int" "I")))]  "TARGET_MIPS16 && TARGET_64BIT"  "daddu\\t%$,%$,%0"  [(set_attr "type"	"arith")   (set_attr "mode"	"DI")   (set (attr "length")	(if_then_else (match_operand:VOID 0 "m16_simm8_8" "")				      (const_int 4)				      (const_int 8)))])(define_insn ""  [(set (match_operand:DI 0 "register_operand" "=d")	(plus:DI (reg:DI 29)		 (match_operand:DI 1 "small_int" "I")))]  "TARGET_MIPS16 && TARGET_64BIT"  "daddu\\t%0,%$,%1"  [(set_attr "type"	"arith")   (set_attr "mode"	"DI")   (set (attr "length")	(if_then_else (match_operand:VOID 0 "m16_uimm5_4" "")				      (const_int 4)				      (const_int 8)))])(define_insn ""  [(set (match_operand:DI 0 "register_operand" "=d,d,d")	(plus:DI (match_operand:DI 1 "register_operand" "0,d,d")		 (match_operand:DI 2 "arith_operand" "IQ,O,d")))]  "TARGET_MIPS16 && TARGET_64BIT   && (GET_CODE (operands[1]) != REG       || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER       || M16_REG_P (REGNO (operands[1]))       || REGNO (operands[1]) == ARG_POINTER_REGNUM       || REGNO (operands[1]) == FRAME_POINTER_REGNUM       || REGNO (operands[1]) == STACK_POINTER_REGNUM)   && (GET_CODE (operands[2]) != REG       || REGNO (operands[2]) >= FIRST_PSEUDO_REGISTER       || M16_REG_P (REGNO (operands[2]))       || REGNO (operands[2]) == ARG_POINTER_REGNUM       || REGNO (operands[2]) == FRAME_POINTER_REGNUM       || REGNO (operands[2]) == STACK_POINTER_REGNUM)"  "*{  if (REGNO (operands[0]) == REGNO (operands[1]))    return \"daddu\\t%0,%2\";  return \"daddu\\t%0,%1,%2\";}"  [(set_attr "type"	"arith")   (set_attr "mode"	"DI")   (set_attr_alternative "length"		[(if_then_else (match_operand:VOID 2 "m16_simm5_1" "")			       (const_int 4)			       (const_int 8))		 (if_then_else (match_operand:VOID 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: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   && GET_CODE (operands[0]) == REG   && 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)))   (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))]  "{  HOST_WIDE_INT val = INTVAL (operands[1]);  if (val >= 0)    {      operands[1] = GEN_INT (0xf);      operands[2] = GEN_INT (val - 0xf);    }  else    {      operands[1] = GEN_INT (- 0x10);      operands[2] = GEN_INT (val + 0x10);    }}")(define_split  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "const_int_operand" "")))]  "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE   && GET_CODE (operands[0]) == REG   && M16_REG_P (REGNO (operands[0]))   && GET_CODE (operands[1]) == REG   && 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 + 0xf)       || (INTVAL (operands[2]) < - 0x8	   && INTVAL (operands[2]) >= - 0x8 - 0x10))"  [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))   (set (match_dup 0) (plus:DI (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_insn "addsi3_internal_2"  [(set (match_operand:DI 0 "register_operand" "=d")	(sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")				 (match_operand:SI 2 "arith_operand" "dI"))))]  "TARGET_64BIT   && !TARGET_MIPS16   && (TARGET_GAS       || GET_CODE (operands[2]) != CONST_INT       || INTVAL (operands[2]) != -32768)"  "*{  return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)    ? \"subu\\t%0,%z1,%n2\"    : \"addu\\t%0,%z1,%2\";}"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")])(define_insn ""  [(set (match_operand:DI 0 "register_operand" "=d,d,d")	(sign_extend:DI (plus:SI (match_operand:SI 1 "register_operand" "0,d,d")				 (match_operand:SI 2 "arith_operand" "I,O,d"))))]  "TARGET_MIPS16 && TARGET_64BIT"  "*{  if (REGNO (operands[0]) == REGNO (operands[1]))    return \"addu\\t%0,%2\";  return \"addu\\t%0,%1,%2\";}"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr_alternative "length"		[(if_then_else (match_operand:VOID 2 "m16_simm8_1" "")			       (const_int 4)			       (const_int 8))		 (if_then_else (match_operand:VOID 2 "m16_simm4_1" "")			       (const_int 4)			       (const_int 8))		 (const_int 4)])]);;;;  ....................;;;;	SUBTRACTION;;;;  ....................;;(define_insn "subdf3"  [(set (match_operand:DF 0 "register_operand" "=f")	(minus:DF (match_operand:DF 1 "register_operand" "f")		  (match_operand:DF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"  "sub.d\\t%0,%1,%2"  [(set_attr "type"	"fadd")   (set_attr "mode"	"DF")])

⌨️ 快捷键说明

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