i386.md (*movti_internal): Merge from *movti_internal_rex64 and *movti_internal_sse.

* config/i386/i386.md (*movti_internal): Merge from
	*movti_internal_rex64 and *movti_internal_sse.  Use x64 isa attribute.
	(*movdi_internal): Merge with *movdi_internal_rex64.  Use x64 and
	nox64 isa attributes.

From-SVN: r196784
This commit is contained in:
Uros Bizjak 2013-03-19 08:36:15 +01:00 committed by Uros Bizjak
parent 6e55eda727
commit 2eac0476ce
2 changed files with 124 additions and 226 deletions

View File

@ -1,3 +1,10 @@
2013-03-19 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*movti_internal): Merge from
*movti_internal_rex64 and *movti_internal_sse. Use x64 isa attribute.
(*movdi_internal): Merge with *movdi_internal_rex64. Use x64 and
nox64 isa attributes.
2013-03-18 Richard Biener <rguenther@suse.de> 2013-03-18 Richard Biener <rguenther@suse.de>
* tree-ssa-structalias.c (find): Use gcc_checking_assert. * tree-ssa-structalias.c (find): Use gcc_checking_assert.

View File

@ -1656,6 +1656,40 @@
;; Move instructions. ;; Move instructions.
;; Reload patterns to support multi-word load/store
;; with non-offsetable address.
(define_expand "reload_noff_store"
[(parallel [(match_operand 0 "memory_operand" "=m")
(match_operand 1 "register_operand" "r")
(match_operand:DI 2 "register_operand" "=&r")])]
"TARGET_64BIT"
{
rtx mem = operands[0];
rtx addr = XEXP (mem, 0);
emit_move_insn (operands[2], addr);
mem = replace_equiv_address_nv (mem, operands[2]);
emit_insn (gen_rtx_SET (VOIDmode, mem, operands[1]));
DONE;
})
(define_expand "reload_noff_load"
[(parallel [(match_operand 0 "register_operand" "=r")
(match_operand 1 "memory_operand" "m")
(match_operand:DI 2 "register_operand" "=r")])]
"TARGET_64BIT"
{
rtx mem = operands[1];
rtx addr = XEXP (mem, 0);
emit_move_insn (operands[2], addr);
mem = replace_equiv_address_nv (mem, operands[2]);
emit_insn (gen_rtx_SET (VOIDmode, operands[0], mem));
DONE;
})
(define_expand "movoi" (define_expand "movoi"
[(set (match_operand:OI 0 "nonimmediate_operand") [(set (match_operand:OI 0 "nonimmediate_operand")
(match_operand:OI 1 "general_operand"))] (match_operand:OI 1 "general_operand"))]
@ -1760,10 +1794,11 @@
] ]
(const_string "OI")))]) (const_string "OI")))])
(define_insn "*movti_internal_rex64" (define_insn "*movti_internal"
[(set (match_operand:TI 0 "nonimmediate_operand" "=!r ,o ,x,x ,m") [(set (match_operand:TI 0 "nonimmediate_operand" "=!r ,o ,x,x ,m")
(match_operand:TI 1 "general_operand" "riFo,re,C,xm,x"))] (match_operand:TI 1 "general_operand" "riFo,re,C,xm,x"))]
"TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "(TARGET_64BIT || TARGET_SSE)
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
{ {
switch (which_alternative) switch (which_alternative)
{ {
@ -1795,12 +1830,14 @@
gcc_unreachable (); gcc_unreachable ();
} }
} }
[(set_attr "type" "*,*,sselog1,ssemov,ssemov") [(set_attr "isa" "x64,x64,*,*,*")
(set_attr "type" "*,*,sselog1,ssemov,ssemov")
(set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex") (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
(set (attr "mode") (set (attr "mode")
(cond [(eq_attr "alternative" "0,1") (cond [(eq_attr "alternative" "0,1")
(const_string "DI") (const_string "DI")
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") (ior (not (match_test "TARGET_SSE2"))
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
(const_string "V4SF") (const_string "V4SF")
(and (eq_attr "alternative" "4") (and (eq_attr "alternative" "4")
(match_test "TARGET_SSE_TYPELESS_STORES")) (match_test "TARGET_SSE_TYPELESS_STORES"))
@ -1820,81 +1857,20 @@
[(const_int 0)] [(const_int 0)]
"ix86_split_long_move (operands); DONE;") "ix86_split_long_move (operands); DONE;")
(define_insn "*movti_internal_sse" (define_insn "*movdi_internal"
[(set (match_operand:TI 0 "nonimmediate_operand" "=x,x ,m")
(match_operand:TI 1 "vector_move_operand" "C ,xm,x"))]
"TARGET_SSE && !TARGET_64BIT
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
switch (which_alternative)
{
case 0:
return standard_sse_constant_opcode (insn, operands[1]);
case 1:
case 2:
/* TDmode values are passed as TImode on the stack. Moving them
to stack may result in unaligned memory access. */
if (misaligned_operand (operands[0], TImode)
|| misaligned_operand (operands[1], TImode))
{
if (get_attr_mode (insn) == MODE_V4SF)
return "%vmovups\t{%1, %0|%0, %1}";
else
return "%vmovdqu\t{%1, %0|%0, %1}";
}
else
{
if (get_attr_mode (insn) == MODE_V4SF)
return "%vmovaps\t{%1, %0|%0, %1}";
else
return "%vmovdqa\t{%1, %0|%0, %1}";
}
default:
gcc_unreachable ();
}
}
[(set_attr "type" "sselog1,ssemov,ssemov")
(set_attr "prefix" "maybe_vex")
(set (attr "mode")
(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
(const_string "V4SF")
(and (eq_attr "alternative" "2")
(match_test "TARGET_SSE_TYPELESS_STORES"))
(const_string "V4SF")
(match_test "TARGET_AVX")
(const_string "TI")
(ior (not (match_test "TARGET_SSE2"))
(match_test "optimize_function_for_size_p (cfun)"))
(const_string "V4SF")
]
(const_string "TI")))])
(define_insn "*movdi_internal_rex64"
[(set (match_operand:DI 0 "nonimmediate_operand" [(set (match_operand:DI 0 "nonimmediate_operand"
"=r,r ,r,m ,*y,m*y,?*y,?r ,?*Ym,*x,m ,*x,*x,?r ,?*Yi,?*x,?*Ym") "=r ,o ,r,r ,r,m ,*y,m*y,*y,?*y,?r ,?*Ym,*x,m ,*x,*x,?r ,?*Yi,?*x,?*Ym")
(match_operand:DI 1 "general_operand" (match_operand:DI 1 "general_operand"
"Z ,rem,i,re,C ,*y ,m ,*Ym,r ,C ,*x,*x,m ,*Yi,r ,*Ym,*x"))] "riFo,riF,Z,rem,i,re,C ,*y ,m ,m ,*Ym,r ,C ,*x,*x,m ,*Yi,r ,*Ym,*x"))]
"TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
{ {
switch (get_attr_type (insn)) switch (get_attr_type (insn))
{ {
case TYPE_SSECVT: case TYPE_MULTI:
if (SSE_REG_P (operands[0])) return "#";
return "movq2dq\t{%1, %0|%0, %1}";
else
return "movdq2q\t{%1, %0|%0, %1}";
case TYPE_SSEMOV: case TYPE_MMX:
if (get_attr_mode (insn) == MODE_V4SF) return "pxor\t%0, %0";
return "%vmovaps\t{%1, %0|%0, %1}";
else if (get_attr_mode (insn) == MODE_TI)
return "%vmovdqa\t{%1, %0|%0, %1}";
/* Handle broken assemblers that require movd instead of movq. */
if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
return "%vmovd\t{%1, %0|%0, %1}";
else
return "%vmovq\t{%1, %0|%0, %1}";
case TYPE_MMXMOV: case TYPE_MMXMOV:
/* Handle broken assemblers that require movd instead of movq. */ /* Handle broken assemblers that require movd instead of movq. */
@ -1906,8 +1882,27 @@
case TYPE_SSELOG1: case TYPE_SSELOG1:
return standard_sse_constant_opcode (insn, operands[1]); return standard_sse_constant_opcode (insn, operands[1]);
case TYPE_MMX: case TYPE_SSEMOV:
return "pxor\t%0, %0"; switch (get_attr_mode (insn))
{
case MODE_DI:
return "%vmovq\t{%1, %0|%0, %1}";
case MODE_TI:
return "%vmovdqa\t{%1, %0|%0, %1}";
case MODE_V4SF:
return "%vmovaps\t{%1, %0|%0, %1}";
case MODE_V2SF:
gcc_assert (!TARGET_AVX);
return "movlps\t{%1, %0|%0, %1}";
default:
gcc_unreachable ();
}
case TYPE_SSECVT:
if (SSE_REG_P (operands[0]))
return "movq2dq\t{%1, %0|%0, %1}";
else
return "movdq2q\t{%1, %0|%0, %1}";
case TYPE_LEA: case TYPE_LEA:
return "lea{q}\t{%E1, %0|%0, %E1}"; return "lea{q}\t{%E1, %0|%0, %E1}";
@ -1916,7 +1911,7 @@
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1])); gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
if (get_attr_mode (insn) == MODE_SI) if (get_attr_mode (insn) == MODE_SI)
return "mov{l}\t{%k1, %k0|%k0, %k1}"; return "mov{l}\t{%k1, %k0|%k0, %k1}";
else if (which_alternative == 2) else if (which_alternative == 4)
return "movabs{q}\t{%1, %0|%0, %1}"; return "movabs{q}\t{%1, %0|%0, %1}";
else if (ix86_use_lea_for_mov (insn, operands)) else if (ix86_use_lea_for_mov (insn, operands))
return "lea{q}\t{%E1, %0|%0, %E1}"; return "lea{q}\t{%E1, %0|%0, %E1}";
@ -1924,16 +1919,27 @@
return "mov{q}\t{%1, %0|%0, %1}"; return "mov{q}\t{%1, %0|%0, %1}";
} }
} }
[(set (attr "type") [(set (attr "isa")
(cond [(eq_attr "alternative" "4") (cond [(eq_attr "alternative" "0,1,8")
(const_string "nox64")
(eq_attr "alternative" "2,3,4,5,9,10,11,16,17")
(const_string "x64")
(eq_attr "alternative" "18,19")
(const_string "sse2")
]
(const_string "*")))
(set (attr "type")
(cond [(eq_attr "alternative" "0,1")
(const_string "multi")
(eq_attr "alternative" "6")
(const_string "mmx") (const_string "mmx")
(eq_attr "alternative" "5,6,7,8") (eq_attr "alternative" "7,8,9,10,11")
(const_string "mmxmov") (const_string "mmxmov")
(eq_attr "alternative" "9") (eq_attr "alternative" "12")
(const_string "sselog1") (const_string "sselog1")
(eq_attr "alternative" "10,11,12,13,14") (eq_attr "alternative" "13,14,15,16,17")
(const_string "ssemov") (const_string "ssemov")
(eq_attr "alternative" "15,16") (eq_attr "alternative" "18,19")
(const_string "ssecvt") (const_string "ssecvt")
(match_operand 1 "pic_32bit_operand") (match_operand 1 "pic_32bit_operand")
(const_string "lea") (const_string "lea")
@ -1941,159 +1947,43 @@
(const_string "imov"))) (const_string "imov")))
(set (attr "modrm") (set (attr "modrm")
(if_then_else (if_then_else
(and (eq_attr "alternative" "2") (eq_attr "type" "imov")) (and (eq_attr "alternative" "4") (eq_attr "type" "imov"))
(const_string "0") (const_string "0")
(const_string "*"))) (const_string "*")))
(set (attr "length_immediate") (set (attr "length_immediate")
(if_then_else (if_then_else
(and (eq_attr "alternative" "2") (eq_attr "type" "imov")) (and (eq_attr "alternative" "4") (eq_attr "type" "imov"))
(const_string "8") (const_string "8")
(const_string "*"))) (const_string "*")))
(set (attr "prefix_rex") (set (attr "prefix_rex")
(if_then_else (eq_attr "alternative" "7,8") (if_then_else (eq_attr "alternative" "10,11")
(const_string "1") (const_string "1")
(const_string "*"))) (const_string "*")))
(set (attr "prefix")
(if_then_else (eq_attr "type" "sselog1,ssemov")
(const_string "maybe_vex")
(const_string "orig")))
(set (attr "prefix_data16") (set (attr "prefix_data16")
(if_then_else (eq_attr "alternative" "10") (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "DI"))
(const_string "1") (const_string "1")
(const_string "*"))) (const_string "*")))
(set (attr "prefix")
(if_then_else (eq_attr "alternative" "9,10,11,12,13,14")
(const_string "maybe_vex")
(const_string "orig")))
(set (attr "mode") (set (attr "mode")
(cond [(eq_attr "alternative" "0") (cond [(eq_attr "alternative" "2")
(const_string "SI") (const_string "SI")
(eq_attr "alternative" "9,11") (eq_attr "alternative" "12,14")
(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") (cond [(ior (not (match_test "TARGET_SSE2"))
(const_string "V4SF") (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
(match_test "TARGET_AVX") (const_string "V4SF")
(const_string "TI") (match_test "TARGET_AVX")
(match_test "optimize_function_for_size_p (cfun)") (const_string "TI")
(const_string "V4SF") (match_test "optimize_function_for_size_p (cfun)")
] (const_string "V4SF")
(const_string "TI")) ]
] (const_string "TI"))
(const_string "DI")))])
;; Reload patterns to support multi-word load/store (and (eq_attr "alternative" "13,15")
;; with non-offsetable address. (not (match_test "TARGET_SSE2")))
(define_expand "reload_noff_store" (const_string "V2SF")
[(parallel [(match_operand 0 "memory_operand" "=m")
(match_operand 1 "register_operand" "r")
(match_operand:DI 2 "register_operand" "=&r")])]
"TARGET_64BIT"
{
rtx mem = operands[0];
rtx addr = XEXP (mem, 0);
emit_move_insn (operands[2], addr);
mem = replace_equiv_address_nv (mem, operands[2]);
emit_insn (gen_rtx_SET (VOIDmode, mem, operands[1]));
DONE;
})
(define_expand "reload_noff_load"
[(parallel [(match_operand 0 "register_operand" "=r")
(match_operand 1 "memory_operand" "m")
(match_operand:DI 2 "register_operand" "=r")])]
"TARGET_64BIT"
{
rtx mem = operands[1];
rtx addr = XEXP (mem, 0);
emit_move_insn (operands[2], addr);
mem = replace_equiv_address_nv (mem, operands[2]);
emit_insn (gen_rtx_SET (VOIDmode, operands[0], mem));
DONE;
})
(define_insn "*movdi_internal"
[(set (match_operand:DI 0 "nonimmediate_operand"
"=r ,o ,*y,m*y,*y,*x,m ,*x,*x,*x,m ,*x,*x,?*x,?*Ym")
(match_operand:DI 1 "general_operand"
"riFo,riF,C ,*y ,m ,C ,*x,*x,m ,C ,*x,*x,m ,*Ym,*x"))]
"!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
switch (get_attr_type (insn))
{
case TYPE_SSECVT:
if (SSE_REG_P (operands[0]))
return "movq2dq\t{%1, %0|%0, %1}";
else
return "movdq2q\t{%1, %0|%0, %1}";
case TYPE_SSEMOV:
switch (get_attr_mode (insn))
{
case MODE_TI:
return "%vmovdqa\t{%1, %0|%0, %1}";
case MODE_DI:
return "%vmovq\t{%1, %0|%0, %1}";
case MODE_V4SF:
return "%vmovaps\t{%1, %0|%0, %1}";
case MODE_V2SF:
return "movlps\t{%1, %0|%0, %1}";
default:
gcc_unreachable ();
}
case TYPE_MMXMOV:
return "movq\t{%1, %0|%0, %1}";
case TYPE_SSELOG1:
return standard_sse_constant_opcode (insn, operands[1]);
case TYPE_MMX:
return "pxor\t%0, %0";
case TYPE_MULTI:
return "#";
default:
gcc_unreachable ();
}
}
[(set (attr "isa")
(cond [(eq_attr "alternative" "5,6,7,8,13,14")
(const_string "sse2")
(eq_attr "alternative" "9,10,11,12")
(const_string "noavx")
]
(const_string "*")))
(set (attr "type")
(cond [(eq_attr "alternative" "0,1")
(const_string "multi")
(eq_attr "alternative" "2")
(const_string "mmx")
(eq_attr "alternative" "3,4")
(const_string "mmxmov")
(eq_attr "alternative" "5,9")
(const_string "sselog1")
(eq_attr "alternative" "13,14")
(const_string "ssecvt")
]
(const_string "ssemov")))
(set (attr "prefix")
(if_then_else (eq_attr "alternative" "5,6,7,8")
(const_string "maybe_vex")
(const_string "orig")))
(set (attr "mode")
(cond [(eq_attr "alternative" "9,11")
(const_string "V4SF")
(eq_attr "alternative" "10,12")
(const_string "V2SF")
(eq_attr "alternative" "5,7")
(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
(const_string "V4SF")
(match_test "TARGET_AVX")
(const_string "TI")
(match_test "optimize_function_for_size_p (cfun)")
(const_string "V4SF")
]
(const_string "TI"))
] ]
(const_string "DI")))]) (const_string "DI")))])
@ -2186,6 +2076,7 @@
(const_string "V4SF") (const_string "V4SF")
] ]
(const_string "TI")) (const_string "TI"))
(and (eq_attr "alternative" "8,9,10,11") (and (eq_attr "alternative" "8,9,10,11")
(not (match_test "TARGET_SSE2"))) (not (match_test "TARGET_SSE2")))
(const_string "SF") (const_string "SF")
@ -2896,7 +2787,8 @@
case MODE_V1DF: case MODE_V1DF:
return "%vmovlpd\t{%1, %d0|%d0, %1}"; return "%vmovlpd\t{%1, %d0|%d0, %1}";
case MODE_V2SF: case MODE_V2SF:
return "%vmovlps\t{%1, %d0|%d0, %1}"; gcc_assert (!TARGET_AVX);
return "movlps\t{%1, %0|%0, %1}";
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
@ -2994,10 +2886,9 @@
] ]
(const_string "DF")) (const_string "DF"))
(eq_attr "alternative" "12,16") (and (eq_attr "alternative" "12,16")
(if_then_else (match_test "TARGET_SSE2") (not (match_test "TARGET_SSE2")))
(const_string "DF") (const_string "V2SF")
(const_string "V2SF"))
] ]
(const_string "DF")))]) (const_string "DF")))])