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

📄 mn10300.md

📁 GCC编译器源代码
💻 MD
📖 第 1 页 / 共 3 页
字号:
(define_insn ""  [(set (match_operand:DF 0 "general_operand"				"=d,a,d,a,dm,dm,am,am,d,d,a,a")	(match_operand:DF 1 "general_operand"				"0,0,G,G,d,a,d,a,dim,aim,dim,aim"))]  "register_operand (operands[0], DFmode)   || register_operand (operands[1], DFmode)"  "*{  long val[2];  REAL_VALUE_TYPE rv;  switch (which_alternative)    {      case 0:      case 1:	return \"nop\";      case 2:	return \"clr %L0\;clr %H0\";      case 3:	  {	    rtx xoperands[2];	    xoperands[0] = operands[0];	    xoperands[1] = zero_areg ? zero_areg : operands[1];	    if (rtx_equal_p (xoperands[0], xoperands[1]))	      output_asm_insn (\"sub %L1,%L0\;mov %L0,%H0\", xoperands);	    else	      output_asm_insn (\"mov %1,%L0\;mov %L0,%H0\", xoperands);	    return \"\";	  }      case 4:      case 5:      case 6:      case 7:      case 8:      case 9:      case 10:      case 11:	if (GET_CODE (operands[1]) == CONST_INT)	  {	    val[0] = INTVAL (operands[1]);	    val[1] = val[0] < 0 ? -1 : 0;	  }	if (GET_CODE (operands[1]) == CONST_DOUBLE)	  {	    if (GET_MODE (operands[1]) == DFmode)	      {		REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);		REAL_VALUE_TO_TARGET_DOUBLE (rv, val);	      }	    else if (GET_MODE (operands[1]) == VOIDmode		     || GET_MODE (operands[1]) == DImode)	      {		val[0] = CONST_DOUBLE_LOW (operands[1]);		val[1] = CONST_DOUBLE_HIGH (operands[1]);	      }	  }	if (GET_CODE (operands[1]) == MEM	    && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))	  {	    rtx temp = operands[0];	    while (GET_CODE (temp) == SUBREG)	      temp = SUBREG_REG (temp);	    if (GET_CODE (temp) != REG)	      abort ();	    if (reg_overlap_mentioned_p (gen_rtx (REG, SImode, REGNO (temp)),					 XEXP (operands[1], 0)))	      return \"mov %H1,%H0\;mov %L1,%L0\";	    else	      return \"mov %L1,%L0\;mov %H1,%H0\";	      	  }	else if (GET_CODE (operands[1]) == MEM		 && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))		 && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)	  {	    rtx xoperands[2];	    xoperands[0] = operands[0];	    xoperands[1] = XEXP (operands[1], 0);	    output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",			     xoperands);	    return \"\";	  }	else	  {	    if ((GET_CODE (operands[1]) == CONST_INT		 || GET_CODE (operands[1]) == CONST_DOUBLE)		&& val[0] == 0)	      {		if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)		  output_asm_insn (\"clr %L0\", operands);	        else if (zero_areg)		  {		    rtx xoperands[2];		    xoperands[0] = operands[0];		    xoperands[1] = zero_areg;		    if (rtx_equal_p (xoperands[0], xoperands[1]))		      output_asm_insn (\"sub %L0,%L0\", xoperands);		    else		      output_asm_insn (\"mov %1,%L0\", xoperands);		  }		else		  output_asm_insn (\"mov %L1,%L0\", operands);	      }	    else	      output_asm_insn (\"mov %L1,%L0\", operands);	    if ((GET_CODE (operands[1]) == CONST_INT		 || GET_CODE (operands[1]) == CONST_DOUBLE)		&& val[1] == 0)	      {		if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)		  output_asm_insn (\"clr %H0\", operands);		else if (zero_areg)		  {		    rtx xoperands[2];		    xoperands[0] = operands[0];		    xoperands[1] = zero_areg;		    if (rtx_equal_p (xoperands[0], xoperands[1]))		      output_asm_insn (\"sub %H0,%H0\", xoperands);		    else		      output_asm_insn (\"mov %1,%H0\", xoperands);		  }		else		  output_asm_insn (\"mov %H1,%H0\", operands);	      }	    else if ((GET_CODE (operands[1]) == CONST_INT		      || GET_CODE (operands[1]) == CONST_DOUBLE)		     && val[0] == val[1])	      output_asm_insn (\"mov %L0,%H0\", operands);	    else	      output_asm_insn (\"mov %H1,%H0\", operands);	    return \"\";	  }    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])  ;; ----------------------------------------------------------------------;; TEST INSTRUCTIONS;; ----------------------------------------------------------------------;; Go ahead and define tstsi so we can eliminate redundant tst insns;; when we start trying to optimize this port.(define_insn "tstsi"  [(set (cc0) (match_operand:SI 0 "register_operand" "da"))]  ""  "* return output_tst (operands[0], insn);"  [(set_attr "cc" "set_znv")])(define_insn ""  [(set (cc0) (zero_extend:SI (match_operand:QI 0 "memory_operand" "d")))]  ""  "* return output_tst (operands[0], insn);"  [(set_attr "cc" "set_znv")])(define_insn ""  [(set (cc0) (zero_extend:SI (match_operand:HI 0 "memory_operand" "d")))]  ""  "* return output_tst (operands[0], insn);"  [(set_attr "cc" "set_znv")])(define_insn "cmpsi"  [(set (cc0)	(compare (match_operand:SI 0 "register_operand" "!*d*a,da")		 (match_operand:SI 1 "nonmemory_operand" "!*0,dai")))]  ""  "@  add 0,%0  cmp %1,%0"  [(set_attr "cc" "invert,compare")]);; ----------------------------------------------------------------------;; ADD INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "addsi3"  [(set (match_operand:SI 0 "register_operand" "")	(plus:SI (match_operand:SI 1 "register_operand" "")		 (match_operand:SI 2 "nonmemory_operand" "")))]  ""  "{  /* We can't add a variable amount directly to the stack pointer;     so do so via a temporary register.  */  if (operands[0] == stack_pointer_rtx      && GET_CODE (operands[1]) != CONST_INT      && GET_CODE (operands[2]) != CONST_INT)   {     rtx temp = gen_reg_rtx (SImode);     emit_move_insn (temp, gen_rtx (PLUS, SImode, operands[1], operands[2]));     emit_move_insn (operands[0], temp);     DONE;   }}")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=d,a,a,da,x,&!da")	(plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,da")		 (match_operand:SI 2 "nonmemory_operand" "J,J,L,dai,i,da")))]  ""  "@  inc %0  inc %0  inc4 %0  add %2,%0  add %2,%0  mov %2,%0\;add %1,%0"  [(set_attr "cc" "set_zn,none_0hit,none_0hit,set_zn,none_0hit,set_zn")]);; ----------------------------------------------------------------------;; SUBTRACT INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "subsi3"  [(set (match_operand:SI 0 "register_operand" "=da")	(minus:SI (match_operand:SI 1 "register_operand" "0")		  (match_operand:SI 2 "nonmemory_operand" "dai")))]  ""  "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, GEN_INT (0));  emit_insn (gen_subsi3 (target, target, operands[1]));  emit_move_insn (operands[0], target);  DONE;}");; ----------------------------------------------------------------------;; MULTIPLY INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "mulsi3"  [(set (match_operand:SI 0 "register_operand" "=d")	(mult:SI (match_operand:SI 1 "register_operand" "%0")		 (match_operand:SI 2 "register_operand" "d")))]  ""  "*{  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 "general_operand" "=d")	(udiv:SI (match_operand:SI 1 "general_operand" "0")		 (match_operand:SI 2 "general_operand" "d")))   (set (match_operand:SI 3 "general_operand" "=&d")	(umod:SI (match_dup 1) (match_dup 2)))]  ""  "*{  if (zero_dreg)    output_asm_insn (\"mov %0,mdr\", &zero_dreg);  else    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 "general_operand" "=d")	(div:SI (match_operand:SI 1 "general_operand" "0")		 (match_operand:SI 2 "general_operand" "d")))   (set (match_operand:SI 3 "general_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_insn "andsi3"  [(set (match_operand:SI 0 "register_operand" "=d,d")	(and:SI (match_operand:SI 1 "register_operand" "%0,0")		(match_operand:SI 2 "nonmemory_operand" "N,di")))]  ""  "*{  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,%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" "none_0hit,set_znv")]);; ----------------------------------------------------------------------;; OR INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "iorsi3"  [(set (match_operand:SI 0 "register_operand" "=d")	(ior:SI (match_operand:SI 1 "register_operand" "%0")		(match_operand:SI 2 "nonmemory_operand" "di")))]  ""  "or %2,%0"  [(set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; XOR INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "xorsi3"  [(set (match_operand:SI 0 "register_operand" "=d")	(xor:SI (match_operand:SI 1 "register_operand" "%0")		(match_operand:SI 2 "nonmemory_operand" "di")))]  ""  "xor %2,%0"  [(set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; NOT INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "one_cmplsi2"  [(set (match_operand:SI 0 "register_operand" "=d")	(not:SI (match_operand:SI 1 "register_operand" "0")))]  ""  "not %0"  [(set_attr "cc" "set_znv")]);; -----------------------------------------------------------------;; BIT FIELDS;; -----------------------------------------------------------------;; These set/clear memory in byte sized chunks.;;;; They are no smaller/faster than loading the value into a register;; and storing the register, but they don't need a scratch register;; which may allow for better code generation.(define_insn ""  [(set (match_operand:QI 0 "general_operand" "=R,d") (const_int 0))]  ""  "@  bclr 255,%A0  clr %0"  [(set_attr "cc" "clobber")])(define_insn ""  [(set (match_operand:QI 0 "general_operand" "=R,d") (const_int -1))]  ""  "@  bset 255,%A0  mov -1,%0"  [(set_attr "cc" "clobber,none_0hit")])(define_insn ""  [(set (match_operand:QI 0 "general_operand" "=R,d")	(subreg:QI	  (and:SI (subreg:SI (match_dup 0) 0)		  (match_operand:SI 1 "const_int_operand" "i,i")) 0))]  ""  "@  bclr %N1,%A0  and %1,%0"  [(set_attr "cc" "clobber,set_znv")])(define_insn ""  [(set (match_operand:QI 0 "general_operand" "=R,d")	(subreg:QI	  (ior:SI (subreg:SI (match_dup 0) 0)		  (match_operand:SI 1 "const_int_operand" "i,i")) 0))]  ""  "@  bset %1,%A0  or %1,%0"  [(set_attr "cc" "clobber,set_znv")])(define_insn ""  [(set (cc0)     (zero_extract:SI (match_operand:SI 0 "register_operand" "d")		      (match_operand 1 "const_int_operand" "")		      (match_operand 2 "const_int_operand" "")))]  ""  "*{  int len = INTVAL (operands[1]);  int bit = INTVAL (operands[2]);  int mask = 0;  rtx xoperands[2];  while (len > 0)    {      mask |= (1 << bit);      bit++;      len--;    }  xoperands[0] = operands[0];  xoperands[1] = GEN_INT (mask);  output_asm_insn (\"btst %1,%0\", xoperands);  return \"\";}"  [(set_attr "cc" "set_znv")])(define_insn ""  [(set (cc0)     (zero_extract:SI (match_operand:QI 0 "general_operand" "R,d")		      (match_operand 1 "const_int_operand" "")		      (match_operand 2 "const_int_operand" "")))]  "INTVAL (operands[1]) <= 8 && INTVAL (operands[2]) <= 7"  "*{  int len = INTVAL (operands[1]);  int bit = INTVAL (operands[2]);  int mask = 0;  rtx xoperands[2];  while (len > 0)    {      mask |= (1 << bit);      bit++;      len--;    }

⌨️ 快捷键说明

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