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

📄 xtensa.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; GCC machine description for Tensilica's Xtensa architecture.;; Copyright (C) 2001 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.;;;; ....................;;;;	CONSTANTS;;;; ....................;;(define_constants [  (A0_REG		0)  (A7_REG		7)  (UNSPEC_NSAU		1)  (UNSPEC_NOP		2)  (UNSPEC_PLT		3)  (UNSPEC_RET_ADDR	4)  (UNSPECV_SET_FP	1)]);;;; ....................;;;;	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")]);;;; ....................;;;;	FUNCTIONAL UNITS;;;; ....................;;(define_function_unit "memory" 1 0 (eq_attr "type" "load,fload") 2 0)(define_function_unit "sreg" 1 1 (eq_attr "type" "rsr") 2 0)(define_function_unit "mul16" 1 0 (eq_attr "type" "mul16") 2 0)(define_function_unit "mul32" 1 0 (eq_attr "type" "mul32") 2 0)(define_function_unit "fpmadd" 1 0 (eq_attr "type" "fmadd") 4 0)(define_function_unit "fpconv" 1 0 (eq_attr "type" "fconv") 2 0);;;;  ....................;;;;	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")))]  ""  "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")))]  ""  "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")))]  ""  "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")))]  ""  "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")))]  ""  "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")))]  ""  "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")]);;;;  ....................;;;;	REMAINDER;;;;  ....................;;(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 ROOT;;;;  ....................;;(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"

⌨️ 快捷键说明

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