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

📄 xtensa.md

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 MD
📖 第 1 页 / 共 4 页
字号:
;; GCC machine description for Tensilica's Xtensa architecture.;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.;; Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.;; This file is part of GCC.;; GCC 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.;; GCC 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 GCC; see the file COPYING.  If not, write to the Free;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA;; 02111-1307, USA.(define_constants [  (A0_REG		0)  (A1_REG		1)  (A7_REG		7)  (A8_REG		8)  (UNSPEC_NSAU		1)  (UNSPEC_NOP		2)  (UNSPEC_PLT		3)  (UNSPEC_RET_ADDR	4)  (UNSPECV_SET_FP	1)  (UNSPECV_ENTRY	2)]);; Attributes.(define_attr "type"  "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fdiv,fsqrt,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr"  (const_string "unknown"))(define_attr "mode"  "unknown,none,QI,HI,SI,DI,SF,DF,BL"  (const_string "unknown"))(define_attr "length" "" (const_int 1));; Describe a user's asm statement.(define_asm_attributes  [(set_attr "type" "multi")]);; Pipeline model.;; The Xtensa basically has simple 5-stage RISC pipeline.;; Most instructions complete in 1 cycle, and it is OK to assume that;; everything is fully pipelined.  The exceptions have special insn;; reservations in the pipeline description below.  The Xtensa can;; issue one instruction per cycle, so defining CPU units is unnecessary.(define_insn_reservation "xtensa_any_insn" 1			 (eq_attr "type" "!load,fload,rsr,mul16,mul32,fmadd,fconv")			 "nothing")(define_insn_reservation "xtensa_memory" 2			 (eq_attr "type" "load,fload")			 "nothing")(define_insn_reservation "xtensa_sreg" 2			 (eq_attr "type" "rsr")			 "nothing")(define_insn_reservation "xtensa_mul16" 2			 (eq_attr "type" "mul16")			 "nothing")(define_insn_reservation "xtensa_mul32" 2			 (eq_attr "type" "mul32")			 "nothing")(define_insn_reservation "xtensa_fmadd" 4			 (eq_attr "type" "fmadd")			 "nothing")(define_insn_reservation "xtensa_fconv" 2			 (eq_attr "type" "fconv")			 "nothing");; Addition.(define_expand "adddi3"  [(set (match_operand:DI 0 "register_operand" "")	(plus:DI (match_operand:DI 1 "register_operand" "")		 (match_operand:DI 2 "register_operand" "")))]  ""{  rtx srclo;  rtx dstlo = gen_lowpart (SImode, operands[0]);  rtx src1lo = gen_lowpart (SImode, operands[1]);  rtx src2lo = gen_lowpart (SImode, operands[2]);  rtx dsthi = gen_highpart (SImode, operands[0]);  rtx src1hi = gen_highpart (SImode, operands[1]);  rtx src2hi = gen_highpart (SImode, operands[2]);  /* Either source can be used for overflow checking, as long as it's     not clobbered by the first addition.  */  if (!rtx_equal_p (dstlo, src1lo))    srclo = src1lo;  else if (!rtx_equal_p (dstlo, src2lo))    srclo = src2lo;  else    {      srclo = gen_reg_rtx (SImode);      emit_move_insn (srclo, src1lo);    }  emit_insn (gen_addsi3 (dstlo, src1lo, src2lo));  emit_insn (gen_addsi3 (dsthi, src1hi, src2hi));  emit_insn (gen_adddi_carry (dsthi, dstlo, srclo));  DONE;});; Represent the add-carry operation as an atomic operation instead of;; expanding it to a conditional branch.  Otherwise, the edge;; profiling code breaks because inserting the count increment code;; causes a new jump insn to be added.(define_insn "adddi_carry"  [(set (match_operand:SI 0 "register_operand" "+a")	(plus:SI (ltu:SI (match_operand:SI 1 "register_operand" "r")			 (match_operand:SI 2 "register_operand" "r"))		 (match_dup 0)))]  ""  "bgeu\t%1, %2, 0f\;addi\t%0, %0, 1\;0:"  [(set_attr "type"	"multi")   (set_attr "mode"	"SI")   (set_attr "length"	"6")])(define_insn "addsi3"  [(set (match_operand:SI 0 "register_operand" "=D,D,a,a,a")	(plus:SI (match_operand:SI 1 "register_operand" "%d,d,r,r,r")		 (match_operand:SI 2 "add_operand" "d,O,r,J,N")))]  ""  "@   add.n\t%0, %1, %2   addi.n\t%0, %1, %d2   add\t%0, %1, %2   addi\t%0, %1, %d2   addmi\t%0, %1, %x2"  [(set_attr "type"	"arith,arith,arith,arith,arith")   (set_attr "mode"	"SI")   (set_attr "length"	"2,2,3,3,3")])(define_insn "*addx2"  [(set (match_operand:SI 0 "register_operand" "=a")	(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			  (const_int 2))		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "addx2\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "*addx4"  [(set (match_operand:SI 0 "register_operand" "=a")	(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			  (const_int 4))		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "addx4\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "*addx8"  [(set (match_operand:SI 0 "register_operand" "=a")	(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			  (const_int 8))		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "addx8\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "addsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(plus:SF (match_operand:SF 1 "register_operand" "%f")		 (match_operand:SF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT"  "add.s\t%0, %1, %2"  [(set_attr "type"	"fmadd")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Subtraction.(define_expand "subdi3"  [(set (match_operand:DI 0 "register_operand" "")	(minus:DI (match_operand:DI 1 "register_operand" "")		  (match_operand:DI 2 "register_operand" "")))]  ""{  rtx dstlo = gen_lowpart (SImode, operands[0]);  rtx src1lo = gen_lowpart (SImode, operands[1]);  rtx src2lo = gen_lowpart (SImode, operands[2]);  rtx dsthi = gen_highpart (SImode, operands[0]);  rtx src1hi = gen_highpart (SImode, operands[1]);  rtx src2hi = gen_highpart (SImode, operands[2]);  emit_insn (gen_subsi3 (dsthi, src1hi, src2hi));  emit_insn (gen_subdi_carry (dsthi, src1lo, src2lo));  emit_insn (gen_subsi3 (dstlo, src1lo, src2lo));  DONE;})(define_insn "subdi_carry"  [(set (match_operand:SI 0 "register_operand" "+a")	(minus:SI (match_dup 0)		  (ltu:SI (match_operand:SI 1 "register_operand" "r")			  (match_operand:SI 2 "register_operand" "r"))))]  ""  "bgeu\t%1, %2, 0f\;addi\t%0, %0, -1\;0:"  [(set_attr "type"	"multi")   (set_attr "mode"	"SI")   (set_attr "length"	"6")])(define_insn "subsi3"  [(set (match_operand:SI 0 "register_operand" "=a")        (minus:SI (match_operand:SI 1 "register_operand" "r")		  (match_operand:SI 2 "register_operand" "r")))]  ""  "sub\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "*subx2"  [(set (match_operand:SI 0 "register_operand" "=a")	(minus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			   (const_int 2))		  (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "subx2\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "*subx4"  [(set (match_operand:SI 0 "register_operand" "=a")	(minus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			   (const_int 4))		  (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "subx4\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "*subx8"  [(set (match_operand:SI 0 "register_operand" "=a")	(minus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")			   (const_int 8))		  (match_operand:SI 2 "register_operand" "r")))]  "TARGET_ADDX"  "subx8\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "subsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(minus:SF (match_operand:SF 1 "register_operand" "f")		  (match_operand:SF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT"  "sub.s\t%0, %1, %2"  [(set_attr "type"	"fmadd")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Multiplication.(define_insn "mulsi3"  [(set (match_operand:SI 0 "register_operand" "=a")	(mult:SI (match_operand:SI 1 "register_operand" "%r")		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_MUL32"  "mull\t%0, %1, %2"  [(set_attr "type"	"mul32")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "mulhisi3"  [(set (match_operand:SI 0 "register_operand" "=C,A")	(mult:SI (sign_extend:SI		  (match_operand:HI 1 "register_operand" "%r,r"))		 (sign_extend:SI		  (match_operand:HI 2 "register_operand" "r,r"))))]  "TARGET_MUL16 || TARGET_MAC16"  "@   mul16s\t%0, %1, %2   mul.aa.ll\t%1, %2"  [(set_attr "type"	"mul16,mac16")   (set_attr "mode"	"SI")   (set_attr "length"	"3,3")])(define_insn "umulhisi3"  [(set (match_operand:SI 0 "register_operand" "=C,A")	(mult:SI (zero_extend:SI		  (match_operand:HI 1 "register_operand" "%r,r"))		 (zero_extend:SI		  (match_operand:HI 2 "register_operand" "r,r"))))]  "TARGET_MUL16 || TARGET_MAC16"  "@   mul16u\t%0, %1, %2   umul.aa.ll\t%1, %2"  [(set_attr "type"	"mul16,mac16")   (set_attr "mode"	"SI")   (set_attr "length"	"3,3")])(define_insn "muladdhisi"  [(set (match_operand:SI 0 "register_operand" "=A")	(plus:SI (mult:SI (sign_extend:SI			   (match_operand:HI 1 "register_operand" "%r"))			  (sign_extend:SI			   (match_operand:HI 2 "register_operand" "r")))		 (match_operand:SI 3 "register_operand" "0")))]  "TARGET_MAC16"  "mula.aa.ll\t%1, %2"  [(set_attr "type"	"mac16")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "mulsubhisi"  [(set (match_operand:SI 0 "register_operand" "=A")	(minus:SI (match_operand:SI 1 "register_operand" "0")		  (mult:SI (sign_extend:SI			    (match_operand:HI 2 "register_operand" "%r"))			   (sign_extend:SI			    (match_operand:HI 3 "register_operand" "r")))))]  "TARGET_MAC16"  "muls.aa.ll\t%2, %3"  [(set_attr "type"	"mac16")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "mulsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(mult:SF (match_operand:SF 1 "register_operand" "%f")		 (match_operand:SF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT"  "mul.s\t%0, %1, %2"  [(set_attr "type"	"fmadd")   (set_attr "mode"	"SF")   (set_attr "length"	"3")])(define_insn "muladdsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f")			  (match_operand:SF 2 "register_operand" "f"))		 (match_operand:SF 3 "register_operand" "0")))]  "TARGET_HARD_FLOAT && !TARGET_NO_FUSED_MADD"  "madd.s\t%0, %1, %2"  [(set_attr "type"	"fmadd")   (set_attr "mode"	"SF")   (set_attr "length"	"3")])(define_insn "mulsubsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(minus:SF (match_operand:SF 1 "register_operand" "0")		  (mult:SF (match_operand:SF 2 "register_operand" "%f")			   (match_operand:SF 3 "register_operand" "f"))))]  "TARGET_HARD_FLOAT && !TARGET_NO_FUSED_MADD"  "msub.s\t%0, %2, %3"  [(set_attr "type"	"fmadd")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Division.(define_insn "divsi3"  [(set (match_operand:SI 0 "register_operand" "=a")	(div:SI (match_operand:SI 1 "register_operand" "r")		(match_operand:SI 2 "register_operand" "r")))]  "TARGET_DIV32"  "quos\t%0, %1, %2"  [(set_attr "type"	"div32")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "udivsi3"  [(set (match_operand:SI 0 "register_operand" "=a")	(udiv:SI (match_operand:SI 1 "register_operand" "r")		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_DIV32"  "quou\t%0, %1, %2"  [(set_attr "type"	"div32")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "divsf3"  [(set (match_operand:SF 0 "register_operand" "=f")	(div:SF (match_operand:SF 1 "register_operand" "f")		(match_operand:SF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT_DIV"  "div.s\t%0, %1, %2"  [(set_attr "type"	"fdiv")   (set_attr "mode"	"SF")   (set_attr "length"	"3")])(define_insn "*recipsf2"  [(set (match_operand:SF 0 "register_operand" "=f")	(div:SF (match_operand:SF 1 "const_float_1_operand" "")		(match_operand:SF 2 "register_operand" "f")))]  "TARGET_HARD_FLOAT_RECIP && flag_unsafe_math_optimizations"  "recip.s\t%0, %2"  [(set_attr "type"	"fdiv")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Remainders.(define_insn "modsi3"  [(set (match_operand:SI 0 "register_operand" "=a")	(mod:SI (match_operand:SI 1 "register_operand" "r")		(match_operand:SI 2 "register_operand" "r")))]  "TARGET_DIV32"  "rems\t%0, %1, %2"  [(set_attr "type"	"div32")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "umodsi3"  [(set (match_operand:SI 0 "register_operand" "=a")	(umod:SI (match_operand:SI 1 "register_operand" "r")		 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_DIV32"  "remu\t%0, %1, %2"  [(set_attr "type"	"div32")   (set_attr "mode"	"SI")   (set_attr "length"	"3")]);; Square roots.(define_insn "sqrtsf2"  [(set (match_operand:SF 0 "register_operand" "=f")	(sqrt:SF (match_operand:SF 1 "register_operand" "f")))]  "TARGET_HARD_FLOAT_SQRT"  "sqrt.s\t%0, %1"  [(set_attr "type"	"fsqrt")   (set_attr "mode"	"SF")   (set_attr "length"	"3")])(define_insn "*rsqrtsf2"  [(set (match_operand:SF 0 "register_operand" "=f")	(div:SF (match_operand:SF 1 "const_float_1_operand" "")		(sqrt:SF (match_operand:SF 2 "register_operand" "f"))))]  "TARGET_HARD_FLOAT_RSQRT && flag_unsafe_math_optimizations"  "rsqrt.s\t%0, %2"  [(set_attr "type"	"fsqrt")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Absolute value.(define_insn "abssi2"  [(set (match_operand:SI 0 "register_operand" "=a")	(abs:SI (match_operand:SI 1 "register_operand" "r")))]  "TARGET_ABS"  "abs\t%0, %1"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "abssf2"  [(set (match_operand:SF 0 "register_operand" "=f")	(abs:SF (match_operand:SF 1 "register_operand" "f")))]  "TARGET_HARD_FLOAT"  "abs.s\t%0, %1"  [(set_attr "type"	"farith")   (set_attr "mode"	"SF")   (set_attr "length"	"3")]);; Min and max.(define_insn "sminsi3"  [(set (match_operand:SI 0 "register_operand" "=a")        (smin:SI (match_operand:SI 1 "register_operand" "%r")                 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_MINMAX"  "min\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "uminsi3"  [(set (match_operand:SI 0 "register_operand" "=a")        (umin:SI (match_operand:SI 1 "register_operand" "%r")                 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_MINMAX"  "minu\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "smaxsi3"  [(set (match_operand:SI 0 "register_operand" "=a")        (smax:SI (match_operand:SI 1 "register_operand" "%r")                 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_MINMAX"  "max\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")])(define_insn "umaxsi3"  [(set (match_operand:SI 0 "register_operand" "=a")        (umax:SI (match_operand:SI 1 "register_operand" "%r")                 (match_operand:SI 2 "register_operand" "r")))]  "TARGET_MINMAX"  "maxu\t%0, %1, %2"  [(set_attr "type"	"arith")   (set_attr "mode"	"SI")   (set_attr "length"	"3")]);; Find first bit.(define_expand "ffssi2"  [(set (match_operand:SI 0 "register_operand" "")	(ffs:SI (match_operand:SI 1 "register_operand" "")))]  "TARGET_NSA"{  rtx temp = gen_reg_rtx (SImode);  emit_insn (gen_negsi2 (temp, operands[1]));  emit_insn (gen_andsi3 (temp, temp, operands[1]));  emit_insn (gen_nsau (temp, temp));  emit_insn (gen_negsi2 (temp, temp));  emit_insn (gen_addsi3 (operands[0], temp, GEN_INT (32)));  DONE;});; There is no RTL operator corresponding to NSAU.

⌨️ 快捷键说明

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