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

📄 vfp.md

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 MD
📖 第 1 页 / 共 2 页
字号:
;; ARM VFP coprocessor Machine Description;; Copyright (C) 2003, 2005 Free Software Foundation, Inc.;; Written by CodeSourcery, LLC.;;;; 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.  */;; Additional register numbers(define_constants  [(VFPCC_REGNUM 95)]);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Pipeline description;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(define_automaton "vfp11");; There are 3 pipelines in the VFP11 unit.;;;; - A 8-stage FMAC pipeline (7 execute + writeback) with forward from;;   fourth stage for simple operations.;;;; - A 5-stage DS pipeline (4 execute + writeback) for divide/sqrt insns.;;   These insns also uses first execute stage of FMAC pipeline.;;;; - A 4-stage LS pipeline (execute + 2 memory + writeback) with forward from;;   second memory stage for loads.;; We do not model Write-After-Read hazards.;; We do not do write scheduling with the arm core, so it is only necessary;; to model the first stage of each pipeline;; ??? Need to model LS pipeline properly for load/store multiple?;; We do not model fmstat properly.  This could be done by modeling pipelines;; properly and defining an absence set between a dummy fmstat unit and all;; other vfp units.(define_cpu_unit "fmac" "vfp11")(define_cpu_unit "ds" "vfp11")(define_cpu_unit "vfp_ls" "vfp11");; The VFP "type" attributes differ from those used in the FPA model.;; ffarith	Fast floating point insns, e.g. abs, neg, cpy, cmp.;; farith	Most arithmetic insns.;; fmul		Double precision multiply.;; fdivs	Single precision sqrt or division.;; fdivd	Double precision sqrt or division.;; f_load	Floating point load from memory.;; f_store	Floating point store to memory.;; f_2_r	Transfer vfp to arm reg.;; r_2_f	Transfer arm to vfp reg.(define_insn_reservation "vfp_ffarith" 4 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "ffarith")) "fmac")(define_insn_reservation "vfp_farith" 8 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "farith")) "fmac")(define_insn_reservation "vfp_fmul" 9 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "fmul")) "fmac*2")(define_insn_reservation "vfp_fdivs" 19 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "fdivs")) "ds*15")(define_insn_reservation "vfp_fdivd" 33 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "fdivd")) "fmac+ds*29");; Moves to/from arm regs also use the load/store pipeline.(define_insn_reservation "vfp_fload" 4 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "f_load,r_2_f")) "vfp_ls")(define_insn_reservation "vfp_fstore" 4 (and (eq_attr "fpu" "vfp")      (eq_attr "type" "f_load,f_2_r")) "vfp_ls");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Insn pattern;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SImode moves;; ??? For now do not allow loading constants into vfp regs.  This causes;; problems because small constants get converted into adds.(define_insn "*arm_movsi_vfp"  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r ,m,*w,r,*w,*w, *Uv")      (match_operand:SI 1 "general_operand"	   "rI,K,mi,r,r,*w,*w,*Uvi,*w"))]  "TARGET_ARM && TARGET_VFP && TARGET_HARD_FLOAT   && (   s_register_operand (operands[0], SImode)       || s_register_operand (operands[1], SImode))"  "@  mov%?\\t%0, %1  mvn%?\\t%0, #%B1  ldr%?\\t%0, %1  str%?\\t%1, %0  fmsr%?\\t%0, %1\\t%@ int  fmrs%?\\t%0, %1\\t%@ int  fcpys%?\\t%0, %1\\t%@ int  flds%?\\t%0, %1\\t%@ int  fsts%?\\t%1, %0\\t%@ int"  [(set_attr "predicable" "yes")   (set_attr "type" "*,*,load1,store1,r_2_f,f_2_r,ffarith,f_load,f_store")   (set_attr "pool_range"     "*,*,4096,*,*,*,*,1020,*")   (set_attr "neg_pool_range" "*,*,4084,*,*,*,*,1008,*")]);; DImode moves(define_insn "*arm_movdi_vfp"  [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r, r,m,w,r,w,w, Uv")	(match_operand:DI 1 "di_operand"              "rIK,mi,r,r,w,w,Uvi,w"))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "*  switch (which_alternative)    {    case 0: case 1: case 2:      return (output_move_double (operands));    case 3:      return \"fmdrr%?\\t%P0, %1\\t%@ int\";    case 4:      return \"fmrrd%?\\t%0, %1\\t%@ int\";    case 5:      return \"fcpyd%?\\t%P0, %P1\\t%@ int\";    case 6:      return \"fldd%?\\t%P0, %1\\t%@ int\";    case 7:      return \"fstd%?\\t%P1, %0\\t%@ int\";    default:      abort ();    }  "  [(set_attr "type" "*,load2,store2,r_2_f,f_2_r,ffarith,f_load,f_store")   (set_attr "length" "8,8,8,4,4,4,4,4")   (set_attr "pool_range"     "*,1020,*,*,*,*,1020,*")   (set_attr "neg_pool_range" "*,1008,*,*,*,*,1008,*")]);; SFmode moves(define_insn "*movsf_vfp"  [(set (match_operand:SF 0 "nonimmediate_operand" "=w,r,w  ,Uv,r ,m,w,r")	(match_operand:SF 1 "general_operand"	   " r,w,UvE,w, mE,r,w,r"))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP   && (   s_register_operand (operands[0], SFmode)       || s_register_operand (operands[1], SFmode))"  "@  fmsr%?\\t%0, %1  fmrs%?\\t%0, %1  flds%?\\t%0, %1  fsts%?\\t%1, %0  ldr%?\\t%0, %1\\t%@ float  str%?\\t%1, %0\\t%@ float  fcpys%?\\t%0, %1  mov%?\\t%0, %1\\t%@ float"  [(set_attr "predicable" "yes")   (set_attr "type" "r_2_f,f_2_r,ffarith,*,f_load,f_store,load1,store1")   (set_attr "pool_range" "*,*,1020,*,4096,*,*,*")   (set_attr "neg_pool_range" "*,*,1008,*,4080,*,*,*")]);; DFmode moves(define_insn "*movdf_vfp"  [(set (match_operand:DF 0 "nonimmediate_soft_df_operand" "=w,r,r, m,w  ,Uv,w,r")	(match_operand:DF 1 "soft_df_operand"		   " r,w,mF,r,UvF,w, w,r"))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "*  {    switch (which_alternative)      {      case 0:	return \"fmdrr%?\\t%P0, %Q1, %R1\";      case 1:	return \"fmrrd%?\\t%Q0, %R0, %P1\";      case 2: case 3: case 7:	return output_move_double (operands);      case 4:	return \"fldd%?\\t%P0, %1\";      case 5:	return \"fstd%?\\t%P1, %0\";      case 6:	return \"fcpyd%?\\t%P0, %P1\";      default:	abort ();      }    }  "  [(set_attr "type" "r_2_f,f_2_r,ffarith,*,load2,store2,f_load,f_store")   (set_attr "length" "4,4,8,8,4,4,4,8")   (set_attr "pool_range" "*,*,1020,*,1020,*,*,*")   (set_attr "neg_pool_range" "*,*,1008,*,1008,*,*,*")]);; Conditional move patterns(define_insn "*movsfcc_vfp"  [(set (match_operand:SF   0 "s_register_operand" "=w,w,w,w,w,w,?r,?r,?r")	(if_then_else:SF	  (match_operator   3 "arm_comparison_operator"	    [(match_operand 4 "cc_register" "") (const_int 0)])	  (match_operand:SF 1 "s_register_operand" "0,w,w,0,?r,?r,0,w,w")	  (match_operand:SF 2 "s_register_operand" "w,0,w,?r,0,?r,w,0,w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "@   fcpys%D3\\t%0, %2   fcpys%d3\\t%0, %1   fcpys%D3\\t%0, %2\;fcpys%d3\\t%0, %1   fmsr%D3\\t%0, %2   fmsr%d3\\t%0, %1   fmsr%D3\\t%0, %2\;fmsr%d3\\t%0, %1   fmrs%D3\\t%0, %2   fmrs%d3\\t%0, %1   fmrs%D3\\t%0, %2\;fmrs%d3\\t%0, %1"   [(set_attr "conds" "use")    (set_attr "length" "4,4,8,4,4,8,4,4,8")    (set_attr "type" "ffarith,ffarith,ffarith,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")])(define_insn "*movdfcc_vfp"  [(set (match_operand:DF   0 "s_register_operand" "=w,w,w,w,w,w,?r,?r,?r")	(if_then_else:DF	  (match_operator   3 "arm_comparison_operator"	    [(match_operand 4 "cc_register" "") (const_int 0)])	  (match_operand:DF 1 "s_register_operand" "0,w,w,0,?r,?r,0,w,w")	  (match_operand:DF 2 "s_register_operand" "w,0,w,?r,0,?r,w,0,w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "@   fcpyd%D3\\t%P0, %P2   fcpyd%d3\\t%P0, %P1   fcpyd%D3\\t%P0, %P2\;fcpyd%d3\\t%P0, %P1   fmdrr%D3\\t%P0, %Q2, %R2   fmdrr%d3\\t%P0, %Q1, %R1   fmdrr%D3\\t%P0, %Q2, %R2\;fmdrr%d3\\t%P0, %Q1, %R1   fmrrd%D3\\t%Q0, %R0, %P2   fmrrd%d3\\t%Q0, %R0, %P1   fmrrd%D3\\t%Q0, %R0, %P2\;fmrrd%d3\\t%Q0, %R0, %P1"   [(set_attr "conds" "use")    (set_attr "length" "4,4,8,4,4,8,4,4,8")    (set_attr "type" "ffarith,ffarith,ffarith,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]);; Sign manipulation functions(define_insn "*abssf2_vfp"  [(set (match_operand:SF	  0 "s_register_operand" "=w")	(abs:SF (match_operand:SF 1 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fabss%?\\t%0, %1"  [(set_attr "predicable" "yes")   (set_attr "type" "ffarith")])(define_insn "*absdf2_vfp"  [(set (match_operand:DF	  0 "s_register_operand" "=w")	(abs:DF (match_operand:DF 1 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fabsd%?\\t%P0, %P1"  [(set_attr "predicable" "yes")   (set_attr "type" "ffarith")])(define_insn "*negsf2_vfp"  [(set (match_operand:SF	  0 "s_register_operand" "+w")	(neg:SF (match_operand:SF 1 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fnegs%?\\t%0, %1"  [(set_attr "predicable" "yes")   (set_attr "type" "ffarith")])(define_insn "*negdf2_vfp"  [(set (match_operand:DF	  0 "s_register_operand" "+w")	(neg:DF (match_operand:DF 1 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fnegd%?\\t%P0, %P1"  [(set_attr "predicable" "yes")   (set_attr "type" "ffarith")]);; Arithmetic insns(define_insn "*addsf3_vfp"  [(set (match_operand:SF	   0 "s_register_operand" "=w")	(plus:SF (match_operand:SF 1 "s_register_operand" "w")		 (match_operand:SF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fadds%?\\t%0, %1, %2"  [(set_attr "predicable" "yes")   (set_attr "type" "farith")])(define_insn "*adddf3_vfp"  [(set (match_operand:DF	   0 "s_register_operand" "=w")	(plus:DF (match_operand:DF 1 "s_register_operand" "w")		 (match_operand:DF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "faddd%?\\t%P0, %P1, %P2"  [(set_attr "predicable" "yes")   (set_attr "type" "farith")])(define_insn "*subsf3_vfp"  [(set (match_operand:SF	    0 "s_register_operand" "=w")	(minus:SF (match_operand:SF 1 "s_register_operand" "w")		  (match_operand:SF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fsubs%?\\t%0, %1, %2"  [(set_attr "predicable" "yes")   (set_attr "type" "farith")])(define_insn "*subdf3_vfp"  [(set (match_operand:DF	    0 "s_register_operand" "=w")	(minus:DF (match_operand:DF 1 "s_register_operand" "w")		  (match_operand:DF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fsubd%?\\t%P0, %P1, %P2"  [(set_attr "predicable" "yes")   (set_attr "type" "farith")]);; Division insns(define_insn "*divsf3_vfp"  [(set (match_operand:SF	  0 "s_register_operand" "+w")	(div:SF (match_operand:SF 1 "s_register_operand" "w")		(match_operand:SF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fdivs%?\\t%0, %1, %2"  [(set_attr "predicable" "yes")   (set_attr "type" "fdivs")])(define_insn "*divdf3_vfp"  [(set (match_operand:DF	  0 "s_register_operand" "+w")	(div:DF (match_operand:DF 1 "s_register_operand" "w")		(match_operand:DF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fdivd%?\\t%P0, %P1, %P2"  [(set_attr "predicable" "yes")   (set_attr "type" "fdivd")]);; Multiplication insns(define_insn "*mulsf3_vfp"  [(set (match_operand:SF	   0 "s_register_operand" "+w")	(mult:SF (match_operand:SF 1 "s_register_operand" "w")		 (match_operand:SF 2 "s_register_operand" "w")))]  "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"  "fmuls%?\\t%0, %1, %2"  [(set_attr "predicable" "yes")   (set_attr "type" "farith")])

⌨️ 快捷键说明

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