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

📄 altivec.md

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 MD
📖 第 1 页 / 共 5 页
字号:
;; AltiVec patterns.;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.;; Contributed by Aldy Hernandez (aldy@quesejoda.com);; 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  [(UNSPEC_VCMPBFP       50)   (UNSPEC_VCMPEQUB      51)   (UNSPEC_VCMPEQUH      52)   (UNSPEC_VCMPEQUW      53)   (UNSPEC_VCMPEQFP      54)   (UNSPEC_VCMPGEFP      55)   (UNSPEC_VCMPGTUB      56)   (UNSPEC_VCMPGTSB      57)   (UNSPEC_VCMPGTUH      58)   (UNSPEC_VCMPGTSH      59)   (UNSPEC_VCMPGTUW      60)   (UNSPEC_VCMPGTSW      61)   (UNSPEC_VCMPGTFP      62)   (UNSPEC_VSEL4SI      159)   (UNSPEC_VSEL4SF      160)   (UNSPEC_VSEL8HI      161)   (UNSPEC_VSEL16QI     162)   (UNSPEC_VCOND_V4SI   301)   (UNSPEC_VCOND_V4SF   302)   (UNSPEC_VCOND_V8HI   303)   (UNSPEC_VCOND_V16QI  304)   (UNSPEC_VCONDU_V4SI  305)   (UNSPEC_VCONDU_V8HI  306)   (UNSPEC_VCONDU_V16QI 307)   ]);; Vec int modes(define_mode_macro VI [V4SI V8HI V16QI]);; Short vec in modes(define_mode_macro VIshort [V8HI V16QI]);; Vec float modes(define_mode_macro VF [V4SF]);; Vec modes, pity mode macros are not composable(define_mode_macro V [V4SI V8HI V16QI V4SF])(define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")]);; Generic LVX load instruction.(define_insn "altivec_lvx_<mode>"  [(set (match_operand:V 0 "altivec_register_operand" "=v")	(match_operand:V 1 "memory_operand" "m"))]  "TARGET_ALTIVEC"  "lvx %0,%y1"  [(set_attr "type" "vecload")]);; Generic STVX store instruction.(define_insn "altivec_stvx_<mode>"  [(set (match_operand:V 0 "memory_operand" "=m")	(match_operand:V 1 "altivec_register_operand" "v"))]  "TARGET_ALTIVEC"  "stvx %1,%y0"  [(set_attr "type" "vecstore")]);; Vector move instructions.(define_expand "mov<mode>"  [(set (match_operand:V 0 "nonimmediate_operand" "")	(match_operand:V 1 "any_operand" ""))]  "TARGET_ALTIVEC"{  rs6000_emit_move (operands[0], operands[1], <MODE>mode);  DONE;})(define_insn "*mov<mode>_internal"  [(set (match_operand:V 0 "nonimmediate_operand" "=m,v,v,o,r,r,v")	(match_operand:V 1 "input_operand" "v,m,v,r,o,r,W"))]  "TARGET_ALTIVEC    && (register_operand (operands[0], <MODE>mode)        || register_operand (operands[1], <MODE>mode))"{  switch (which_alternative)    {    case 0: return "stvx %1,%y0";    case 1: return "lvx %0,%y1";    case 2: return "vor %0,%1,%1";    case 3: return "#";    case 4: return "#";    case 5: return "#";    case 6: return output_vec_const_move (operands);    default: abort();    }}  [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])(define_split  [(set (match_operand:V4SI 0 "nonimmediate_operand" "")        (match_operand:V4SI 1 "input_operand" ""))]  "TARGET_ALTIVEC && reload_completed   && gpr_or_gpr_p (operands[0], operands[1])"  [(pc)]{  rs6000_split_multireg_move (operands[0], operands[1]); DONE;})(define_split  [(set (match_operand:V4SI 0 "altivec_register_operand" "")	(match_operand:V4SI 1 "easy_vector_constant_add_self" ""))]  "TARGET_ALTIVEC && reload_completed"  [(set (match_dup 0) (match_dup 3))   (set (match_dup 0)	(plus:V4SI (match_dup 0)		   (match_dup 0)))]{   operands[3] = gen_easy_vector_constant_add_self (operands[1]);})    (define_split  [(set (match_operand:V8HI 0 "nonimmediate_operand" "")        (match_operand:V8HI 1 "input_operand" ""))]  "TARGET_ALTIVEC && reload_completed   && gpr_or_gpr_p (operands[0], operands[1])"  [(pc)]{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })(define_split  [(set (match_operand:V8HI 0 "altivec_register_operand" "")	(match_operand:V8HI 1 "easy_vector_constant_add_self" ""))]  "TARGET_ALTIVEC && reload_completed"  [(set (match_dup 0) (match_dup 3))   (set (match_dup 0)	(plus:V8HI (match_dup 0)		   (match_dup 0)))]{  operands[3] = gen_easy_vector_constant_add_self (operands[1]);})(define_split  [(set (match_operand:V16QI 0 "nonimmediate_operand" "")        (match_operand:V16QI 1 "input_operand" ""))]  "TARGET_ALTIVEC && reload_completed   && gpr_or_gpr_p (operands[0], operands[1])"  [(pc)]{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })(define_split  [(set (match_operand:V16QI 0 "altivec_register_operand" "")	(match_operand:V16QI 1 "easy_vector_constant_add_self" ""))]  "TARGET_ALTIVEC && reload_completed"  [(set (match_dup 0) (match_dup 3))   (set (match_dup 0)	(plus:V16QI (match_dup 0)		   (match_dup 0)))]{  operands[3] = gen_easy_vector_constant_add_self (operands[1]);})(define_split  [(set (match_operand:V4SF 0 "nonimmediate_operand" "")        (match_operand:V4SF 1 "input_operand" ""))]  "TARGET_ALTIVEC && reload_completed   && gpr_or_gpr_p (operands[0], operands[1])"  [(pc)]{  rs6000_split_multireg_move (operands[0], operands[1]); DONE;})(define_insn "get_vrsave_internal"  [(set (match_operand:SI 0 "register_operand" "=r")	(unspec:SI [(reg:SI 109)] 214))]  "TARGET_ALTIVEC"{  if (TARGET_MACHO)     return "mfspr %0,256";  else     return "mfvrsave %0";}  [(set_attr "type" "*")])(define_insn "*set_vrsave_internal"  [(match_parallel 0 "vrsave_operation"     [(set (reg:SI 109)	   (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")				(reg:SI 109)] 30))])]  "TARGET_ALTIVEC"{  if (TARGET_MACHO)    return "mtspr 256,%1";  else    return "mtvrsave %1";}  [(set_attr "type" "*")])(define_insn "*save_world" [(match_parallel 0 "save_world_operation"                  [(clobber (match_operand:SI 1 "register_operand" "=l"))                   (use (match_operand:SI 2 "call_operand" "s"))])] "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"          "bl %z2"  [(set_attr "type" "branch")   (set_attr "length" "4")])(define_insn "*restore_world" [(match_parallel 0 "restore_world_operation"                  [(return)                   (use (match_operand:SI 1 "register_operand" "l"))                   (use (match_operand:SI 2 "call_operand" "s"))                   (clobber (match_operand:SI 3 "gpc_reg_operand" "=r"))])] "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT" "b %z2");; Simple binary operations.;; add(define_insn "add<mode>3"  [(set (match_operand:VI 0 "register_operand" "=v")        (plus:VI (match_operand:VI 1 "register_operand" "v")                 (match_operand:VI 2 "register_operand" "v")))]  "TARGET_ALTIVEC"  "vaddu<VI_char>m %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "addv4sf3"  [(set (match_operand:V4SF 0 "register_operand" "=v")        (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")	 	   (match_operand:V4SF 2 "register_operand" "v")))]  "TARGET_ALTIVEC"  "vaddfp %0,%1,%2"  [(set_attr "type" "vecfloat")])(define_insn "altivec_vaddcuw"  [(set (match_operand:V4SI 0 "register_operand" "=v")        (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")                      (match_operand:V4SI 2 "register_operand" "v")] 35))]  "TARGET_ALTIVEC"  "vaddcuw %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vaddu<VI_char>s"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 36))   (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]  "TARGET_ALTIVEC"  "vaddu<VI_char>s %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vadds<VI_char>s"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 37))   (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]  "TARGET_ALTIVEC"  "vadds<VI_char>s %0,%1,%2"  [(set_attr "type" "vecsimple")]);; sub(define_insn "sub<mode>3"  [(set (match_operand:VI 0 "register_operand" "=v")        (minus:VI (match_operand:VI 1 "register_operand" "v")                  (match_operand:VI 2 "register_operand" "v")))]  "TARGET_ALTIVEC"  "vsubu<VI_char>m %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "subv4sf3"  [(set (match_operand:V4SF 0 "register_operand" "=v")        (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")                    (match_operand:V4SF 2 "register_operand" "v")))]  "TARGET_ALTIVEC"  "vsubfp %0,%1,%2"  [(set_attr "type" "vecfloat")])(define_insn "altivec_vsubcuw"  [(set (match_operand:V4SI 0 "register_operand" "=v")        (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")                      (match_operand:V4SI 2 "register_operand" "v")] 124))]  "TARGET_ALTIVEC"  "vsubcuw %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vsubu<VI_char>s"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 125))   (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]  "TARGET_ALTIVEC"  "vsubu<VI_char>s %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vsubs<VI_char>s"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 126))   (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]  "TARGET_ALTIVEC"  "vsubs<VI_char>s %0,%1,%2"  [(set_attr "type" "vecsimple")]);;(define_insn "altivec_vavgu<VI_char>"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 44))]  "TARGET_ALTIVEC"  "vavgu<VI_char> %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vavgs<VI_char>"  [(set (match_operand:VI 0 "register_operand" "=v")        (unspec:VI [(match_operand:VI 1 "register_operand" "v")                    (match_operand:VI 2 "register_operand" "v")] 45))]  "TARGET_ALTIVEC"  "vavgs<VI_char> %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vcmpbfp"  [(set (match_operand:V4SI 0 "register_operand" "=v")        (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")                      (match_operand:V4SF 2 "register_operand" "v")]                       UNSPEC_VCMPBFP))]  "TARGET_ALTIVEC"  "vcmpbfp %0,%1,%2"  [(set_attr "type" "veccmp")])(define_insn "altivec_vcmpequb"  [(set (match_operand:V16QI 0 "register_operand" "=v")        (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")                       (match_operand:V16QI 2 "register_operand" "v")]                        UNSPEC_VCMPEQUB))]  "TARGET_ALTIVEC"  "vcmpequb %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vcmpequh"  [(set (match_operand:V8HI 0 "register_operand" "=v")        (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")                      (match_operand:V8HI 2 "register_operand" "v")]                       UNSPEC_VCMPEQUH))]  "TARGET_ALTIVEC"  "vcmpequh %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vcmpequw"  [(set (match_operand:V4SI 0 "register_operand" "=v")        (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")                      (match_operand:V4SI 2 "register_operand" "v")] 	              UNSPEC_VCMPEQUW))]  "TARGET_ALTIVEC"  "vcmpequw %0,%1,%2"  [(set_attr "type" "vecsimple")])(define_insn "altivec_vcmpeqfp"  [(set (match_operand:V4SI 0 "register_operand" "=v")        (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")                      (match_operand:V4SF 2 "register_operand" "v")] 	              UNSPEC_VCMPEQFP))]

⌨️ 快捷键说明

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