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

📄 mips.md

📁 PSP用开发必装库GCC4.0.1
💻 MD
📖 第 1 页 / 共 5 页
字号:
   (set_attr "mode" "SI")]);; Disable unsigned multiplication for -mfix-vr4120.  This is for VR4120;; errata MD(0), which says that dmultu does not always produce the;; correct result.(define_insn "<su>muldi3_highpart"  [(set (match_operand:DI 0 "register_operand" "=h")	(truncate:DI	 (lshiftrt:TI	  (mult:TI	   (any_extend:TI (match_operand:DI 1 "register_operand" "d"))	   (any_extend:TI (match_operand:DI 2 "register_operand" "d")))	  (const_int 64))))   (clobber (match_scratch:DI 3 "=l"))]  "TARGET_64BIT && !TARGET_FIX_R4000   && !(<CODE> == ZERO_EXTEND && TARGET_FIX_VR4120)"  "dmult<u>\t%1,%2"  [(set_attr "type" "imul")   (set_attr "mode" "DI")]);; The R4650 supports a 32 bit multiply/ 64 bit accumulate;; instruction.  The HI/LO registers are used as a 64 bit accumulator.(define_insn "madsi"  [(set (match_operand:SI 0 "register_operand" "+l")	(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")			  (match_operand:SI 2 "register_operand" "d"))		 (match_dup 0)))   (clobber (match_scratch:SI 3 "=h"))]  "TARGET_MAD"  "mad\t%1,%2"  [(set_attr "type"	"imadd")   (set_attr "mode"	"SI")])(define_insn "*<su>mul_acc_di"  [(set (match_operand:DI 0 "register_operand" "=x")	(plus:DI	 (mult:DI (any_extend:DI (match_operand:SI 1 "register_operand" "d"))		  (any_extend:DI (match_operand:SI 2 "register_operand" "d")))	 (match_operand:DI 3 "register_operand" "0")))]  "(TARGET_MAD || ISA_HAS_MACC || TARGET_ALLEGREX)   && !TARGET_64BIT"{  if (TARGET_MAD)    return "mad<u>\t%1,%2";  else if (TARGET_MIPS5500 || TARGET_ALLEGREX)    return "madd<u>\t%1,%2";  else    /* See comment in *macc.  */    return "%[macc<u>\t%@,%1,%2%]";}  [(set_attr "type" "imadd")   (set_attr "mode" "SI")]);; Floating point multiply accumulate instructions.(define_insn "*madd<mode>"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(plus:ANYF (mult:ANYF (match_operand:ANYF 1 "register_operand" "f")			      (match_operand:ANYF 2 "register_operand" "f"))		   (match_operand:ANYF 3 "register_operand" "f")))]  "ISA_HAS_FP4 && TARGET_FUSED_MADD"  "madd.<fmt>\t%0,%3,%1,%2"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")])(define_insn "*msub<mode>"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(minus:ANYF (mult:ANYF (match_operand:ANYF 1 "register_operand" "f")			       (match_operand:ANYF 2 "register_operand" "f"))		    (match_operand:ANYF 3 "register_operand" "f")))]  "ISA_HAS_FP4 && TARGET_FUSED_MADD"  "msub.<fmt>\t%0,%3,%1,%2"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")])(define_insn "*nmadd<mode>"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(neg:ANYF (plus:ANYF		   (mult:ANYF (match_operand:ANYF 1 "register_operand" "f")			      (match_operand:ANYF 2 "register_operand" "f"))		   (match_operand:ANYF 3 "register_operand" "f"))))]  "ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD   && HONOR_SIGNED_ZEROS (<MODE>mode)"  "nmadd.<fmt>\t%0,%3,%1,%2"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")])(define_insn "*nmadd<mode>_fastmath"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(minus:ANYF	 (mult:ANYF (neg:ANYF (match_operand:ANYF 1 "register_operand" "f"))		    (match_operand:ANYF 2 "register_operand" "f"))	 (match_operand:ANYF 3 "register_operand" "f")))]  "ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD   && !HONOR_SIGNED_ZEROS (<MODE>mode)"  "nmadd.<fmt>\t%0,%3,%1,%2"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")])(define_insn "*nmsub<mode>"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(neg:ANYF (minus:ANYF		   (mult:ANYF (match_operand:ANYF 2 "register_operand" "f")			      (match_operand:ANYF 3 "register_operand" "f"))		   (match_operand:ANYF 1 "register_operand" "f"))))]  "ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD   && HONOR_SIGNED_ZEROS (<MODE>mode)"  "nmsub.<fmt>\t%0,%1,%2,%3"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")])(define_insn "*nmsub<mode>_fastmath"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(minus:ANYF	 (match_operand:ANYF 1 "register_operand" "f")	 (mult:ANYF (match_operand:ANYF 2 "register_operand" "f")		    (match_operand:ANYF 3 "register_operand" "f"))))]  "ISA_HAS_NMADD_NMSUB && TARGET_FUSED_MADD   && !HONOR_SIGNED_ZEROS (<MODE>mode)"  "nmsub.<fmt>\t%0,%1,%2,%3"  [(set_attr "type" "fmadd")   (set_attr "mode" "<UNITMODE>")]);;;;  ....................;;;;	DIVISION and REMAINDER;;;;  ....................;;(define_expand "div<mode>3"  [(set (match_operand:ANYF 0 "register_operand")	(div:ANYF (match_operand:ANYF 1 "reg_or_1_operand")		  (match_operand:ANYF 2 "register_operand")))]  "<divide_condition>"{  if (const_1_operand (operands[1], <MODE>mode))    if (!(ISA_HAS_FP4 && flag_unsafe_math_optimizations))      operands[1] = force_reg (<MODE>mode, operands[1]);});; These patterns work around the early SB-1 rev2 core "F1" erratum:;;;; If an mfc1 or dmfc1 happens to access the floating point register;; file at the same time a long latency operation (div, sqrt, recip,;; sqrt) iterates an intermediate result back through the floating;; point register file bypass, then instead returning the correct;; register value the mfc1 or dmfc1 operation returns the intermediate;; result of the long latency operation.;;;; The workaround is to insert an unconditional 'mov' from/to the;; long latency op destination register.(define_insn "*div<mode>3"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(div:ANYF (match_operand:ANYF 1 "register_operand" "f")		  (match_operand:ANYF 2 "register_operand" "f")))]  "<divide_condition>"{  if (TARGET_FIX_SB1)    return "div.<fmt>\t%0,%1,%2\;mov.<fmt>\t%0,%0";  else    return "div.<fmt>\t%0,%1,%2";}  [(set_attr "type" "fdiv")   (set_attr "mode" "<UNITMODE>")   (set (attr "length")        (if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))                      (const_int 8)                      (const_int 4)))])(define_insn "*recip<mode>3"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(div:ANYF (match_operand:ANYF 1 "const_1_operand" "")		  (match_operand:ANYF 2 "register_operand" "f")))]  "<recip_condition> && flag_unsafe_math_optimizations"{  if (TARGET_FIX_SB1)    return "recip.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";  else    return "recip.<fmt>\t%0,%2";}  [(set_attr "type" "frdiv")   (set_attr "mode" "<UNITMODE>")   (set (attr "length")        (if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))                      (const_int 8)                      (const_int 4)))]);; VR4120 errata MD(A1): signed division instructions do not work correctly;; with negative operands.  We use special libgcc functions instead.(define_insn "divmod<mode>4"  [(set (match_operand:GPR 0 "register_operand" "=l")	(div:GPR (match_operand:GPR 1 "register_operand" "d")		 (match_operand:GPR 2 "register_operand" "d")))   (set (match_operand:GPR 3 "register_operand" "=h")	(mod:GPR (match_dup 1)		 (match_dup 2)))]  "!TARGET_FIX_VR4120"  { return mips_output_division ("<d>div\t$0,%1,%2", operands); }  [(set_attr "type" "idiv")   (set_attr "mode" "<MODE>")])(define_insn "udivmod<mode>4"  [(set (match_operand:GPR 0 "register_operand" "=l")	(udiv:GPR (match_operand:GPR 1 "register_operand" "d")		  (match_operand:GPR 2 "register_operand" "d")))   (set (match_operand:GPR 3 "register_operand" "=h")	(umod:GPR (match_dup 1)		  (match_dup 2)))]  ""  { return mips_output_division ("<d>divu\t$0,%1,%2", operands); }  [(set_attr "type" "idiv")   (set_attr "mode" "<MODE>")]);;;;  ....................;;;;	SQUARE ROOT;;;;  ....................;; These patterns work around the early SB-1 rev2 core "F1" erratum (see;; "*div[sd]f3" comment for details).(define_insn "sqrt<mode>2"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(sqrt:ANYF (match_operand:ANYF 1 "register_operand" "f")))]  "<sqrt_condition>"{  if (TARGET_FIX_SB1)    return "sqrt.<fmt>\t%0,%1\;mov.<fmt>\t%0,%0";  else    return "sqrt.<fmt>\t%0,%1";}  [(set_attr "type" "fsqrt")   (set_attr "mode" "<UNITMODE>")   (set (attr "length")        (if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))                      (const_int 8)                      (const_int 4)))])(define_insn "*rsqrt<mode>a"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(div:ANYF (match_operand:ANYF 1 "const_1_operand" "")		  (sqrt:ANYF (match_operand:ANYF 2 "register_operand" "f"))))]  "<recip_condition> && flag_unsafe_math_optimizations"{  if (TARGET_FIX_SB1)    return "rsqrt.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";  else    return "rsqrt.<fmt>\t%0,%2";}  [(set_attr "type" "frsqrt")   (set_attr "mode" "<UNITMODE>")   (set (attr "length")        (if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))                      (const_int 8)                      (const_int 4)))])(define_insn "*rsqrt<mode>b"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(sqrt:ANYF (div:ANYF (match_operand:ANYF 1 "const_1_operand" "")			     (match_operand:ANYF 2 "register_operand" "f"))))]  "<recip_condition> && flag_unsafe_math_optimizations"{  if (TARGET_FIX_SB1)    return "rsqrt.<fmt>\t%0,%2\;mov.<fmt>\t%0,%0";  else    return "rsqrt.<fmt>\t%0,%2";}  [(set_attr "type" "frsqrt")   (set_attr "mode" "<UNITMODE>")   (set (attr "length")        (if_then_else (ne (symbol_ref "TARGET_FIX_SB1") (const_int 0))                      (const_int 8)                      (const_int 4)))]);;;;  ....................;;;;	ABSOLUTE VALUE;;;;  ....................;; Do not use the integer abs macro instruction, since that signals an;; exception on -2147483648 (sigh).(define_insn "abs<mode>2"  [(set (match_operand:GPR 0 "register_operand" "=d")	(abs:GPR (match_operand:GPR 1 "register_operand" "d")))]  "!TARGET_MIPS16"{  if (REGNO (operands[0]) == REGNO (operands[1]) && GENERATE_BRANCHLIKELY)    return "%(bltzl\t%1,1f\;<d>subu\t%0,%.,%0\n%~1:%)";  else    return "%(bgez\t%1,1f\;move\t%0,%1\;<d>subu\t%0,%.,%0\n%~1:%)";}  [(set_attr "type" "multi")   (set_attr "mode" "<MODE>")   (set_attr "length" "12")])(define_insn "abs<mode>2"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(abs:ANYF (match_operand:ANYF 1 "register_operand" "f")))]  ""  "abs.<fmt>\t%0,%1"  [(set_attr "type" "fabs")   (set_attr "mode" "<UNITMODE>")]);;;;  ....................;;;;	FIND FIRST BIT INSTRUCTION;;;;  ....................;;(define_expand "ffs<mode>2"  [(set (match_operand:GPR 0 "register_operand" "")	(ffs:GPR (match_operand:GPR 1 "register_operand" "")))]  "ISA_HAS_CLZ_CLO"{  rtx r1, r2, r3, r4;  r1 = gen_reg_rtx (<MODE>mode);  r2 = gen_reg_rtx (<MODE>mode);  r3 = gen_reg_rtx (<MODE>mode);  r4 = gen_reg_rtx (<MODE>mode);  emit_insn (gen_neg<mode>2 (r1, operands[1]));  emit_insn (gen_and<mode>3 (r2, operands[1], r1));  emit_insn (gen_clz<mode>2 (r3, r2));  emit_move_insn (r4, GEN_INT (GET_MODE_BITSIZE (<MODE>mode)));  emit_insn (gen_sub<mode>3 (operands[0], r4, r3));  DONE;});;;;  ...................;;;;  Count leading zeroes.;;;;  ...................;;(define_insn "clz<mode>2"  [(set (match_operand:GPR 0 "register_operand" "=d")	(clz:GPR (match_operand:GPR 1 "register_operand" "d")))]  "ISA_HAS_CLZ_CLO"  "<d>clz\t%0,%1"  [(set_attr "type" "clz")   (set_attr "mode" "<MODE>")]);;;;  ....................;;;;	NEGATION and ONE'S COMPLEMENT;;;;  ....................(define_insn "negsi2"  [(set (match_operand:SI 0 "register_operand" "=d")	(neg:SI (match_operand:SI 1 "register_operand" "d")))]  ""{  if (TARGET_MIPS16)    return "neg\t%0,%1";  else    return "subu\t%0,%.,%1";}  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")])(define_insn "negdi2"  [(set (match_operand:DI 0 "register_operand" "=d")	(neg:DI (match_operand:DI 1 "register_operand" "d")))]  "TARGET_64BIT && !TARGET_MIPS16"  "dsubu\t%0,%.,%1"  [(set_attr "type"	"arith")   (set_attr "mode"	"DI")])(define_insn "neg<mode>2"  [(set (match_operand:ANYF 0 "register_operand" "=f")	(neg:ANYF (match_operand:ANYF 1 "register_operand" "f")))]  ""  "neg.<fmt>\t%0,%1"  [(set_attr "type" "fneg")   (set_attr "mode" "<UNITMODE>")])(define_insn "one_cmpl<mode>2"  [(set (match_operand:GPR 0 "register_operand" "=d")	(not:GPR (match_operand:GPR 1 "register_operand" "d")))]  ""{  if (TARGET_MIPS16)    return "not\t%0,%1";  else    return "nor\t%0,

⌨️ 快捷键说明

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