📄 altivec.md
字号:
;; AltiVec patterns.;; Copyright (C) 2002 Free Software Foundation, Inc.;; Contributed by Aldy Hernandez (aldy@quesejoda.com);; 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, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;; Generic LVX load instruction.(define_insn "altivec_lvx_4si" [(set (match_operand:V4SI 0 "altivec_register_operand" "=v") (match_operand:V4SI 1 "memory_operand" "m"))] "TARGET_ALTIVEC" "lvx %0,%y1" [(set_attr "type" "vecload")])(define_insn "altivec_lvx_8hi" [(set (match_operand:V8HI 0 "altivec_register_operand" "=v") (match_operand:V8HI 1 "memory_operand" "m"))] "TARGET_ALTIVEC" "lvx %0,%y1" [(set_attr "type" "vecload")])(define_insn "altivec_lvx_16qi" [(set (match_operand:V16QI 0 "altivec_register_operand" "=v") (match_operand:V16QI 1 "memory_operand" "m"))] "TARGET_ALTIVEC" "lvx %0,%y1" [(set_attr "type" "vecload")])(define_insn "altivec_lvx_4sf" [(set (match_operand:V4SF 0 "altivec_register_operand" "=v") (match_operand:V4SF 1 "memory_operand" "m"))] "TARGET_ALTIVEC" "lvx %0,%y1" [(set_attr "type" "vecload")]);; Generic STVX store instruction.(define_insn "altivec_stvx_4si" [(set (match_operand:V4SI 0 "memory_operand" "=m") (match_operand:V4SI 1 "altivec_register_operand" "v"))] "TARGET_ALTIVEC" "stvx %1,%y0" [(set_attr "type" "vecstore")])(define_insn "altivec_stvx_8hi" [(set (match_operand:V8HI 0 "memory_operand" "=m") (match_operand:V8HI 1 "altivec_register_operand" "v"))] "TARGET_ALTIVEC" "stvx %1,%y0" [(set_attr "type" "vecstore")])(define_insn "altivec_stvx_16qi" [(set (match_operand:V16QI 0 "memory_operand" "=m") (match_operand:V16QI 1 "altivec_register_operand" "v"))] "TARGET_ALTIVEC" "stvx %1,%y0" [(set_attr "type" "vecstore")])(define_insn "altivec_stvx_4sf" [(set (match_operand:V4SF 0 "memory_operand" "=m") (match_operand:V4SF 1 "altivec_register_operand" "v"))] "TARGET_ALTIVEC" "stvx %1,%y0" [(set_attr "type" "vecstore")]);; Vector move instructions.(define_expand "movv4si" [(set (match_operand:V4SI 0 "nonimmediate_operand" "") (match_operand:V4SI 1 "any_operand" ""))] "TARGET_ALTIVEC" "{ rs6000_emit_move (operands[0], operands[1], V4SImode); DONE; }")(define_insn "*movv4si_internal" [(set (match_operand:V4SI 0 "nonimmediate_operand" "=m,v,v,o,r,r") (match_operand:V4SI 1 "input_operand" "v,m,v,r,o,r"))] "TARGET_ALTIVEC" "@ stvx %1,%y0 lvx %0,%y1 vor %0,%1,%1 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1" [(set_attr "type" "altivec") (set_attr "length" "*,*,*,16,16,16")])(define_expand "movv8hi" [(set (match_operand:V8HI 0 "nonimmediate_operand" "") (match_operand:V8HI 1 "any_operand" ""))] "TARGET_ALTIVEC" "{ rs6000_emit_move (operands[0], operands[1], V8HImode); DONE; }")(define_insn "*movv8hi_internal1" [(set (match_operand:V8HI 0 "nonimmediate_operand" "=m,v,v,o,r,r") (match_operand:V8HI 1 "input_operand" "v,m,v,r,o,r"))] "TARGET_ALTIVEC" "@ stvx %1,%y0 lvx %0,%y1 vor %0,%1,%1 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1" [(set_attr "type" "altivec") (set_attr "length" "*,*,*,16,16,16")])(define_expand "movv16qi" [(set (match_operand:V16QI 0 "nonimmediate_operand" "") (match_operand:V16QI 1 "any_operand" ""))] "TARGET_ALTIVEC" "{ rs6000_emit_move (operands[0], operands[1], V16QImode); DONE; }")(define_insn "*movv16qi_internal1" [(set (match_operand:V16QI 0 "nonimmediate_operand" "=m,v,v,o,r,r") (match_operand:V16QI 1 "input_operand" "v,m,v,r,o,r"))] "TARGET_ALTIVEC" "@ stvx %1,%y0 lvx %0,%y1 vor %0,%1,%1 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1" [(set_attr "type" "altivec") (set_attr "length" "*,*,*,16,16,16")])(define_expand "movv4sf" [(set (match_operand:V4SF 0 "nonimmediate_operand" "") (match_operand:V4SF 1 "any_operand" ""))] "TARGET_ALTIVEC" "{ rs6000_emit_move (operands[0], operands[1], V4SFmode); DONE; }")(define_insn "*movv4sf_internal1" [(set (match_operand:V4SF 0 "nonimmediate_operand" "=m,v,v,o,r,r") (match_operand:V4SF 1 "input_operand" "v,m,v,r,o,r"))] "TARGET_ALTIVEC" "@ stvx %1,%y0 lvx %0,%y1 vor %0,%1,%1 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1" [(set_attr "type" "altivec") (set_attr "length" "*,*,*,16,16,16")])(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" "altivec")])(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" "altivec")]);; Vector clears(define_insn "*movv4si_const0" [(set (match_operand:V4SI 0 "altivec_register_operand" "=v") (match_operand:V4SI 1 "zero_constant" ""))] "TARGET_ALTIVEC" "vxor %0,%0,%0" [(set_attr "type" "vecsimple")])(define_insn "*movv4sf_const0" [(set (match_operand:V4SF 0 "altivec_register_operand" "=v") (match_operand:V4SF 1 "zero_constant" ""))] "TARGET_ALTIVEC" "vxor %0,%0,%0" [(set_attr "type" "vecsimple")])(define_insn "*movv8hi_const0" [(set (match_operand:V8HI 0 "altivec_register_operand" "=v") (match_operand:V8HI 1 "zero_constant" ""))] "TARGET_ALTIVEC" "vxor %0,%0,%0" [(set_attr "type" "vecsimple")])(define_insn "*movv16qi_const0" [(set (match_operand:V16QI 0 "altivec_register_operand" "=v") (match_operand:V16QI 1 "zero_constant" ""))] "TARGET_ALTIVEC" "vxor %0,%0,%0" [(set_attr "type" "vecsimple")]);; Simple binary operations.(define_insn "addv16qi3" [(set (match_operand:V16QI 0 "register_operand" "=v") (plus:V16QI (match_operand:V16QI 1 "register_operand" "v") (match_operand:V16QI 2 "register_operand" "v")))] "TARGET_ALTIVEC" "vaddubm %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "addv8hi3" [(set (match_operand:V8HI 0 "register_operand" "=v") (plus:V8HI (match_operand:V8HI 1 "register_operand" "v") (match_operand:V8HI 2 "register_operand" "v")))] "TARGET_ALTIVEC" "vadduhm %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "addv4si3" [(set (match_operand:V4SI 0 "register_operand" "=v") (plus:V4SI (match_operand:V4SI 1 "register_operand" "v") (match_operand:V4SI 2 "register_operand" "v")))] "TARGET_ALTIVEC" "vadduwm %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_vaddubs" [(set (match_operand:V16QI 0 "register_operand" "=v") (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") (match_operand:V16QI 2 "register_operand" "v")] 36)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vaddubs %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vaddsbs" [(set (match_operand:V16QI 0 "register_operand" "=v") (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") (match_operand:V16QI 2 "register_operand" "v")] 37)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vaddsbs %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vadduhs" [(set (match_operand:V8HI 0 "register_operand" "=v") (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") (match_operand:V8HI 2 "register_operand" "v")] 38)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vadduhs %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vaddshs" [(set (match_operand:V8HI 0 "register_operand" "=v") (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") (match_operand:V8HI 2 "register_operand" "v")] 39)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vaddshs %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vadduws" [(set (match_operand:V4SI 0 "register_operand" "=v") (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") (match_operand:V4SI 2 "register_operand" "v")] 40)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vadduws %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vaddsws" [(set (match_operand:V4SI 0 "register_operand" "=v") (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") (match_operand:V4SI 2 "register_operand" "v")] 41)) (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))] "TARGET_ALTIVEC" "vaddsws %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "andv4si3" [(set (match_operand:V4SI 0 "register_operand" "=v") (and:V4SI (match_operand:V4SI 1 "register_operand" "v") (match_operand:V4SI 2 "register_operand" "v")))] "TARGET_ALTIVEC" "vand %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vandc" [(set (match_operand:V4SI 0 "register_operand" "=v") (and:V4SI (match_operand:V4SI 1 "register_operand" "v") (not:V4SI (match_operand:V4SI 2 "register_operand" "v"))))] "TARGET_ALTIVEC" "vandc %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vavgub" [(set (match_operand:V16QI 0 "register_operand" "=v") (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") (match_operand:V16QI 2 "register_operand" "v")] 44))] "TARGET_ALTIVEC" "vavgub %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vavgsb" [(set (match_operand:V16QI 0 "register_operand" "=v") (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") (match_operand:V16QI 2 "register_operand" "v")] 45))] "TARGET_ALTIVEC" "vavgsb %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vavguh" [(set (match_operand:V8HI 0 "register_operand" "=v") (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") (match_operand:V8HI 2 "register_operand" "v")] 46))] "TARGET_ALTIVEC" "vavguh %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vavgsh" [(set (match_operand:V8HI 0 "register_operand" "=v") (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") (match_operand:V8HI 2 "register_operand" "v")] 47))] "TARGET_ALTIVEC" "vavgsh %0,%1,%2" [(set_attr "type" "vecsimple")])(define_insn "altivec_vavguw" [(set (match_operand:V4SI 0 "register_operand" "=v") (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") (match_operand:V4SI 2 "register_operand" "v")] 48))]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -