(set_attr "length_immediate" "1")])
(define_insn "*movsi_1"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=*a,r,*a,m,!*y,!r")
- (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,r,*y"))]
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=*a,r,*a,m,!*y,!rm,!*Y,!rm,!*Y")
+ (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,rm,*y,rm,*Y,*Y"))]
"GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
"*
{
switch (get_attr_type (insn))
{
+ case TYPE_SSE:
+ if (get_attr_mode (insn) == TImode)
+ return \"movdqa\\t{%1, %0|%0, %1}\";
+ return \"movd\\t{%1, %0|%0, %1}\";
+
case TYPE_MMX:
return \"movd\\t{%1, %0|%0, %1}\";
}
}"
[(set (attr "type")
- (cond [(ior (match_operand:SI 0 "mmx_reg_operand" "")
- (match_operand:SI 1 "mmx_reg_operand" ""))
+ (cond [(eq_attr "alternative" "4,5")
(const_string "mmx")
+ (eq_attr "alternative" "6,7,8")
+ (const_string "sse")
(and (ne (symbol_ref "flag_pic") (const_int 0))
(match_operand:SI 1 "symbolic_operand" ""))
(const_string "lea")
]
(const_string "imov")))
- (set_attr "modrm" "0,*,0,*,*,*")
- (set_attr "mode" "SI")])
+ (set_attr "modrm" "0,*,0,*,*,*,*,*,*")
+ (set_attr "mode" "SI,SI,SI,SI,SI,SI,TI,SI,SI")])
;; Stores and loads of ax to arbitary constant address.
;; We fake an second form of instruction to force reload to load address
(set_attr "length_immediate" "1")])
(define_insn "*movdi_2"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!m*y,!*y")
- (match_operand:DI 1 "general_operand" "riFo,riF,*y,m"))]
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!m*y,!*y,!m,*Y,!*Y")
+ (match_operand:DI 1 "general_operand" "riFo,riF,*y,m,*Y,*Y,m"))]
"!TARGET_64BIT
&& (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
"@
#
#
movq\\t{%1, %0|%0, %1}
+ movq\\t{%1, %0|%0, %1}
+ movq\\t{%1, %0|%0, %1}
+ movdqa\\t{%1, %0|%0, %1}
movq\\t{%1, %0|%0, %1}"
- [(set_attr "type" "*,*,mmx,mmx")])
+ [(set_attr "type" "*,*,mmx,mmx,sse,sse,sse")
+ (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
(define_split
[(set (match_operand:DI 0 "push_operand" "")
"ix86_split_long_move (operands); DONE;")
(define_insn "*movdi_1_rex64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!m*y,!*y,m*Y,*Y")
- (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,m,*Y,*m"))]
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!m*y,!*y,!*Y,!m,!*Y")
+ (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,m,*Y,*Y,*m"))]
"(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
&& TARGET_64BIT"
"*
switch (get_attr_type (insn))
{
case TYPE_SSE:
+ if (register_operand (operands[0], DImode)
+ && register_operand (operands[1], DImode))
+ return \"movdqa\\t{%1, %0|%0, %1}\";
+ /* FALLTHRU */
case TYPE_MMX:
- return \"movd\\t{%1, %0|%0, %1}\";
+ return \"movq\\t{%1, %0|%0, %1}\";
case TYPE_MULTI:
return \"#\";
case TYPE_LEA:
(const_string "lea")
]
(const_string "imov")))
- (set_attr "modrm" "*,0,0,*,*,*,*,*,*")
- (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*")
- (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI")])
+ (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*")
+ (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*")
+ (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI")])
;; Stores and loads of ax to arbitary constant address.
;; We fake an second form of instruction to force reload to load address
/* Using SSE is tricky, since we need bitwise negation of -0
in register. */
rtx reg = gen_reg_rtx (SFmode);
+ rtx dest = operands[0];
+
+ operands[1] = force_reg (SFmode, operands[1]);
+ operands[0] = force_reg (SFmode, operands[0]);
emit_move_insn (reg,
gen_lowpart (SFmode,
- trunc_int_for_mode (0x80000000,
- SImode)));
+ GEN_INT (trunc_int_for_mode (0x80000000,
+ SImode))));
emit_insn (gen_negsf2_ifs (operands[0], operands[1], reg));
+ if (dest != operands[0])
+ emit_move_insn (dest, operands[0]);
}
DONE;
}
"#")
(define_insn "negsf2_ifs"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,r#xf")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
(neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0")))
- (use (match_operand:SF 2 "nonmemory_operand" "x#x,0#x,*X#x,*X#x"))
+ (use (match_operand:SF 2 "nonmemory_operand" "x,0#x,*g#x,*g#x"))
(clobber (reg:CC 17))]
- "TARGET_SSE"
+ "TARGET_SSE
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
"#")
(define_split
(neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))
(clobber (reg:CC 17))])]
"TARGET_80387"
- "if (TARGET_SSE)
+ "if (TARGET_SSE2)
{
/* In case operand is in memory, we will not use SSE. */
if (memory_operand (operands[0], VOIDmode)
in register. */
rtx reg = gen_reg_rtx (DFmode);
#if HOST_BITS_PER_WIDE_INT >= 64
- rtx imm = GEN_INT (0x80000000);
+ rtx imm = GEN_INT (trunc_int_for_mode(((HOST_WIDE_INT)1) << 63,
+ DImode));
#else
rtx imm = immed_double_const (0, 0x80000000, DImode);
#endif
+ rtx dest = operands[0];
+
+ operands[1] = force_reg (DFmode, operands[1]);
+ operands[0] = force_reg (DFmode, operands[0]);
emit_move_insn (reg, gen_lowpart (DFmode, imm));
emit_insn (gen_negdf2_ifs (operands[0], operands[1], reg));
+ if (dest != operands[0])
+ emit_move_insn (dest, operands[0]);
}
DONE;
}
"#")
(define_insn "negdf2_ifs"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,r#xf")
- (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,x#fr,0,0")))
- (use (match_operand:DF 2 "nonmemory_operand" "x#x,0#x,*X#x,*X#x"))
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
+ (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
+ (use (match_operand:DF 2 "nonmemory_operand" "Y,0,*g#Y,*g#Y"))
(clobber (reg:CC 17))]
- "TARGET_SSE"
+ "TARGET_SSE2 && !TARGET_64BIT
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
+ "#")
+
+(define_insn "*negdf2_ifs_rex64"
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,fm#Yr,r#Yf")
+ (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
+ (use (match_operand:DF 2 "general_operand" "Y,0,*g#Yr,*rm"))
+ (clobber (reg:CC 17))]
+ "TARGET_SSE2 && TARGET_64BIT
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
"#")
(define_split
(neg:DF (match_operand:DF 1 "register_operand" "")))
(use (match_operand:DF 2 "" ""))
(clobber (reg:CC 17))]
- "reload_completed && !SSE_REG_P (operands[0])"
+ "reload_completed && !SSE_REG_P (operands[0])
+ && (!TARGET_64BIT || FP_REG_P (operands[0]))"
[(parallel [(set (match_dup 0)
(neg:DF (match_dup 1)))
(clobber (reg:CC 17))])])
+(define_split
+ [(set (match_operand:DF 0 "register_operand" "")
+ (neg:DF (match_operand:DF 1 "register_operand" "")))
+ (use (match_operand:DF 2 "" ""))
+ (clobber (reg:CC 17))]
+ "reload_completed && GENERAL_REG_P (operands[0]) && TARGET_64BIT"
+ [(parallel [(set (match_dup 0)
+ (xor:DI (match_dup 1) (match_dup 2)))
+ (clobber (reg:CC 17))])]
+ "operands[0] = gen_lowpart (DImode, operands[0]);
+ operands[1] = gen_lowpart (DImode, operands[1]);
+ operands[2] = gen_lowpart (DImode, operands[2]);")
+
(define_split
[(set (match_operand:DF 0 "register_operand" "")
(neg:DF (match_operand:DF 1 "register_operand" "")))
[(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
(neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
(clobber (reg:CC 17))]
- "TARGET_80387 && ix86_unary_operator_ok (NEG, DFmode, operands)"
+ "TARGET_80387 && !TARGET_64BIT
+ && ix86_unary_operator_ok (NEG, DFmode, operands)"
+ "#")
+
+;; FIXME: We should to allow integer registers here. Problem is that
+;; we need another scratch register to get constant from.
+;; Forcing constant to mem if no register available in peep2 should be
+;; safe even for PIC mode, because of RIP relative addressing.
+(define_insn "*negdf2_if_rex64"
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
+ (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
+ (clobber (reg:CC 17))]
+ "TARGET_80387 && TARGET_64BIT
+ && ix86_unary_operator_ok (NEG, DFmode, operands)"
"#")
(define_split
[(set (match_operand:DF 0 "register_operand" "")
(neg:DF (match_operand:DF 1 "register_operand" "")))
(clobber (reg:CC 17))]
- "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
+ "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))
+ && !TARGET_64BIT"
[(parallel [(set (match_dup 3) (xor:SI (match_dup 3) (match_dup 4)))
(clobber (reg:CC 17))])]
"operands[4] = GEN_INT (trunc_int_for_mode (0x80000000, SImode));
[(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
(clobber (reg:CC 17))])]
"operands[1] = GEN_INT (0x8000);
- operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + 2);")
+ operands[0] = gen_rtx_REG (SImode,
+ true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
;; because of secondary memory needed to reload from class FLOAT_INT_REGS
[(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
(clobber (reg:CC 17))])]
"operands[1] = GEN_INT (0x8000);
- operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + 2);")
+ operands[0] = gen_rtx_REG (SImode,
+ true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
;; Conditionize these after reload. If they matches before reload, we
;; lose the clobber and ability to use integer instructions.
/* Using SSE is tricky, since we need bitwise negation of -0
in register. */
rtx reg = gen_reg_rtx (SFmode);
- emit_move_insn (reg, gen_lowpart (SFmode, GEN_INT (0x80000000)));
+ rtx dest = operands[0];
+
+ operands[1] = force_reg (SFmode, operands[1]);
+ operands[0] = force_reg (SFmode, operands[0]);
+ emit_move_insn (reg,
+ gen_lowpart (SFmode,
+ GEN_INT (trunc_int_for_mode (0x80000000,
+ SImode))));
emit_insn (gen_abssf2_ifs (operands[0], operands[1], reg));
+ if (dest != operands[0])
+ emit_move_insn (dest, operands[0]);
}
DONE;
}
"#")
(define_insn "abssf2_ifs"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,f#xr,r#xf")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,f#xr,rm#xf")
(abs:SF (match_operand:SF 1 "nonimmediate_operand" "x,0,0")))
- (use (match_operand:SF 2 "nonmemory_operand" "*0#x,*X#x,*X#x"))
+ (use (match_operand:SF 2 "nonmemory_operand" "*0#x,*g#x,*g#x"))
(clobber (reg:CC 17))]
- "TARGET_SSE"
+ "TARGET_SSE
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
"#")
(define_split
in register. */
rtx reg = gen_reg_rtx (DFmode);
#if HOST_BITS_PER_WIDE_INT >= 64
- rtx imm = GEN_INT (0x80000000);
+ rtx imm = GEN_INT (trunc_int_for_mode(((HOST_WIDE_INT)1) << 63,
+ DImode));
#else
rtx imm = immed_double_const (0, 0x80000000, DImode);
#endif
+ rtx dest = operands[0];
+
+ operands[1] = force_reg (DFmode, operands[1]);
+ operands[0] = force_reg (DFmode, operands[0]);
emit_move_insn (reg, gen_lowpart (DFmode, imm));
emit_insn (gen_absdf2_ifs (operands[0], operands[1], reg));
+ if (dest != operands[0])
+ emit_move_insn (dest, operands[0]);
}
DONE;
}
"#")
(define_insn "absdf2_ifs"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,f#Yr,r#Yf")
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr,mr#Yf")
(abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0,0")))
- (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*X#Y,*X#Y"))
+ (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y,*g#Y"))
(clobber (reg:CC 17))]
- "TARGET_SSE2"
+ "TARGET_SSE2 && !TARGET_64BIT
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
+ "#")
+
+(define_insn "*absdf2_ifs_rex64"
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr")
+ (abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0")))
+ (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y"))
+ (clobber (reg:CC 17))]
+ "TARGET_SSE2 && TARGET_64BIT
+ && (reload_in_progress || reload_completed
+ || (register_operand (operands[0], VOIDmode)
+ && register_operand (operands[1], VOIDmode)))"
"#")
(define_split
[(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
(abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
(clobber (reg:CC 17))]
- "TARGET_80387 && ix86_unary_operator_ok (ABS, DFmode, operands)"
+ "TARGET_80387 && !TARGET_64BIT
+ && ix86_unary_operator_ok (ABS, DFmode, operands)"
+ "#")
+
+;; FIXME: We should to allow integer registers here. Problem is that
+;; we need another scratch register to get constant from.
+;; Forcing constant to mem if no register available in peep2 should be
+;; safe even for PIC mode, because of RIP relative addressing.
+(define_insn "*absdf2_if_rex64"
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
+ (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
+ (clobber (reg:CC 17))]
+ "TARGET_80387 && TARGET_64BIT
+ && ix86_unary_operator_ok (ABS, DFmode, operands)"
"#")
(define_split
[(set (match_operand:DF 0 "register_operand" "")
(abs:DF (match_operand:DF 1 "register_operand" "")))
(clobber (reg:CC 17))]
- "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
+ "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))
+ && !TARGET_64BIT"
[(parallel [(set (match_dup 3) (and:SI (match_dup 3) (match_dup 4)))
(clobber (reg:CC 17))])]
"operands[4] = GEN_INT (trunc_int_for_mode (~0x80000000, SImode));
"TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
[(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
(clobber (reg:CC 17))])]
- "operands[1] = GEN_INT (trunc_int_for_mode (~0x8000, SImode));
- operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + 2);")
+ "operands[1] = GEN_INT (~0x8000);
+ operands[0] = gen_rtx_REG (SImode,
+ true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
(define_insn "*abstf2_if"
[(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f")
"TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
[(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
(clobber (reg:CC 17))])]
- "operands[1] = GEN_INT (trunc_int_for_mode (~0x8000, SImode));
- operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + 2);")
+ "operands[1] = GEN_INT (~0x8000);
+ operands[0] = gen_rtx_REG (SImode,
+ true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
(define_insn "*abssf2_1"
[(set (match_operand:SF 0 "register_operand" "=f")