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

📄 dsp16xx.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
;;- Machine description for the AT&T DSP1600 for GNU C compiler;;  Copyright (C) 1994, 1995, 1997, 1998, 2001, 2002;;  Free Software Foundation, Inc.;;  Contributed by Michael Collison (collison@isisinc.net).;; 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.;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.;; Attribute specifications; Type of each instruction.  Default is arithmetic.; I'd like to write the list as this, but genattrtab won't accept it.;; "jump,cond_jump,call,			; flow-control instructions;  load_i,load, store, move		; Y space address arithmetic instructions;  malu,special,f3_alu,f3_alu_i		; data arithmetic unit instructions;  shift_i,shift, bfield_i, bfield	; bit manipulation unit instructions;  arith,				; integer unit instructions;  nop; Classification of each insn.  Some insns of TYPE_BRANCH are multi-word.(define_attr "type"  "jump,cond_jump,call,load_i,load,move,store,malu,malu_mul,tstqi,special,special_2,f3_alu,f3_alu_i,f3_alu_i_mult,shift_i,shift,shift_multiple,shift_i_multiple,bfield_i,bfield,nop,ld_short_i,data_move,data_move_i,data_move_memory,data_move_memory_2,data_move_short_i,data_move_multiple,data_move_2,nothing"  (const_string "malu"));; Data arithmetic unit(define_function_unit "dau" 1 1 (eq_attr "type" "data_move,data_move_i,f3_alu_i") 2 0)(define_function_unit "dau" 1 1 (eq_attr "type" "special_2") 3 0)(define_function_unit "dau" 1 1 (eq_attr "type" "data_move_2") 4 0);; Bit manipulation(define_function_unit "bmu" 1 1 (eq_attr "type" "shift_i,shift_i_multiple") 2 0)(define_function_unit "bmu" 1 1 (eq_attr "type" "shift_multiple") 4 0);; Y-memory addressing arithmetic unit(define_function_unit "yaau" 1 1 (eq_attr "type" "data_move_memory") 2 0)(define_function_unit "yaau" 1 1 (eq_attr "type" "data_move_memory_2") 4 0);;  ....................;;;;  Test against 0 instructions;;;;  ....................(define_expand "tsthi"  [(set (cc0)        (match_operand:HI 0 "register_operand" ""))]  ""  "{  dsp16xx_compare_gen = gen_tst_reg;  dsp16xx_compare_op0 = operands[0];  dsp16xx_compare_op1 = const0_rtx;  DONE;}")(define_insn "tsthi_1"  [(set (cc0)	(match_operand:HI 0 "register_operand" "A"))]  ""  "%0=%0"  [(set_attr "type" "malu")])(define_expand "tstqi"  [(set (cc0)        (match_operand:QI 0 "register_operand" ""))]  ""  "{  dsp16xx_compare_gen = gen_tst_reg;  dsp16xx_compare_op0 = operands[0];  dsp16xx_compare_op1 = const0_rtx;  DONE;}")(define_split  [(set (cc0)	(match_operand:QI 0 "register_operand" "j,q"))   (clobber (match_scratch:QI 1 "=k,u"))]  "reload_completed"  [(set (match_dup 1)	(const_int 0))   (parallel [(set (cc0)		   (match_dup 0))	      (use (match_dup 1))])]  "")(define_insn "tstqi_split"  [(set (cc0)	(match_operand:QI 0 "register_operand" "j,q"))   (use (match_scratch:QI 1 "=k,u"))]  ""  "@   %b0-0   %b0-0"  [(set_attr "type" "f3_alu_i,f3_alu_i")])(define_insn "tstqi_1"  [(set (cc0)	(match_operand:QI 0 "register_operand" "j,q"))   (clobber (match_scratch:QI 1 "=k,u"))]  ""  "@   %1=0\;%b0-0   %1=0\;%b0-0"  [(set_attr "type" "tstqi,tstqi")]);;;;  ....................;;;;  Bit test instructions;;;;  ....................(define_insn ""  [(set (cc0)	(and:HI (match_operand:HI 0 "register_operand" "A,!A")		(match_operand:HI 1 "register_operand" "Z,A")))]  ""   "*{	switch (which_alternative)	{	   case 0:	   case 1:   	      return \"%0&%1\";           default:             abort();         }}"  [(set_attr "type" "f3_alu,f3_alu")]);;(define_insn "";;  [(set (cc0);;	(and:QI (match_operand:QI 0 "register_operand" "h");;		(match_operand:QI 1 "const_int_operand" "I")))];;  "" ;;  "%b0&%H1";;  [(set_attr "type" "f3_alu_i")]);;;;;; Compare Instructions;;(define_expand "cmphi"  [(parallel [(set (cc0)		   (compare (match_operand:HI 0 "general_operand" "")			    (match_operand:HI 1 "general_operand" "")))	      (clobber (match_scratch:QI 2 ""))	      (clobber (match_scratch:QI 3 ""))	      (clobber (match_scratch:QI 4 ""))	      (clobber (match_scratch:QI 5 ""))])]  ""  "{  if (GET_CODE (operands[1]) == CONST_INT)    operands[1] = force_reg (HImode, operands[1]);  dsp16xx_compare_gen = gen_compare_reg;  dsp16xx_compare_op0 = operands[0];  dsp16xx_compare_op1 = operands[1];  DONE;}")(define_insn ""  [(set (cc0) 	(compare (match_operand:HI 0 "general_operand" "Z*r*m*i")		 (match_operand:HI 1 "general_operand" "Z*r*m*i")))   (clobber (match_scratch:QI 2 "=&A"))   (clobber (match_scratch:QI 3 "=&A"))   (clobber (match_scratch:QI 4 "=&A"))   (clobber (match_scratch:QI 5 "=&A"))]  "next_cc_user_unsigned (insn)"  "*{  if (GET_CODE(operands[0]) == REG)    {      if (REGNO (operands[0]) == REG_Y ||	  REGNO (operands[0]) == REG_PROD)	{	  output_asm_insn (\"a0=%0\", operands);	}      else if (IS_YBASE_REGISTER_WINDOW (REGNO (operands[0])))	output_asm_insn (\"a0=%u0\;a0l=%w0\", operands);      else	fatal_error (\"Invalid register for compare\");    }  else if (GET_CODE(operands[0]) == CONST_INT)    output_asm_insn (\"a0=%U0\;a0l=%H0\", operands);  else if (GET_CODE (operands[0]) == MEM)    {      rtx xoperands[2];      xoperands[0] = gen_rtx_REG (HImode, REG_A0);      xoperands[1] = operands[0];      double_reg_from_memory (xoperands);    }  if (GET_CODE(operands[1]) == REG)    {      if (REGNO (operands[1]) == REG_Y || REGNO (operands[1]) == REG_PROD)	output_asm_insn (\"a1=%1\", operands);      else if (IS_YBASE_REGISTER_WINDOW (REGNO (operands[1])))	output_asm_insn (\"a1=%u1\;a1l=%w1\", operands);      else	fatal_error (\"Invalid register for compare\");    }  else if (GET_CODE (operands[1]) == MEM)    {      rtx xoperands[2];      xoperands[0] = gen_rtx_REG (HImode, REG_A1);      xoperands[1] = operands[1];      double_reg_from_memory (xoperands);    }  else if (GET_CODE(operands[1]) == CONST_INT)    {      output_asm_insn (\"a1=%U1\;a1l=%H1\", operands);    }    return \"psw = 0\;a0 - a1\";}")(define_insn ""  [(set (cc0) (compare (match_operand:HI 0 "register_operand" "A,!A")		       (match_operand:HI 1 "register_operand" "Z,*A")))]  ""  "@   %0-%1   %0-%1"  [(set_attr "type" "malu,f3_alu")])(define_expand "cmpqi"  [(parallel [(set (cc0)		   (compare (match_operand:QI 0 "register_operand" "")			    (match_operand:QI 1 "nonmemory_operand" "")))	      (clobber (match_operand:QI 2 "register_operand" ""))	      (clobber (match_operand:QI 3 "register_operand" ""))])]  ""  " {  if (operands[0])	/* Avoid unused code warning */    {      dsp16xx_compare_gen = gen_compare_reg;      dsp16xx_compare_op0 = operands[0];      dsp16xx_compare_op1 = operands[1];      DONE;    } }")(define_split  [(set (cc0)	(compare (match_operand:QI 0 "register_operand" "")		 (match_operand:QI 1 "register_operand" "")))   (clobber (match_scratch:QI 2 ""))   (clobber (match_scratch:QI 3 ""))]  "reload_completed && next_cc_user_unsigned (insn)"  [(set (match_dup 2)	(const_int 0))   (set (match_dup 3)	(const_int 0))   (parallel [(set (cc0)		   (compare (match_dup 0)			    (match_dup 1)))	      (use (match_dup 2))	      (use (match_dup 3))])]  "")(define_split  [(set (cc0)	(compare (match_operand:QI 0 "register_operand" "")		 (match_operand:QI 1 "const_int_operand" "")))   (clobber (match_scratch:QI 2 ""))   (clobber (match_scratch:QI 3 ""))]  "reload_completed && next_cc_user_unsigned (insn)"  [(set (match_dup 2)	(const_int 0))   (parallel [(set (cc0)		   (compare (match_dup 0)			    (match_dup 1)))	      (use (match_dup 2))])]  "")(define_insn "cmpqi_split_unsigned_reg"  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "k,k,!k,u,u,!u")                       (match_operand:QI 1 "register_operand"  "w,z,u,w,z,k")))	(use (match_scratch:QI 2 "=j,j,j,q,q,q"))	(use (match_scratch:QI 3 "=v,y,q,v,y,j"))]  "next_cc_user_unsigned (insn)"  "@   %2-%3   %2-%3   %2-%3   %2-%3   %2-%3   %2-%3"  [(set_attr "type" "malu,malu,malu,malu,malu,malu")])(define_insn "cmpqi_split_unsigned_int"  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "k,u")                       (match_operand:QI 1 "const_int_operand" "i,i")))	(use (match_scratch:QI 2 "=j,q"))]  "next_cc_user_unsigned (insn)"  "@   %0-%H1   %0-%H1"  [(set_attr "type" "f3_alu_i,f3_alu_i")])(define_insn ""  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "k,k,!k,k,u,u,!u,u")                       (match_operand:QI 1 "nonmemory_operand" "w,z,u,i,w,z,k,i")))	(clobber (match_scratch:QI 2 "=j,j,j,j,q,q,q,q"))	(clobber (match_scratch:QI 3 "=v,y,q,X,v,y,j,X"))]  "next_cc_user_unsigned (insn)"  "@   %2=0\;%3=0\;%2-%3   %2=0\;%3=0\;%2-%3   %2=0\;%3=0\;%2-%3   %2=0\;%0-%H1   %2=0\;%3=0\;%2-%3   %2=0\;%3=0\;%2-%3   %2=0\;%3=0\;%2-%3   %2=0\;%0-%H1")(define_split  [(set (cc0)	(compare (match_operand:QI 0 "register_operand" "")		 (match_operand:QI 1 "register_operand" "")))   (clobber (match_scratch:QI 2 ""))   (clobber (match_scratch:QI 3 ""))]  "reload_completed"  [(set (match_dup 2)	(const_int 0))   (set (match_dup 3)	(const_int 0))   (parallel [(set (cc0)		   (compare (match_dup 0)			    (match_dup 1)))	      (use (match_dup 2))	      (use (match_dup 3))])]  "")(define_split  [(set (cc0)	(compare (match_operand:QI 0 "register_operand" "")		 (match_operand:QI 1 "const_int_operand" "")))   (clobber (match_scratch:QI 2 ""))   (clobber (match_scratch:QI 3 ""))]  "reload_completed"  [(set (match_dup 2)	(const_int 0))   (parallel [(set (cc0)		   (compare (match_dup 0)			    (match_dup 1)))	      (use (match_dup 2))])]  "")(define_insn "cmpqi_split_reg"  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "j,j,!j,q,q,!q")                       (match_operand:QI 1 "register_operand"  "v,y,q,v,y,j")))	(use (match_scratch:QI 2 "=k,k,k,u,u,u"))	(use (match_scratch:QI 3 "=w,z,u,w,z,k"))]  ""  "@   %0-%1   %0-%1   %0-%1   %0-%1   %0-%1   %0-%1"  [(set_attr "type" "malu,malu,malu,malu,malu,malu")])(define_insn "cmpqi_split_int"  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "j,q")                       (match_operand:QI 1 "const_int_operand" "i,i")))	(use (match_scratch:QI 2 "=k,u"))]  ""  "@   %b0-%H1   %b0-%H1"  [(set_attr "type" "f3_alu_i,f3_alu_i")])(define_insn ""  [(set (cc0) (compare (match_operand:QI 0 "register_operand"  "j,j,!j,j,q,q,!q,q")                       (match_operand:QI 1 "nonmemory_operand" "v,y,q,i,v,y,j,i")))	(clobber (match_scratch:QI 2 "=k,k,k,k,u,u,u,u"))	(clobber (match_scratch:QI 3 "=w,z,u,X,w,z,k,X"))]  ""  "@   %2=0\;%3=0\;%0-%1   %2=0\;%3=0\;%0-%1   %2=0\;%3=0\;%0-%1   %2=0\;%b0-%H1   %2=0\;%3=0\;%0-%1   %2=0\;%3=0\;%0-%1   %2=0\;%3=0\;%0-%1   %2=0\;%b0-%H1")(define_expand "cmphf"  [(set (cc0)	(compare (match_operand:HF 0 "register_operand" "")		 (match_operand:HF 1 "nonmemory_operand" "")))]  ""  "{  if (!dsp16xx_cmphf3_libcall)    dsp16xx_cmphf3_libcall = gen_rtx_SYMBOL_REF (Pmode, CMPHF3_LIBCALL);   dsp16xx_compare_gen = gen_compare_reg;   dsp16xx_compare_op0 = operands[0];   dsp16xx_compare_op1 = operands[1];   emit_library_call (dsp16xx_cmphf3_libcall, 1, HImode, 2,		      operands[0], HFmode,		      operands[1], HFmode);   emit_insn (gen_tsthi_1 (copy_to_reg(hard_libcall_value (HImode))));   DONE;}");;  ....................;;;;  Add instructions;;;;  ....................(define_split  [(set (match_operand:HI 0 "register_operand" "")	(plus:HI (match_operand:HI 1 "register_operand" "")		 (match_operand:HI 2 "const_int_operand" "")))]  "reload_completed && !ADD_LOW_16(INTVAL(operands[2])) &&    !ADD_HIGH_16(INTVAL(operands[2]))"  [(parallel [(set (match_dup 3)		   (plus:QI (match_dup 4)			    (match_dup 5)))	      (clobber (match_dup 6))])   (parallel [(set (match_dup 6)		   (plus:QI (match_dup 7)			    (match_dup 8)))	      (clobber (match_scratch:QI 9 ""))])]  "{  operands[3] = gen_lowpart(QImode, operands[0]);  operands[4] = gen_lowpart(QImode, operands[1]);

⌨️ 快捷键说明

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