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

📄 m32r.md

📁 gcc编译工具没有什么特别
💻 MD
📖 第 1 页 / 共 4 页
字号:
{  operands[4] = operand_subword (operands[0], (WORDS_BIG_ENDIAN != 0), 0, DImode);  operands[5] = operand_subword (operands[2], (WORDS_BIG_ENDIAN != 0), 0, DImode);  operands[6] = operand_subword (operands[0], (WORDS_BIG_ENDIAN == 0), 0, DImode);  operands[7] = operand_subword (operands[2], (WORDS_BIG_ENDIAN == 0), 0, DImode);}")(define_insn "*sub_carry"  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 1 "register_operand" "%0")		  (minus:SI (match_operand:SI 2 "register_operand" "r")			    (reg:SI 17))))   (set (reg:SI 17)	(unspec [(const_int 0)] 3))]  ""  "subx %0,%2"  [(set_attr "type" "int2")   (set_attr "length" "2")]); Multiply/Divide instructions.(define_insn "mulhisi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "r"))		 (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]  ""  "mullo %1,%2\;mvfacmi %0"  [(set_attr "type" "multi")   (set_attr "length" "4")])(define_insn "mulsi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(mult:SI (match_operand:SI 1 "register_operand" "%0")		 (match_operand:SI 2 "register_operand" "r")))]  ""  "mul %0,%2"  [(set_attr "type" "mul2")   (set_attr "length" "2")])(define_insn "divsi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(div:SI (match_operand:SI 1 "register_operand" "0")		(match_operand:SI 2 "register_operand" "r")))]  ""  "div %0,%2"  [(set_attr "type" "div4")   (set_attr "length" "4")])(define_insn "udivsi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(udiv:SI (match_operand:SI 1 "register_operand" "0")		 (match_operand:SI 2 "register_operand" "r")))]  ""  "divu %0,%2"  [(set_attr "type" "div4")   (set_attr "length" "4")])(define_insn "modsi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(mod:SI (match_operand:SI 1 "register_operand" "0")		(match_operand:SI 2 "register_operand" "r")))]  ""  "rem %0,%2"  [(set_attr "type" "div4")   (set_attr "length" "4")])(define_insn "umodsi3"  [(set (match_operand:SI 0 "register_operand" "=r")	(umod:SI (match_operand:SI 1 "register_operand" "0")		 (match_operand:SI 2 "register_operand" "r")))]  ""  "remu %0,%2"  [(set_attr "type" "div4")   (set_attr "length" "4")]);; Boolean instructions.;;;; We don't define the DImode versions as expand_binop does a good enough job.;; And if it doesn't it should be fixed.(define_insn "andsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(and:SI (match_operand:SI 1 "register_operand" "%0,r")		(match_operand:SI 2 "nonmemory_operand" "r,K")))]  ""  "@   and %0,%2   and3 %0,%1,%#%2\\t; %X2"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_insn "iorsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(ior:SI (match_operand:SI 1 "register_operand" "%0,r")		(match_operand:SI 2 "nonmemory_operand" "r,K")))]  ""  "@   or %0,%2   or3 %0,%1,%#%2\\t; %X2"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_insn "xorsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(xor:SI (match_operand:SI 1 "register_operand" "%0,r")		(match_operand:SI 2 "nonmemory_operand" "r,K")))]  ""  "@   xor %0,%2   xor3 %0,%1,%#%2\\t; %X2"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_insn "negsi2"  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (match_operand:SI 1 "register_operand" "r")))]  ""  "neg %0,%1"  [(set_attr "type" "int2")   (set_attr "length" "2")])(define_insn "one_cmplsi2"  [(set (match_operand:SI 0 "register_operand" "=r")	(not:SI (match_operand:SI 1 "register_operand" "r")))]  ""  "not %0,%1"  [(set_attr "type" "int2")   (set_attr "length" "2")]);; Shift instructions.(define_insn "ashlsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r,r")	(ashift:SI (match_operand:SI 1 "register_operand" "0,0,r")		   (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]  ""  "@   sll %0,%2   slli %0,%#%2   sll3 %0,%1,%#%2"  [(set_attr "type" "shift2,shift2,shift4")   (set_attr "length" "2,2,4")])(define_insn "ashrsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r,r")	(ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")		     (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]  ""  "@   sra %0,%2   srai %0,%#%2   sra3 %0,%1,%#%2"  [(set_attr "type" "shift2,shift2,shift4")   (set_attr "length" "2,2,4")])(define_insn "lshrsi3"  [(set (match_operand:SI 0 "register_operand" "=r,r,r")	(lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")		     (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]  ""  "@   srl %0,%2   srli %0,%#%2   srl3 %0,%1,%#%2"  [(set_attr "type" "shift2,shift2,shift4")   (set_attr "length" "2,2,4")]);; Compare instructions.;; This controls RTL generation and register allocation.;; We generate RTL for comparisons and branches by having the cmpxx ;; patterns store away the operands.  Then the bcc patterns;; emit RTL for both the compare and the branch.;;;; On the m32r it is more efficient to use the bxxz instructions and;; thus merge the compare and branch into one instruction, so they are;; preferred.(define_expand "cmpsi"  [(set (reg:SI 17)	(compare:SI (match_operand:SI 0 "register_operand" "")		    (match_operand:SI 1 "nonmemory_operand" "")))]  ""  "{  m32r_compare_op0 = operands[0];  m32r_compare_op1 = operands[1];  DONE;}");; The cmp_xxx_insn patterns set the condition bit to the result of the;; comparison.  There isn't a "compare equal" instruction so cmp_eqsi_insn;; is quite inefficient.  However, it is rarely used.(define_insn "cmp_eqsi_insn"  [(set (reg:SI 17)	(eq:SI (match_operand:SI 0 "register_operand" "r,r")	       (match_operand:SI 1 "reg_or_cmp_int16_operand" "r,P")))   (clobber (match_scratch:SI 2 "=&r,&r"))]  ""  "*{  if (which_alternative == 0)    {         return \"mv %2,%0\;sub %2,%1\;cmpui %2,#1\";    }  else    {        if (INTVAL (operands [1]) == 0)          return \"cmpui %0, #1\";        else if (REGNO (operands [2]) == REGNO (operands [0]))          return \"addi %0,%#%N1\;cmpui %2,#1\";        else          return \"add3 %2,%0,%#%N1\;cmpui %2,#1\";    }}"  [(set_attr "type" "multi,multi")   (set_attr "length" "8,8")])(define_insn "cmp_ltsi_insn"  [(set (reg:SI 17)	(lt:SI (match_operand:SI 0 "register_operand" "r,r")	       (match_operand:SI 1 "reg_or_int16_operand" "r,J")))]  ""  "@   cmp %0,%1   cmpi %0,%#%1"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_insn "cmp_ltusi_insn"  [(set (reg:SI 17)	(ltu:SI (match_operand:SI 0 "register_operand" "r,r")	        (match_operand:SI 1 "reg_or_uint16_operand" "r,K")))]  ""  "@   cmpu %0,%1   cmpui %0,%#%1"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")]);; reg == small constant comparisons are best handled by putting the result;; of the comparison in a tmp reg and then using beqz/bnez.;; ??? The result register doesn't contain 0/STORE_FLAG_VALUE,;; it contains 0/non-zero.(define_insn "cmp_ne_small_const_insn"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(ne:SI (match_operand:SI 1 "register_operand" "0,r")	       (match_operand:SI 2 "cmp_int16_operand" "N,P")))]  ""  "@   addi %0,%#%N2   add3 %0,%1,%#%N2"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")]);; These control RTL generation for conditional jump insns.(define_expand "beq"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)EQ, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bne"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)NE, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bgt"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)GT, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "ble"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)LE, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bge"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)GE, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "blt"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)LT, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bgtu"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)GTU, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bleu"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)LEU, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bgeu"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)GEU, m32r_compare_op0, m32r_compare_op1, FALSE);}")(define_expand "bltu"  [(set (pc)	(if_then_else (match_dup 1)		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{  operands[1] = gen_compare ((int)LTU, m32r_compare_op0, m32r_compare_op1, FALSE);}");; Now match both normal and inverted jump.(define_insn "*branch_insn"  [(set (pc)	(if_then_else (match_operator 1 "eqne_comparison_operator"				      [(reg 17) (const_int 0)])		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "*{  static char instruction[40];  sprintf (instruction, \"%s%s %%l0\",	   (GET_CODE (operands[1]) == NE) ? \"bc\" : \"bnc\",	   (get_attr_length (insn) == 2) ? \".s\" : \"\");  return instruction;}"  [(set_attr "type" "branch")   ; We use 400/800 instead of 512,1024 to account for inaccurate insn   ; lengths and insn alignments that are complex to track.   ; It's not important that we be hyper-precise here.  It may be more   ; important blah blah blah when the chip supports parallel execution   ; blah blah blah but until then blah blah blah this is simple and   ; suffices.   (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))						 (const_int 400))					   (const_int 800))				      (const_int 2)				      (const_int 4)))])(define_insn "*rev_branch_insn"  [(set (pc)	(if_then_else (match_operator 1 "eqne_comparison_operator"				      [(reg 17) (const_int 0)])		      (pc)		      (label_ref (match_operand 0 "" ""))))]  ;"REVERSIBLE_CC_MODE (GET_MODE (XEXP (operands[1], 0)))"  ""  "*{  static char instruction[40];  sprintf (instruction, \"%s%s %%l0\",	   (GET_CODE (operands[1]) == EQ) ? \"bc\" : \"bnc\",	   (get_attr_length (insn) == 2) ? \".s\" : \"\");  return instruction;}"  [(set_attr "type" "branch")   ; We use 400/800 instead of 512,1024 to account for inaccurate insn   ; lengths and insn alignments that are complex to track.   ; It's not important that we be hyper-precise here.  It may be more   ; important blah blah blah when the chip supports parallel execution   ; blah blah blah but until then blah blah blah this is simple and   ; suffices.   (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))						 (const_int 400))					   (const_int 800))				      (const_int 2)				      (const_int 4)))]); reg/reg compare and branch insns(define_insn "*reg_branch_insn"  [(set (pc)	(if_then_else (match_operator 1 "eqne_comparison_operator"				      [(match_operand:SI 2 "register_operand" "r")				       (match_operand:SI 3 "register_operand" "r")])		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "*{  /* Is branch target reachable with beq/bne?  */  if (get_attr_length (insn) == 4)    {      if (GET_CODE (operands[1]) == EQ)	return \"beq %2,%3,%l0\";      else	return \"bne %2,%3,%l0\";    }

⌨️ 快捷键说明

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