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

📄 m32r.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
  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 "reg_or_uint16_operand" "r,K")))]  ""  "*{  /* If we are worried about space, see if we can break this up into two     short instructions, which might eliminate a NOP being inserted.  */  if (optimize_size      && m32r_not_same_reg (operands[0], operands[1])      && GET_CODE (operands[2]) == CONST_INT      && INT8_P (INTVAL (operands[2])))    return \"#\";  else if (GET_CODE (operands[2]) == CONST_INT)    return \"and3 %0,%1,%#%X2\";  return \"and %0,%2\";}"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_split  [(set (match_operand:SI 0 "register_operand" "")	(and:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "int8_operand" "")))]  "optimize_size && m32r_not_same_reg (operands[0], operands[1])"  [(set (match_dup 0) (match_dup 2))   (set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))]  "")(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 "reg_or_uint16_operand" "r,K")))]  ""  "*{  /* If we are worried about space, see if we can break this up into two     short instructions, which might eliminate a NOP being inserted.  */  if (optimize_size      && m32r_not_same_reg (operands[0], operands[1])      && GET_CODE (operands[2]) == CONST_INT      && INT8_P (INTVAL (operands[2])))    return \"#\";  else if (GET_CODE (operands[2]) == CONST_INT)    return \"or3 %0,%1,%#%X2\";  return \"or %0,%2\";}"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_split  [(set (match_operand:SI 0 "register_operand" "")	(ior:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "int8_operand" "")))]  "optimize_size && m32r_not_same_reg (operands[0], operands[1])"  [(set (match_dup 0) (match_dup 2))   (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 1)))]  "")(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 "reg_or_uint16_operand" "r,K")))]  ""  "*{  /* If we are worried about space, see if we can break this up into two     short instructions, which might eliminate a NOP being inserted.  */  if (optimize_size      && m32r_not_same_reg (operands[0], operands[1])      && GET_CODE (operands[2]) == CONST_INT      && INT8_P (INTVAL (operands[2])))    return \"#\";  else if (GET_CODE (operands[2]) == CONST_INT)    return \"xor3 %0,%1,%#%X2\";  return \"xor %0,%2\";}"  [(set_attr "type" "int2,int4")   (set_attr "length" "2,4")])(define_split  [(set (match_operand:SI 0 "register_operand" "")	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "int8_operand" "")))]  "optimize_size && m32r_not_same_reg (operands[0], operands[1])"  [(set (match_dup 0) (match_dup 2))   (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))]  "")(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:CC (match_operand:SI 0 "register_operand" "")		    (match_operand:SI 1 "reg_or_cmp_int16_operand" "")))]  ""  "{  m32r_compare_op0 = operands[0];  m32r_compare_op1 = operands[1];  DONE;}")(define_insn "cmp_eqsi_zero_insn"  [(set (reg:SI 17)        (eq:SI (match_operand:SI 0 "register_operand" "r,r")               (match_operand:SI 1 "reg_or_zero_operand" "r,P")))]  "TARGET_M32RX"  "@   cmpeq %0, %1   cmpz  %0"  [(set_attr "type" "int4")   (set_attr "length" "4")]);; 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_int16_operand" "r,J")))]  ""  "@   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/nonzero.(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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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

⌨️ 快捷键说明

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