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

📄 rs6000.md

📁 早期freebsd实现
💻 MD
📖 第 1 页 / 共 5 页
字号:
;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler;;   Copyright (C) 1990, 1991 Free Software Foundation, Inc.;;   Contributed by Richard Kenner (kenner@nyu.edu);; 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, 675 Mass Ave, Cambridge, MA 02139, USA.;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.;; Define an insn type attribute.  This is used in function unit delay;; computations.(define_attr "type" "load,integer,fp,compare,delayed_compare,fpcompare,mtlr"  (const_string "integer"));; Memory delivers its result in two cycles.(define_function_unit "memory" 1 0 (eq_attr "type" "load") 2 0);; We consider floating-point insns to deliver their result in two cycles;; to try to intersperse integer and FP operations.(define_function_unit "fp" 1 0 (eq_attr "type" "fp,fpcompare") 2 0);; Most integer comparisons are ready in four cycles (a stall of three).(define_function_unit "compare" 1 0 (eq_attr "type" "compare") 4 0);; Some integer comparisons aren't ready for five cycles (a stall of four).(define_function_unit "compare" 1 0 (eq_attr "type" "delayed_compare") 5 0);; Floating-point comparisons take eight cycles.(define_function_unit "compare" 1 0 (eq_attr "type" "fpcompare") 8 0);; Branches on LR cannot be done until five cycles after LR is set.(define_function_unit "branch" 1 0 (eq_attr "type" "mtlr") 5 0);; Start with fixed-point load and store insns.  Here we put only the more;; complex forms.  Basic data transfer is done later.(define_expand "zero_extendqisi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")	(zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]  ""  "@   lbz%U1%X1 %0,%1   rlinm %0,%1,0,24,31"  [(set_attr "type" "load,*")])(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (clobber (match_scratch:SI 2 "=r"))]  ""  "andil. %2,%1,255"  [(set_attr "type" "compare")])(define_insn ""  [(set (match_operand:CC 2 "cc_reg_operand" "=x")	(compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(zero_extend:SI (match_dup 1)))]  ""  "andil. %0,%1,255"  [(set_attr "type" "compare")])(define_expand "zero_extendqihi2"  [(set (match_operand:HI 0 "gpc_reg_operand" "")	(zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")	(zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]  ""  "@   lbz%U1%X1 %0,%1   rlinm %0,%1,0,24,31"  [(set_attr "type" "load,*")])(define_expand "zero_extendhisi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")	(zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]  ""  "@   lhz%U1%X1 %0,%1   rlinm %0,%1,0,16,31"  [(set_attr "type" "load,*")])(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (clobber (match_scratch:SI 2 "=r"))]  ""  "andil. %2,%1,65535"  [(set_attr "type" "compare")])(define_insn ""  [(set (match_operand:CC 2 "cc_reg_operand" "=x")	(compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(zero_extend:SI (match_dup 1)))]  ""  "andil. %0,%1,65535"  [(set_attr "type" "compare")])(define_expand "extendhisi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")	(sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]  ""  "@   lha%U1%X1 %0,%1   exts %0,%1"  [(set_attr "type" "load,*")])(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (clobber (match_scratch:SI 2 "=r"))]  ""  "exts. %2,%1"  [(set_attr "type" "compare")])(define_insn ""  [(set (match_operand:CC 2 "cc_reg_operand" "=x")	(compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))		    (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(sign_extend:SI (match_dup 1)))]  ""  "exts. %0,%1"  [(set_attr "type" "compare")]);; Fixed-point arithmetic insns.(define_insn "addsi3"  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")	(plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b")		 (match_operand:SI 2 "add_operand" "rI,J")))]  ""  "@   a%I2 %0,%1,%2   cau %0,%1,%u2")(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")			     (match_operand:SI 2 "reg_or_short_operand" "rI"))		    (const_int 0)))   (clobber (match_scratch:SI 3 "=r"))]  ""  "a%I2. %3,%1,%2"  [(set_attr "type" "compare")])   (define_insn ""  [(set (match_operand:CC 3 "cc_reg_operand" "=x")	(compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")			     (match_operand:SI 2 "reg_or_short_operand" "rI"))		    (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(plus:SI (match_dup 1) (match_dup 2)))]  ""  "a%I2. %0,%1,%2"  [(set_attr "type" "compare")])   ;; Split an add that we can't do in one insn into two insns, each of which;; does one 16-bit part.  This is used by combine.  Note that the low-order;; add should be last in case the result gets used in an address.(define_split  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(plus:SI (match_operand:SI 1 "gpc_reg_operand" "")		 (match_operand:SI 2 "non_add_cint_operand" "")))]  ""  [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]"{  int low = INTVAL (operands[2]) & 0xffff;  int high = (unsigned) INTVAL (operands[2]) >> 16;  if (low & 0x8000)    high++, low |= 0xffff0000;  operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);  operands[4] = gen_rtx (CONST_INT, VOIDmode, low);}")(define_insn "one_cmplsi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")	(not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]  ""  "sfi %0,%1,-1")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")	(minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")		  (match_operand:SI 2 "gpc_reg_operand" "r,r")))]  ""  "@   sf %0,%2,%1   sfi %0,%2,%1")(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")			      (match_operand:SI 2 "gpc_reg_operand" "r"))		    (const_int 0)))   (clobber (match_scratch:SI 3 "=r"))]  ""  "sf. %3,%2,%1"  [(set_attr "type" "compare")])(define_insn ""  [(set (match_operand:CC 3 "cc_reg_operand" "=x")	(compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")			      (match_operand:SI 2 "gpc_reg_operand" "r"))		    (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(minus:SI (match_dup 1) (match_dup 2)))]  ""  "sf. %0,%2,%1"  [(set_attr "type" "compare")])(define_expand "subsi3"  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(minus:SI (match_operand:SI 1 "reg_or_short_operand" "")		  (match_operand:SI 2 "reg_or_cint_operand" "")))]  ""  "{  if (GET_CODE (operands[2]) == CONST_INT)    {      emit_insn (gen_addsi3 (operands[0], operands[1],			     negate_rtx (SImode, operands[2])));      DONE;    }}");; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i];; instruction and some auxiliary computations.  Then we just have a single;; DEFINE_INSN for doz[i] and the define_splits to make them if made by;; combine.(define_expand "sminsi3"  [(set (match_dup 3)	(if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")				(match_operand:SI 2 "reg_or_short_operand" ""))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))   (set (match_operand:SI 0 "gpc_reg_operand" "")	(minus:SI (match_dup 2) (match_dup 3)))]  ""  "{ operands[3] = gen_reg_rtx (SImode); }")(define_split  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(smin:SI (match_operand:SI 1 "gpc_reg_operand" "")		 (match_operand:SI 2 "reg_or_short_operand" "")))   (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]  ""  [(set (match_dup 3)	(if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))   (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]  "")(define_expand "smaxsi3"  [(set (match_dup 3)	(if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")				(match_operand:SI 2 "reg_or_short_operand" ""))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))   (set (match_operand:SI 0 "gpc_reg_operand" "")	(plus:SI (match_dup 3) (match_dup 1)))]  ""  "{ operands[3] = gen_reg_rtx (SImode); }")(define_split  [(set (match_operand:SI 0 "gpc_reg_operand" "")	(smax:SI (match_operand:SI 1 "gpc_reg_operand" "")		 (match_operand:SI 2 "reg_or_short_operand" "")))   (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]  ""  [(set (match_dup 3)	(if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))   (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]  "")(define_expand "uminsi3"  [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")			      (const_int -2147483648)))   (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")			      (const_int -2147483648)))   (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))				       (const_int 0)				       (minus:SI (match_dup 4) (match_dup 3))))   (set (match_operand:SI 0 "gpc_reg_operand" "")	(minus:SI (match_dup 2) (match_dup 3)))]  ""  "{ operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")(define_expand "umaxsi3"  [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")			      (const_int -2147483648)))   (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")			      (const_int -2147483648)))   (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))				       (const_int 0)				       (minus:SI (match_dup 4) (match_dup 3))))   (set (match_operand:SI 0 "gpc_reg_operand" "")	(plus:SI (match_dup 3) (match_dup 1)))]  ""  "{ operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")	(if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")			     (match_operand:SI 2 "reg_or_short_operand" "rI"))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))]  ""  "doz%I2 %0,%1,%2")(define_insn ""  [(set (match_operand:CC 0 "cc_reg_operand" "=x")	(compare:CC	 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")			      (match_operand:SI 2 "reg_or_short_operand" "rI"))			  (const_int 0)			  (minus:SI (match_dup 2) (match_dup 1)))	 (const_int 0)))   (clobber (match_scratch:SI 3 "=r"))]  ""  "doz%I2. %3,%1,%2"  [(set_attr "type" "delayed_compare")])(define_insn ""  [(set (match_operand:CC 3 "cc_reg_operand" "=x")	(compare:CC	 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")			      (match_operand:SI 2 "reg_or_short_operand" "rI"))			  (const_int 0)			  (minus:SI (match_dup 2) (match_dup 1)))	 (const_int 0)))   (set (match_operand:SI 0 "gpc_reg_operand" "=r")	(if_then_else:SI (gt (match_dup 1) (match_dup 2))			 (const_int 0)			 (minus:SI (match_dup 2) (match_dup 1))))]  ""  "doz%I2. %0,%1,%2"  [(set_attr "type" "delayed_compare")]);; We don't need abs with condition code because such comparisons should;; never be done.(define_insn "abssi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")	(abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]  ""  "abs %0,%1")(define_insn ""  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")	(neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]  ""  "nabs %0,%1")(define_insn "negsi2"  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")	(neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]  ""

⌨️ 快捷键说明

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