📄 sse.md
字号:
;; GCC machine description for SSE instructions;; Copyright (C) 2005;; Free Software Foundation, Inc.;;;; 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.;; 16 byte integral modes handled by SSE, minus TImode, which gets;; special-cased for TARGET_64BIT.(define_mode_macro SSEMODEI [V16QI V8HI V4SI V2DI]);; All 16-byte vector modes handled by SSE(define_mode_macro SSEMODE [V16QI V8HI V4SI V2DI V4SF V2DF]);; Mix-n-match(define_mode_macro SSEMODE12 [V16QI V8HI])(define_mode_macro SSEMODE24 [V8HI V4SI])(define_mode_macro SSEMODE124 [V16QI V8HI V4SI])(define_mode_macro SSEMODE248 [V8HI V4SI V2DI]);; Mapping from integer vector mode to mnemonic suffix(define_mode_attr ssevecsize [(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q")]);; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Move patterns;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; All of these patterns are enabled for SSE1 as well as SSE2.;; This is essential for maintaining stable calling conventions.(define_expand "mov<mode>" [(set (match_operand:SSEMODEI 0 "nonimmediate_operand" "") (match_operand:SSEMODEI 1 "nonimmediate_operand" ""))] "TARGET_SSE"{ ix86_expand_vector_move (<MODE>mode, operands); DONE;});; APPLE LOCAL begin mainline candidate 4476324(define_insn "*mov<mode>_internal" [(set (match_operand:SSEMODEI 0 "nonimmediate_operand" "=x,x ,m") (match_operand:SSEMODEI 1 "nonimmediate_or_sse_const_operand" "C ,xm,x"))];; APPLE LOCAL end mainline candidate 4476324 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"{ switch (which_alternative) { case 0: /* APPLE LOCAL mainline candidate 4283414 */ return standard_sse_constant_opcode (insn, operands[1]); case 1: case 2: if (get_attr_mode (insn) == MODE_V4SF) return "movaps\t{%1, %0|%0, %1}"; else return "movdqa\t{%1, %0|%0, %1}"; default: abort (); }} [(set_attr "type" "sselog1,ssemov,ssemov") (set (attr "mode") (cond [(eq (symbol_ref "TARGET_SSE2") (const_int 0)) (const_string "V4SF") (eq_attr "alternative" "0,1") (if_then_else (ne (symbol_ref "optimize_size") (const_int 0)) (const_string "V4SF") (const_string "TI")) (eq_attr "alternative" "2") (if_then_else (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") (const_int 0)) (ne (symbol_ref "optimize_size") (const_int 0))) (const_string "V4SF") (const_string "TI"))] (const_string "TI")))])(define_expand "movv4sf" [(set (match_operand:V4SF 0 "nonimmediate_operand" "") (match_operand:V4SF 1 "nonimmediate_operand" ""))] "TARGET_SSE"{ ix86_expand_vector_move (V4SFmode, operands); DONE;});; APPLE LOCAL begin mainline candidate 4476324(define_insn "*movv4sf_internal" [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m") (match_operand:V4SF 1 "nonimmediate_or_sse_const_operand" "C,xm,x"))] "TARGET_SSE";; APPLE LOCAL end mainline candidate 4476324/* APPLE LOCAL begin mainline candidate 4283414 */{ switch (which_alternative) { case 0: return standard_sse_constant_opcode (insn, operands[1]); case 1: case 2: return "movaps\t{%1, %0|%0, %1}"; default: abort(); }}/* APPLE LOCAL end mainline candidate 4283414 */ [(set_attr "type" "sselog1,ssemov,ssemov") (set_attr "mode" "V4SF")])(define_split [(set (match_operand:V4SF 0 "register_operand" "") (match_operand:V4SF 1 "zero_extended_scalar_load_operand" ""))] "TARGET_SSE && reload_completed" [(set (match_dup 0) (vec_merge:V4SF (vec_duplicate:V4SF (match_dup 1)) (match_dup 2) (const_int 1)))]{ operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0); operands[2] = CONST0_RTX (V4SFmode);})(define_expand "movv2df" [(set (match_operand:V2DF 0 "nonimmediate_operand" "") (match_operand:V2DF 1 "nonimmediate_operand" ""))] "TARGET_SSE"{ ix86_expand_vector_move (V2DFmode, operands); DONE;});; APPLE LOCAL begin mainline candidate 4476324(define_insn "*movv2df_internal" [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m") (match_operand:V2DF 1 "nonimmediate_or_sse_const_operand" "C,xm,x"))] "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))";; APPLE LOCAL end mainline candidate 4476324{ switch (which_alternative) { case 0: /* APPLE LOCAL mainline candidate 4283414 */ return standard_sse_constant_opcode (insn, operands[1]); case 1: case 2: if (get_attr_mode (insn) == MODE_V4SF) return "movaps\t{%1, %0|%0, %1}"; else return "movapd\t{%1, %0|%0, %1}"; default: abort (); }} [(set_attr "type" "sselog1,ssemov,ssemov") (set (attr "mode") (cond [(eq (symbol_ref "TARGET_SSE2") (const_int 0)) (const_string "V4SF") (eq_attr "alternative" "0,1") (if_then_else (ne (symbol_ref "optimize_size") (const_int 0)) (const_string "V4SF") (const_string "V2DF")) (eq_attr "alternative" "2") (if_then_else (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") (const_int 0)) (ne (symbol_ref "optimize_size") (const_int 0))) (const_string "V4SF") (const_string "V2DF"))] (const_string "V2DF")))])(define_split [(set (match_operand:V2DF 0 "register_operand" "") (match_operand:V2DF 1 "zero_extended_scalar_load_operand" ""))] "TARGET_SSE2 && reload_completed" [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]{ operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0); operands[2] = CONST0_RTX (DFmode);})(define_expand "push<mode>1" [(match_operand:SSEMODE 0 "register_operand" "")] "TARGET_SSE"{ ix86_expand_push (<MODE>mode, operands[0]); DONE;})(define_expand "movmisalign<mode>" [(set (match_operand:SSEMODE 0 "nonimmediate_operand" "") (match_operand:SSEMODE 1 "nonimmediate_operand" ""))] "TARGET_SSE"{ ix86_expand_vector_move_misalign (<MODE>mode, operands); DONE;})(define_insn "sse_movups" [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m") (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")] UNSPEC_MOVU))] "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "movups\t{%1, %0|%0, %1}" [(set_attr "type" "ssemov") (set_attr "mode" "V2DF")])(define_insn "sse2_movupd" [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m") (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")] UNSPEC_MOVU))] "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "movupd\t{%1, %0|%0, %1}" [(set_attr "type" "ssemov") (set_attr "mode" "V2DF")])(define_insn "sse2_movdqu" [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m") (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")] UNSPEC_MOVU))] "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "movdqu\t{%1, %0|%0, %1}" [(set_attr "type" "ssemov") (set_attr "mode" "TI")])(define_insn "sse_movntv4sf" [(set (match_operand:V4SF 0 "memory_operand" "=m") (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")] UNSPEC_MOVNT))] "TARGET_SSE" "movntps\t{%1, %0|%0, %1}" [(set_attr "type" "ssemov") (set_attr "mode" "V4SF")])(define_insn "sse2_movntv2df" [(set (match_operand:V2DF 0 "memory_operand" "=m") (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")] UNSPEC_MOVNT))] "TARGET_SSE2" "movntpd\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "V2DF")])(define_insn "sse2_movntv2di" [(set (match_operand:V2DI 0 "memory_operand" "=m") (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x")] UNSPEC_MOVNT))] "TARGET_SSE2" "movntdq\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "TI")])(define_insn "sse2_movntsi" [(set (match_operand:SI 0 "memory_operand" "=m") (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_MOVNT))] "TARGET_SSE2" "movnti\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "V2DF")]);; APPLE LOCAL begin 4099020, 4121692(define_insn "sse_loadqv4si" [(set (match_operand:V4SI 0 "register_operand" "=rx") (unspec:V4SI [(zero_extend:V4SI (match_operand:V2SI 1 "memory_operand" "m"))] UNSPEC_LDQ))] "TARGET_SSE" "movq\t{%1, %0|%0, %1}");; APPLE LOCAL begin 4279065(define_insn "sse_storeqv4si" [(set (match_operand:V2SI 0 "memory_operand" "=m") (unspec:V2SI [(match_operand:V4SI 1 "register_operand" "x")] UNSPEC_STOQ))] "TARGET_SSE" "movq\t{%1, %0|%0, %1}");; APPLE LOCAL end 4279065(define_insn "sse_movqv4si" [(set (match_operand:V4SI 0 "register_operand" "=x") (unspec:V4SI [(zero_extend:V4SI (subreg:V2SI (match_operand:V4SI 1 "register_operand" "x") 0))] UNSPEC_MOVQ))] "TARGET_SSE" "movq\t{%1, %0|%0, %1}");; APPLE LOCAL end 4099020, 4121692(define_insn "sse3_lddqu" [(set (match_operand:V16QI 0 "register_operand" "=x") (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")] UNSPEC_LDQQU))] "TARGET_SSE3" "lddqu\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "TI")]);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Parallel single-precision floating point arithmetic;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(define_expand "negv4sf2" [(set (match_operand:V4SF 0 "register_operand" "") (neg:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "")))] "TARGET_SSE" "ix86_expand_fp_absneg_operator (NEG, V4SFmode, operands); DONE;")(define_expand "absv4sf2" [(set (match_operand:V4SF 0 "register_operand" "") (abs:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "")))] "TARGET_SSE" "ix86_expand_fp_absneg_operator (ABS, V4SFmode, operands); DONE;")(define_expand "addv4sf3" [(set (match_operand:V4SF 0 "register_operand" "") (plus:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "") (match_operand:V4SF 2 "nonimmediate_operand" "")))] "TARGET_SSE" "ix86_fixup_binary_operands_no_copy (PLUS, V4SFmode, operands);")(define_insn "*addv4sf3" [(set (match_operand:V4SF 0 "register_operand" "=x") (plus:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")))] "TARGET_SSE && ix86_binary_operator_ok (PLUS, V4SFmode, operands)" "addps\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V4SF")])(define_insn "sse_vmaddv4sf3" [(set (match_operand:V4SF 0 "register_operand" "=x") (vec_merge:V4SF (plus:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")) (match_dup 1) (const_int 1)))] "TARGET_SSE && ix86_binary_operator_ok (PLUS, V4SFmode, operands)" "addss\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "SF")])(define_expand "subv4sf3" [(set (match_operand:V4SF 0 "register_operand" "") (minus:V4SF (match_operand:V4SF 1 "register_operand" "") (match_operand:V4SF 2 "nonimmediate_operand" "")))] "TARGET_SSE" "ix86_fixup_binary_operands_no_copy (MINUS, V4SFmode, operands);")(define_insn "*subv4sf3" [(set (match_operand:V4SF 0 "register_operand" "=x") (minus:V4SF (match_operand:V4SF 1 "register_operand" "0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")))] "TARGET_SSE" "subps\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V4SF")])(define_insn "sse_vmsubv4sf3" [(set (match_operand:V4SF 0 "register_operand" "=x") (vec_merge:V4SF (minus:V4SF (match_operand:V4SF 1 "register_operand" "0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")) (match_dup 1) (const_int 1)))] "TARGET_SSE" "subss\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "SF")])(define_expand "mulv4sf3" [(set (match_operand:V4SF 0 "register_operand" "") (mult:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "") (match_operand:V4SF 2 "nonimmediate_operand" "")))]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -