Commit 885a70fd by Jan Hubicka Committed by Jan Hubicka

i386.c (ix86_expand_setcc): Support 64bit.


	* i386.c (ix86_expand_setcc): Support 64bit.
	(ix86_expand_int_movcc): Likewise.
	* i386.md (movdicc_rex64, x86_movsicc_0_m1_rex64, movdicc_c_rex64):
	New patterns.

	* i386.md (allocate_stack_worker): Turn to expander.
	(allocate_stack_worker_1, allocate_stack_worker_rex64): New insns.

	* i386.c (print_reg): Do not print x86_64 style regs on IA-32

From-SVN: r40958
parent e4b776a6
Fri Mar 30 00:21:41 CEST 2001 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_setcc): Support 64bit.
(ix86_expand_int_movcc): Likewise.
* i386.md (movdicc_rex64, x86_movsicc_0_m1_rex64, movdicc_c_rex64):
New patterns.
* i386.md (allocate_stack_worker): Turn to expander.
(allocate_stack_worker_1, allocate_stack_worker_rex64): New insns.
* i386.c (print_reg): Do not print x86_64 style regs on IA-32
2001-03-29 Richard Henderson <rth@redhat.com> 2001-03-29 Richard Henderson <rth@redhat.com>
* libgcc2.c [L__main]: Include unwind-dw2-fde.h instead of frame.h. * libgcc2.c [L__main]: Include unwind-dw2-fde.h instead of frame.h.
......
...@@ -3798,6 +3798,8 @@ print_reg (x, code, file) ...@@ -3798,6 +3798,8 @@ print_reg (x, code, file)
from the normal registers. */ from the normal registers. */
if (REX_INT_REG_P (x)) if (REX_INT_REG_P (x))
{ {
if (!TARGET_64BIT)
abort ();
switch (code) switch (code)
{ {
case 5: case 5:
...@@ -3837,7 +3839,7 @@ print_reg (x, code, file) ...@@ -3837,7 +3839,7 @@ print_reg (x, code, file)
case 4: case 4:
case 12: case 12:
if (! ANY_FP_REG_P (x)) if (! ANY_FP_REG_P (x))
putc (code == 8 ? 'r' : 'e', file); putc (code == 8 && TARGET_64BIT ? 'r' : 'e', file);
/* FALLTHRU */ /* FALLTHRU */
case 16: case 16:
case 2: case 2:
...@@ -6112,7 +6114,8 @@ ix86_expand_setcc (code, dest) ...@@ -6112,7 +6114,8 @@ ix86_expand_setcc (code, dest)
rtx second_test, bypass_test; rtx second_test, bypass_test;
int type; int type;
if (GET_MODE (ix86_compare_op0) == DImode) if (GET_MODE (ix86_compare_op0) == DImode
&& !TARGET_64BIT)
return 0; /* FAIL */ return 0; /* FAIL */
/* Three modes of generation: /* Three modes of generation:
...@@ -6229,6 +6232,7 @@ ix86_expand_int_movcc (operands) ...@@ -6229,6 +6232,7 @@ ix86_expand_int_movcc (operands)
HImode insns, we'd be swallowed in word prefix ops. */ HImode insns, we'd be swallowed in word prefix ops. */
if (GET_MODE (operands[0]) != HImode if (GET_MODE (operands[0]) != HImode
&& GET_MODE (operands[0]) != DImode
&& GET_CODE (operands[2]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT) && GET_CODE (operands[3]) == CONST_INT)
{ {
...@@ -6362,28 +6366,46 @@ ix86_expand_int_movcc (operands) ...@@ -6362,28 +6366,46 @@ ix86_expand_int_movcc (operands)
ix86_compare_op1, VOIDmode, 0, 1); ix86_compare_op1, VOIDmode, 0, 1);
nops = 0; nops = 0;
/* On x86_64 the lea instruction operates on Pmode, so we need to get arithmetics
done in proper mode to match. */
if (diff == 1) if (diff == 1)
{
if (Pmode != SImode)
tmp = gen_lowpart (Pmode, out);
else
tmp = out; tmp = out;
}
else else
{ {
tmp = gen_rtx_MULT (SImode, out, GEN_INT (diff & ~1)); rtx out1;
if (Pmode != SImode)
out1 = gen_lowpart (Pmode, out);
else
out1 = out;
tmp = gen_rtx_MULT (Pmode, out1, GEN_INT (diff & ~1));
nops++; nops++;
if (diff & 1) if (diff & 1)
{ {
tmp = gen_rtx_PLUS (SImode, tmp, out); tmp = gen_rtx_PLUS (Pmode, tmp, out1);
nops++; nops++;
} }
} }
if (cf != 0) if (cf != 0)
{ {
tmp = gen_rtx_PLUS (SImode, tmp, GEN_INT (cf)); tmp = gen_rtx_PLUS (Pmode, tmp, GEN_INT (cf));
nops++; nops++;
} }
if (tmp != out) if (tmp != out
&& (GET_CODE (tmp) != SUBREG || SUBREG_REG (tmp) != out))
{ {
if (nops == 0) if (Pmode != SImode)
emit_move_insn (out, tmp); tmp = gen_rtx_SUBREG (SImode, tmp, 0);
else if (nops == 1)
/* ??? We should to take care for outputing non-lea arithmetics
for Pmode != SImode case too, but it is quite tricky and not
too important, since all TARGET_64BIT machines support real
conditional moves. */
if (nops == 1 && Pmode == SImode)
{ {
rtx clob; rtx clob;
......
...@@ -14919,6 +14919,45 @@ ...@@ -14919,6 +14919,45 @@
;; Conditional move instructions. ;; Conditional move instructions.
(define_expand "movdicc_rex64"
[(set (match_operand:DI 0 "register_operand" "")
(if_then_else:DI (match_operand 1 "comparison_operator" "")
(match_operand:DI 2 "x86_64_general_operand" "")
(match_operand:DI 3 "x86_64_general_operand" "")))]
"TARGET_64BIT"
"if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
(define_insn "x86_movsicc_0_m1_rex64"
[(set (match_operand:DI 0 "register_operand" "=r")
(if_then_else:DI (ltu (reg:CC 17) (const_int 0))
(const_int -1)
(const_int 0)))
(clobber (reg:CC 17))]
"TARGET_64BIT"
"sbb{l}\\t%0, %0"
; Since we don't have the proper number of operands for an alu insn,
; fill in all the blanks.
[(set_attr "type" "alu")
(set_attr "memory" "none")
(set_attr "imm_disp" "false")
(set_attr "mode" "DI")
(set_attr "length_immediate" "0")])
(define_insn "*movdicc_c_rex64"
[(set (match_operand:DI 0 "register_operand" "=r,r")
(if_then_else:DI (match_operator 1 "ix86_comparison_operator"
[(reg 17) (const_int 0)])
(match_operand:DI 2 "nonimmediate_operand" "rm,0")
(match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
"TARGET_64BIT && TARGET_CMOVE
&& (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
"@
cmov%C1\\t{%2, %0|%0, %2}
cmov%c1\\t{%3, %0|%0, %3}"
[(set_attr "type" "icmov")
(set_attr "mode" "DI")])
(define_expand "movsicc" (define_expand "movsicc"
[(set (match_operand:SI 0 "register_operand" "") [(set (match_operand:SI 0 "register_operand" "")
(if_then_else:SI (match_operand 1 "comparison_operator" "") (if_then_else:SI (match_operand 1 "comparison_operator" "")
...@@ -15749,12 +15788,34 @@ ...@@ -15749,12 +15788,34 @@
} }
}") }")
(define_insn "allocate_stack_worker" (define_expand "allocate_stack_worker"
[(match_operand:SI 0 "register_operand" "")]
"TARGET_STACK_PROBE"
"
{
if (TARGET_64BIT)
emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
else
emit_insn (gen_allocate_stack_worker_1 (operands[0]));
DONE;
}")
(define_insn "allocate_stack_worker_1"
[(unspec:SI [(match_operand:SI 0 "register_operand" "a")] 3) [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] 3)
(set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0))) (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
(clobber (match_dup 0)) (clobber (match_dup 0))
(clobber (reg:CC 17))] (clobber (reg:CC 17))]
"TARGET_STACK_PROBE" "TARGET_STACK_PROBE && !TARGET_64BIT"
"call\\t__alloca"
[(set_attr "type" "multi")
(set_attr "length" "5")])
(define_insn "allocate_stack_worker_rex64"
[(unspec:DI [(match_operand:DI 0 "register_operand" "a")] 3)
(set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
(clobber (match_dup 0))
(clobber (reg:CC 17))]
"TARGET_STACK_PROBE && TARGET_64BIT"
"call\\t__alloca" "call\\t__alloca"
[(set_attr "type" "multi") [(set_attr "type" "multi")
(set_attr "length" "5")]) (set_attr "length" "5")])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment