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

📄 mn10300.md

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 MD
📖 第 1 页 / 共 5 页
字号:
  [(set (match_operand:SI 0 "register_operand" "=dx,a,x,a,dax,!*y,!dax")	(plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,dax")		 (match_operand:SI 2 "nonmemory_operand" "J,J,L,L,daxi,i,dax")))]  "TARGET_AM33"  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"inc %0\";    case 2:    case 3:      return \"inc4 %0\";    case 4:    case 5:      return \"add %2,%0\";    case 6:      {	enum reg_class src1_class, src2_class, dst_class;	src1_class = REGNO_REG_CLASS (true_regnum (operands[1]));	src2_class = REGNO_REG_CLASS (true_regnum (operands[2]));	dst_class = REGNO_REG_CLASS (true_regnum (operands[0]));		/* I'm not sure if this can happen or not.  Might as well be prepared	  and generate the best possible code if it does happen.  */	if (true_regnum (operands[0]) == true_regnum (operands[1]))	  return \"add %2,%0\";	if (true_regnum (operands[0]) == true_regnum (operands[2]))	  return \"add %1,%0\";	/* Catch cases where no extended register was used.  These should be	   handled just like the mn10300.  */	if (src1_class != EXTENDED_REGS	    && src2_class != EXTENDED_REGS	    && dst_class != EXTENDED_REGS)	  {	    /* We have to copy one of the sources into the destination, then	       add the other source to the destination.	       Carefully select which source to copy to the destination; a naive	       implementation will waste a byte when the source classes are 	       different and the destination is an address register.  Selecting	       the lowest cost register copy will optimize this sequence.  */	    if (REGNO_REG_CLASS (true_regnum (operands[1]))		== REGNO_REG_CLASS (true_regnum (operands[0])))	      return \"mov %1,%0\;add %2,%0\";	    return \"mov %2,%0\;add %1,%0\";	  }	/* At least one register is an extended register.  */	/* The three operand add instruction on the am33 is a win iff the	   output register is an extended register, or if both source	   registers are extended registers.  */	if (dst_class == EXTENDED_REGS	    || src1_class == src2_class)	  return \"add %2,%1,%0\";      /* It is better to copy one of the sources to the destination, then	 perform a 2 address add.  The destination in this case must be	 an address or data register and one of the sources must be an	 extended register and the remaining source must not be an extended	 register.	 The best code for this case is to copy the extended reg to the	 destination, then emit a two address add.  */      if (src1_class == EXTENDED_REGS)	return \"mov %1,%0\;add %2,%0\";      return \"mov %2,%0\;add %1,%0\";      }    default:      abort ();    }}"  [(set_attr "cc" "set_zn,none_0hit,set_zn,none_0hit,set_zn,none_0hit,set_zn")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx,a,a,dax,!*y,!dax")	(plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,dax")		 (match_operand:SI 2 "nonmemory_operand" "J,J,L,daxi,i,dax")))]  ""  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"inc %0\";    case 2:      return \"inc4 %0\";    case 3:    case 4:      return \"add %2,%0\";    case 5:      /* I'm not sure if this can happen or not.  Might as well be prepared	 and generate the best possible code if it does happen.  */      if (true_regnum (operands[0]) == true_regnum (operands[1]))	return \"add %2,%0\";      if (true_regnum (operands[0]) == true_regnum (operands[2]))	return \"add %1,%0\";      /* We have to copy one of the sources into the destination, then add	 the other source to the destination.	 Carefully select which source to copy to the destination; a naive	 implementation will waste a byte when the source classes are different	 and the destination is an address register.  Selecting the lowest	 cost register copy will optimize this sequence.  */      if (REGNO_REG_CLASS (true_regnum (operands[1]))	  == REGNO_REG_CLASS (true_regnum (operands[0])))	return \"mov %1,%0\;add %2,%0\";      return \"mov %2,%0\;add %1,%0\";    default:      abort ();    }}"  [(set_attr "cc" "set_zn,none_0hit,none_0hit,set_zn,none_0hit,set_zn")]);; ----------------------------------------------------------------------;; SUBTRACT INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "subsi3"  [(set (match_operand:SI 0 "register_operand" "")	(minus:SI (match_operand:SI 1 "register_operand" "")		  (match_operand:SI 2 "nonmemory_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dax,!dax")	(minus:SI (match_operand:SI 1 "register_operand" "0,dax")		  (match_operand:SI 2 "nonmemory_operand" "daxi,dax")))]  "TARGET_AM33"  "*{  if (true_regnum (operands[0]) == true_regnum (operands[1]))    return \"sub %2,%0\";  else    {      enum reg_class src1_class, src2_class, dst_class;      src1_class = REGNO_REG_CLASS (true_regnum (operands[1]));      src2_class = REGNO_REG_CLASS (true_regnum (operands[2]));      dst_class = REGNO_REG_CLASS (true_regnum (operands[0]));      /* If no extended registers are used, then the best way to handle	 this is to copy the first source operand into the destination	 and emit a two address subtraction.  */      if (src1_class != EXTENDED_REGS	  && src2_class != EXTENDED_REGS	  && dst_class != EXTENDED_REGS	  && true_regnum (operands[0]) != true_regnum (operands[2]))	return \"mov %1,%0\;sub %2,%0\";      return \"sub %2,%1,%0\";    }}"  [(set_attr "cc" "set_zn")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dax")	(minus:SI (match_operand:SI 1 "register_operand" "0")		  (match_operand:SI 2 "nonmemory_operand" "daxi")))]  ""  "sub %2,%0"  [(set_attr "cc" "set_zn")])(define_expand "negsi2"  [(set (match_operand:SI 0 "register_operand" "")        (neg:SI (match_operand:SI 1 "register_operand" "")))]  ""  "{  rtx target = gen_reg_rtx (SImode);  emit_move_insn (target, const0_rtx);  emit_insn (gen_subsi3 (target, target, operands[1]));  emit_move_insn (operands[0], target);  DONE;}");; ----------------------------------------------------------------------;; MULTIPLY INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "mulsidi3"  [(set (match_operand:DI 0 "register_operand" "=dax")        (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "dax"))                 (sign_extend:DI (match_operand:SI 2 "register_operand" "dax"))))]  "TARGET_AM33"  "mul %1,%2,%H0,%L0"  [(set_attr "cc" "set_zn")])(define_insn "umulsidi3"  [(set (match_operand:DI 0 "register_operand" "=dax")        (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "dax"))                 (zero_extend:DI (match_operand:SI 2 "register_operand" "dax"))))]  "TARGET_AM33"  "mulu %1,%2,%H0,%L0"  [(set_attr "cc" "set_zn")])(define_expand "mulsi3"  [(set (match_operand:SI 0 "register_operand" "")	(mult:SI (match_operand:SI 1 "register_operand" "")		 (match_operand:SI 2 "register_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx,!dax")	(mult:SI (match_operand:SI 1 "register_operand" "%0,0")		 (match_operand:SI 2 "nonmemory_operand" "dx,daxi")))]  "TARGET_AM33"  "*{  if (TARGET_MULT_BUG)    return \"nop\;nop\;mul %2,%0\";  else    return \"mul %2,%0\";}"  [(set_attr "cc" "set_zn")])  (define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx")	(mult:SI (match_operand:SI 1 "register_operand" "%0")		 (match_operand:SI 2 "register_operand" "dx")))]  ""  "*{  if (TARGET_MULT_BUG)    return \"nop\;nop\;mul %2,%0\";  else    return \"mul %2,%0\";}"  [(set_attr "cc" "set_zn")])(define_insn "udivmodsi4"  [(set (match_operand:SI 0 "nonimmediate_operand" "=dx")	(udiv:SI (match_operand:SI 1 "general_operand" "0")		 (match_operand:SI 2 "general_operand" "dx")))   (set (match_operand:SI 3 "nonimmediate_operand" "=&d")	(umod:SI (match_dup 1) (match_dup 2)))]  ""  "*{  output_asm_insn (\"sub %3,%3\;mov %3,mdr\", operands);  if (find_reg_note (insn, REG_UNUSED, operands[3]))    return \"divu %2,%0\";  else    return \"divu %2,%0\;mov mdr,%3\";}"  [(set_attr "cc" "set_zn")])(define_insn "divmodsi4"  [(set (match_operand:SI 0 "nonimmediate_operand" "=dx")	(div:SI (match_operand:SI 1 "general_operand" "0")		 (match_operand:SI 2 "general_operand" "dx")))   (set (match_operand:SI 3 "nonimmediate_operand" "=d")	(mod:SI (match_dup 1) (match_dup 2)))]  ""  "*{  if (find_reg_note (insn, REG_UNUSED, operands[3]))    return \"ext %0\;div %2,%0\";  else    return \"ext %0\;div %2,%0\;mov mdr,%3\";}"  [(set_attr "cc" "set_zn")]);; ----------------------------------------------------------------------;; AND INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "andsi3"  [(set (match_operand:SI 0 "register_operand" "")	(and:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "nonmemory_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx,dx,!dax")	(and:SI (match_operand:SI 1 "register_operand" "%0,0,dax")		(match_operand:SI 2 "nonmemory_operand" "N,dxi,dax")))]  "TARGET_AM33"  "*{  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xff)    return \"extbu %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xffff)    return \"exthu %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x7fffffff)    return \"add %0,%0\;lsr 1,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x3fffffff)    return \"asl2 %0\;lsr 2,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x1fffffff)    return \"add %0,%0\;asl2 %0\;lsr 3,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x0fffffff)    return \"asl2 %0\;asl2 %0\;lsr 4,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffe)    return \"lsr 1,%0\;add %0,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffc)    return \"lsr 2,%0\;asl2 %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff8)    return \"lsr 3,%0\;add %0,%0\;asl2 %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff0)    return \"lsr 4,%0\;asl2 %0\;asl2 %0\";  if (REG_P (operands[2]) && REG_P (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[2])      && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS      && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS      && REGNO_REG_CLASS (true_regnum (operands[2])) == DATA_REGS)    return \"mov %1,%0\;and %2,%0\";  if (REG_P (operands[2]) && REG_P (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[2]))    return \"and %1,%2,%0\";  if (REG_P (operands[2]) && REG_P (operands[0])      && true_regnum (operands[2]) == true_regnum (operands[0]))    return \"and %1,%0\";  return \"and %2,%0\";}"  [(set (attr "cc")	(cond	 [	 (eq (symbol_ref "which_alternative") (const_int 0)	     ) (const_string "none_0hit")	 (ne (symbol_ref "GET_CODE (operands[2]) == CONST_INT			  && (INTVAL (operands[2]) == 0x7fffffff			      || INTVAL (operands[2]) == 0x3fffffff			      || INTVAL (operands[2]) == 0x1fffffff			      || INTVAL (operands[2]) == 0x0fffffff			      || INTVAL (operands[2]) == 0xfffffffe			      || INTVAL (operands[2]) == 0xfffffffc			      || INTVAL (operands[2]) == 0xfffffff8			      || INTVAL (operands[2]) == 0xfffffff0)")	     (const_int 0)) (const_string "set_zn")	  ] (const_string "set_znv")))])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx,dx")	(and:SI (match_operand:SI 1 "register_operand" "%0,0")		(match_operand:SI 2 "nonmemory_operand" "N,dxi")))]  ""  "*{  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xff)    return \"extbu %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xffff)    return \"exthu %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x7fffffff)    return \"add %0,%0\;lsr 1,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x3fffffff)    return \"asl2 %0\;lsr 2,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x1fffffff)    return \"add %0,%0\;asl2 %0\;lsr 3,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x0fffffff)    return \"asl2 %0\;asl2 %0\;lsr 4,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffe)    return \"lsr 1,%0\;add %0,%0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffc)    return \"lsr 2,%0\;asl2 %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff8)    return \"lsr 3,%0\;add %0,%0\;asl2 %0\";  if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff0)    return \"lsr 4,%0\;asl2 %0\;asl2 %0\";  return \"and %2,%0\";}"  [(set (attr "cc")	(cond	 [	 (eq (symbol_ref "which_alternative") (const_int 0)	     ) (const_string "none_0hit")	 ;; Shifts don't set the V flag, but bitwise operations clear	 ;; it (which correctly reflects the absence of overflow in a	 ;; compare-with-zero that might follow).  As for the	 ;; 0xfffffffe case, the add may overflow, so we can't use the	 ;; V flag.	 (ne (symbol_ref "GET_CODE (operands[2]) == CONST_INT			  && (INTVAL (operands[2]) == 0x7fffffff			      || INTVAL (operands[2]) == 0x3fffffff			      || INTVAL (operands[2]) == 0x1fffffff			      || INTVAL (operands[2]) == 0x0fffffff			      || INTVAL (operands[2]) == 0xfffffffe			      || INTVAL (operands[2]) == 0xfffffffc			      || INTVAL (operands[2]) == 0xfffffff8			      || INTVAL (operands[2]) == 0xfffffff0)")	     (const_int 0)) (const_string "set_zn")	  ] (const_string "set_znv")))]);; ----------------------------------------------------------------------;; OR INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "iorsi3"  [(set (match_operand:SI 0 "register_operand" "")	(ior:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "nonmemory_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx,!dax")	(ior:SI (match_operand:SI 1 "register_operand" "%0,dax")		(match_operand:SI 2 "nonmemory_operand" "dxi,dax")))]  "TARGET_AM33"  "*{  if (REG_P (operands[2]) && REG_P (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[2])      && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS      && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS      && REGNO_REG_CLASS (true_regnum (operands[2])) == DATA_REGS)    return \"mov %1,%0\;or %2,%0\";  if (REG_P (operands[2]) && REG_P (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[1])      && true_regnum (operands[0]) != true_regnum (operands[2]))    return \"or %1,%2,%0\";  if (REG_P (operands[2]) && REG_P (operands[0])      && true_regnum (operands[2]) == true_regnum (operands[0]))    return \"or %1,%0\";  return \"or %2,%0\";}"  [(set_attr "cc" "set_znv")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=dx")	(ior:SI (match_operand:SI 1 "register_operand" "%0")		(match_operand:SI 2 "nonmemory_operand" "dxi")))]  ""  "or %2,%0"  [(set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; XOR INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "xorsi3"  [(set (match_operand:SI 0 "register_operand" "")	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "nonmemory_operand" "")))]  ""  "")

⌨️ 快捷键说明

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