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

📄 h8300.md

📁 GUN开源阻止下的编译器GCC
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; GCC machine description for Hitachi H8/300;; Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.;;   Contributed by Steve Chamberlain (sac@cygnus.com),;;   Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).;; This file is part of GNU CC.;; GNU CC is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; GNU CC is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU CC; see the file COPYING.  If not, write to;; the Free Software Foundation, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;; The original PO technology requires these to be ordered by speed,;; so that assigner will pick the fastest.;; See file "rtl.def" for documentation on define_insn, match_*, et. al.(define_attr "cpu" "h8300,h8300h"  (const (symbol_ref "cpu_type")));; ??? If we can remove the operand type on all the insns, do it.;; ??? Otherwise, try to have the operand type on all the insns.(define_attr "type" "branch,return,call,arith,move,float,multi"  (const_string "arith"));; The size of instructions in bytes.(define_attr "length" ""   (cond [(eq_attr "type" "branch")	 (if_then_else (and (ge (minus (pc) (match_dup 0))				(const_int -120))			    (le (minus (pc) (match_dup 0))				(const_int 120)))		       (const_int 2)		       (if_then_else (and (eq_attr "cpu" "h8300h")					  (and (ge (minus (pc) (match_dup 0))						   (const_int -32000))					       (le (minus (pc) (match_dup 0))						   (const_int 32000))))				     (const_int 4)				     (const_int 6)))	 (eq_attr "type" "move")	(const_int 4)	 (eq_attr "type" "return")	(const_int 2)	 (eq_attr "type" "float")	(const_int 12)	 (eq_attr "type" "call")	(const_int 4)]	(const_int 200)))(define_attr "cc" "none,clobber,none_0hit,set,compare,whoops,cbit"   (const_string "whoops"));; ----------------------------------------------------------------------;; MOVE INSTRUCTIONS;; ----------------------------------------------------------------------;; movqi(define_insn "movqi_push"  [(set (match_operand:QI 0 "push_operand" "=<")	(match_operand:QI 1 "register_operand" "r"))]  ""  "*{  if (TARGET_H8300)    return \"push.w	%T1\";  else    return \"push.l	%S1\";}"  [(set_attr "type" "move")   (set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))   (set_attr "cc" "set")])(define_insn "movqi_internal"  [(set (match_operand:QI 0 "general_operand_dst" "=r,r,r,o,<,r")	(match_operand:QI 1 "general_operand_src" "I,r>,io,r,r,c"))]  "register_operand (operands[0],QImode) || register_operand (operands[1], QImode)"  "@   sub.b	%X0,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0   xor		%X0,%X0\;bst	#0,%X0"  [(set_attr "type" "move")   (set_attr_alternative "length"     [(const_int 2) (const_int 2)      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4))      (const_int 4)])   (set_attr "cc" "set,set,set,set,set,none")])(define_expand "movqi"  [(set (match_operand:QI 0 "general_operand_dst" "")	(match_operand:QI 1 "general_operand_src" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand(operand0, QImode)      && !register_operand(operand1, QImode))    {      operands[1] = copy_to_mode_reg(QImode, operand1);    }}")(define_insn "movstrictqi"  [(set (strict_low_part (match_operand:QI 0 "general_operand_dst" "=r,r,r,o,<"))			 (match_operand:QI 1 "general_operand_src" "I,r,io,r,r"))]  ""  "@   sub.b	%X0,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0   mov.b	%X1,%X0"  [(set_attr "type" "move")   (set_attr_alternative "length"     [(const_int 2) (const_int 2)      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4))])   (set_attr "cc" "set")])   ;; movhi(define_insn "movhi_push"  [(set (match_operand:HI 0 "push_operand" "=<")	(match_operand:HI 1 "register_operand" "ra"))]  ""  "*{  if (TARGET_H8300)    return \"push.w	%T1\";  else    return \"push.l	%S1\";}"  [(set_attr "type" "move")   (set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))   (set_attr "cc" "set")])(define_insn "movhi_internal"  [(set (match_operand:HI 0 "general_operand_dst" "=ra,ra,ra,o,<")	(match_operand:HI 1 "general_operand_src" "I,ra>,ion,ra,ra"))]  ""  "@   sub.w	%T0,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0"  [(set_attr "type" "move")   (set_attr_alternative "length"     [(const_int 2) (const_int 2)      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4))])   (set_attr "cc" "set")])(define_expand "movhi"  [(set (match_operand:HI 0 "general_operand_dst" "")	(match_operand:HI 1 "general_operand_src" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand(operand1, HImode)      && !register_operand(operand0, HImode))    {      operands[1] = copy_to_mode_reg(HImode, operand1);    }}")(define_insn "movstricthi"  [(set (strict_low_part (match_operand:HI 0 "general_operand_dst" "=r,r,r,o,<"))			 (match_operand:HI 1 "general_operand_src" "I,r,io,r,r"))]  ""  "@   sub.w	%T0,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0   mov.w	%T1,%T0"  [(set_attr "type" "move")   (set_attr_alternative "length"     [(const_int 2) (const_int 2)      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))      (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4))])   (set_attr "cc" "set")]);; movsi(define_expand "movsi"  [(set (match_operand:SI 0 "general_operand_dst" "")	(match_operand:SI 1 "general_operand_src" ""))]  ""  "{  if (TARGET_H8300)    {      if (do_movsi (operands))	DONE;    }  else /* TARGET_H8300H */    {      /* One of the ops has to be in a register.  */      if (!register_operand (operand1, SImode)	  && !register_operand (operand0, SImode))	{	  operands[1] = copy_to_mode_reg (SImode, operand1);	}    }}")(define_expand "movsf"  [(set (match_operand:SF 0 "general_operand_dst" "")	(match_operand:SF 1 "general_operand_src" ""))]  ""  "{  if (TARGET_H8300)    {      if (do_movsi (operands))	DONE;    }  else /* TARGET_H8300H */    {      /* One of the ops has to be in a register.  */      if (!register_operand (operand1, SFmode)	  && !register_operand (operand0, SFmode))	{	  operands[1] = copy_to_mode_reg (SFmode, operand1);	}    }}")(define_insn "movsi_h8300"  [(set (match_operand:SI 0 "general_operand_dst" "=r,r,r,o,<,r")	(match_operand:SI 1 "general_operand_src" "I,r,ion,r,r,>"))]  "TARGET_H8300   && (register_operand (operands[0], SImode)       || register_operand (operands[1], SImode))"  "*{  int rn = -1;  switch (which_alternative)    {    case 0:      return \"sub.w	%e0,%e0\;sub.w	%f0,%f0\";    case 1:      if (REGNO(operands[0]) < REGNO(operands[1]))	return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";      else 	return \"mov.w	%f1,%f0\;mov.w	%e1,%e0\";    case 2:      /* Make sure we don't trample the register we index with.  */          if (GET_CODE(operands[1]) == MEM) 	{	  rtx inside = XEXP (operands[1],0);	  if  (REG_P (inside)) 	    {	      rn = REGNO(inside);	    }	  else if (GET_CODE (inside) == PLUS) 	    {	      rtx lhs = XEXP (inside,0);	      rtx rhs = XEXP (inside,1);	      if (REG_P (lhs)) rn = REGNO (lhs);	      if (REG_P (rhs)) rn = REGNO (rhs);	    }	}      if (rn == REGNO (operands[0])) 		{	  /* Move the second word first.  */	  return \"mov.w	%f1,%f0\;mov.w	%e1,%e0\";	}      else 	{	  return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";	}        case 3:      return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";    case 4:      return \"mov.w	%f1,%T0\;mov.w	%e1,%T0\";    case 5:      return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";    }}"  [(set_attr "type" "move")   (set_attr "length" "4,4,8,8,4,4")   (set_attr "cc" "clobber")])(define_insn "movsf_h8300"  [(set (match_operand:SF 0 "general_operand_dst" "=r,r,r,o,<,r")	(match_operand:SF 1 "general_operand_src" "I,r,ion,r,r,>"))]  "TARGET_H8300   && (register_operand (operands[0], SFmode)       || register_operand (operands[1], SFmode))"  "*{  /* Copy of the movsi stuff */  int rn = -1;  switch (which_alternative)    {    case 0:      return \"sub.w	%e0,%e0\;sub.w	%f0,%f0\";    case 1:      if (REGNO(operands[0]) < REGNO(operands[1]))	return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";      else 	return \"mov.w	%f1,%f0\;mov.w	%e1,%e0\";    case 2:      /* Make sure we don't trample the register we index with.  */          if (GET_CODE (operands[1]) == MEM) 	{	  rtx inside = XEXP (operands[1],0);	  if (REG_P (inside))	    {	      rn = REGNO (inside);	    }	  else if (GET_CODE (inside) == PLUS) 	    {	      rtx lhs = XEXP (inside,0);	      rtx rhs = XEXP (inside,1);	      if (REG_P (lhs)) rn = REGNO (lhs);	      if (REG_P (rhs)) rn = REGNO (rhs);	    }	}      if (rn == REGNO (operands[0]))	{	  /* move the second word first */	  return \"mov.w	%f1,%f0\;mov.w	%e1,%e0\";	}      else 	{	  return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";	}        case 3:      return \"mov.w	%e1,%e0\;mov.w	%f1,%f0\";    case 4:      return \"mov.w	%f1,%T0\;mov.w	%e1,%T0\";    case 5:      return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";    }}"  [(set_attr "type" "move")   (set_attr "length" "4,4,8,8,4,4")   (set_attr "cc" "clobber")])(define_insn "movsi_h8300h"  [(set (match_operand:SI 0 "general_operand_dst" "=ra,ra,ra,o,<,ra")	(match_operand:SI 1 "general_operand_src" "I,ra,ion,ra,ra,>"))]  "TARGET_H8300H   && (register_operand (operands[0], SImode)       || register_operand (operands[1], SImode))"  "@   sub.l	%S0,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0"  [(set_attr "type" "move")   (set_attr "length" "2,2,8,8,4,4")   (set_attr "cc" "set")])(define_insn "movsf_h8300h"  [(set (match_operand:SF 0 "general_operand_dst" "=r,r,r,o,<,r")	(match_operand:SF 1 "general_operand_src" "I,r,ion,r,r,>"))]  "TARGET_H8300H   && (register_operand (operands[0], SFmode)       || register_operand (operands[1], SFmode))"  "@   sub.l	%S0,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0   mov.l	%S1,%S0"  [(set_attr "type" "move")   (set_attr "length" "2,2,8,8,4,4")   (set_attr "cc" "set")]);; ----------------------------------------------------------------------;; TEST INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "tstqi"  [(set (cc0) (match_operand:QI 0 "register_operand" "ra"))]  ""  "*{  /* ??? I don't think this is right.  --Jim */  if (cc_prev_status.flags & CC_DONE_CBIT)    return \"btst	#0,%X0\";  else    return \"cmp.b	#0,%X0\";}"  [(set_attr "type" "arith")   (set_attr "length" "4")   (set_attr "cc" "set")])(define_insn "tsthi"  [(set (cc0) (match_operand:HI 0 "general_operand" "ra"))]  ""  "*{  /* ??? I don't think this is right.  --Jim */  if (cc_prev_status.flags & CC_DONE_CBIT)    return \"btst	#0,%0l\";  else    return \"mov.w	%T0,%T0\";}"  [(set_attr "type" "arith")   (set_attr "length" "4")   (set_attr "cc" "set")])(define_insn "tstsi"  [(set (cc0) (match_operand:SI 0 "general_operand" "ra"))]  "TARGET_H8300H"  "*{  /* ??? I don't think this is right.  --Jim */  if (cc_prev_status.flags & CC_DONE_CBIT)

⌨️ 快捷键说明

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