summaryrefslogtreecommitdiff
path: root/gcc/config/i386/i386.md
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/i386/i386.md')
-rw-r--r--gcc/config/i386/i386.md344
1 files changed, 75 insertions, 269 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 9de8a93e1fb..ea6a9c8a487 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1,5 +1,5 @@
; GCC machine description for Intel X86.
-;; Copyright (C) 1988, 94-97, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
;; Mostly by William Schelter.
;; This file is part of GNU CC.
@@ -7378,11 +7378,10 @@ byte_xor_operation:
(define_expand "movsicc"
[(match_dup 4)
- (parallel [(set (match_operand 0 "register_operand" "")
+ (set (match_operand 0 "register_operand" "")
(if_then_else:SI (match_operand 1 "comparison_operator" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))
- (clobber (match_scratch:SI 4 "=&r"))])]
+ (match_operand:SI 2 "nonimmediate_operand" "")
+ (match_operand:SI 3 "nonimmediate_operand" "")))]
"TARGET_CMOVE"
"
{
@@ -7391,11 +7390,10 @@ byte_xor_operation:
(define_expand "movhicc"
[(match_dup 4)
- (parallel [(set (match_operand 0 "register_operand" "")
+ (set (match_operand 0 "register_operand" "")
(if_then_else:HI (match_operand 1 "comparison_operator" "")
- (match_operand:HI 2 "general_operand" "")
- (match_operand:HI 3 "general_operand" "")))
- (clobber (match_scratch:SI 4 "=&r"))])]
+ (match_operand:HI 2 "nonimmediate_operand" "")
+ (match_operand:HI 3 "nonimmediate_operand" "")))]
"TARGET_CMOVE"
"
{
@@ -7403,146 +7401,80 @@ byte_xor_operation:
}")
(define_insn "movsicc_1"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,&r,rm")
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,&r")
(if_then_else:SI (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:SI 2 "general_operand" "rm,0,rm,g")
- (match_operand:SI 3 "general_operand" "0,rm,rm,g")))
- (clobber (match_scratch:SI 4 "X,X,X,=&r"))]
+ [(cc0) (const_int 0)])
+ (match_operand:SI 2 "nonimmediate_operand" "rm,0,rm")
+ (match_operand:SI 3 "nonimmediate_operand" "0,rm,rm")))]
"TARGET_CMOVE"
"*
{
- if (which_alternative == 0)
+ switch (which_alternative)
{
+ case 0:
/* r <- cond ? arg : r */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- }
- else if (which_alternative == 1)
- {
+ break;
+
+ case 1:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 2)
- {
+ break;
+
+ case 2:
/* r <- cond ? arg1 : arg2 */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+ break;
}
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- rtx xops[3];
-
- xops[0] = gen_label_rtx ();
- xops[1] = gen_label_rtx ();
- xops[2] = operands[1];
-
- output_asm_insn (\"j%c2 %l0\", xops);
- if (! rtx_equal_p (operands[0], operands[2]))
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%2,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%2,%0), operands);
- output_asm_insn (\"jmp %l1\", xops);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
- if (! rtx_equal_p (operands[0], operands[3]))
- {
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
- {
- output_asm_insn (AS2 (mov%z3,%3,%4), operands);
- output_asm_insn (AS2 (mov%z3,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%3,%0), operands);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
- }
+
RET;
}")
(define_insn "movhicc_1"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,&r,rm")
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,&r")
(if_then_else:HI (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:HI 2 "general_operand" "rm,0,rm,g")
- (match_operand:HI 3 "general_operand" "0,rm,rm,g")))
- (clobber (match_scratch:SI 4 "X,X,X,=&r"))]
+ [(cc0) (const_int 0)])
+ (match_operand:HI 2 "nonimmediate_operand" "rm,0,rm")
+ (match_operand:HI 3 "nonimmediate_operand" "0,rm,rm")))]
"TARGET_CMOVE"
"*
{
- if (which_alternative == 0)
+ switch (which_alternative)
{
+ case 0:
/* r <- cond ? arg : r */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- }
- else if (which_alternative == 1)
- {
+ break;
+
+ case 1:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 2)
- {
+ break;
+
+ case 2:
/* r <- cond ? arg1 : arg2 */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+ break;
}
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- rtx xops[3];
-
- xops[0] = gen_label_rtx ();
- xops[1] = gen_label_rtx ();
- xops[2] = operands[1];
-
- output_asm_insn (\"j%c2 %l0\", xops);
- if (! rtx_equal_p (operands[0], operands[2]))
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%2,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%2,%0), operands);
- output_asm_insn (\"jmp %l1\", xops);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
- if (! rtx_equal_p (operands[0], operands[3]))
- {
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
- {
- output_asm_insn (AS2 (mov%z3,%3,%4), operands);
- output_asm_insn (AS2 (mov%z3,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%3,%0), operands);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
- }
+
RET;
}")
+;; We need to disable the FP forms of these since they do not support
+;; memory as written, but no input reloads are permitted for insns
+;; that use cc0. Also, movxfcc is not present.
+
(define_expand "movsfcc"
[(match_dup 4)
- (set (match_operand 0 "general_operand" "")
+ (set (match_operand 0 "register_operand" "")
(if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "general_operand" "")
- (match_operand:SF 3 "general_operand" "")))]
- "TARGET_CMOVE"
+ (match_operand:SF 2 "register_operand" "")
+ (match_operand:SF 3 "register_operand" "")))]
+ "0 && TARGET_CMOVE"
"
{
- int i;
-
- for (i = 2; i <= 3; i++)
- {
- if ((reload_in_progress | reload_completed) == 0
- && CONSTANT_P (operands[i]))
- {
- operands[i] = force_const_mem (SFmode, operands[i]);
- }
- }
operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
}")
@@ -7550,211 +7482,85 @@ byte_xor_operation:
[(match_dup 4)
(set (match_operand 0 "register_operand" "t")
(if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "general_operand" "")
- (match_operand:DF 3 "general_operand" "")))]
- "TARGET_CMOVE"
+ (match_operand:DF 2 "register_operand" "")
+ (match_operand:DF 3 "register_operand" "")))]
+ "0 && TARGET_CMOVE"
"
{
- int i;
-
- for (i = 2; i <= 3; i++)
- {
- if ((reload_in_progress | reload_completed) == 0
- && CONSTANT_P (operands[i]))
- {
- operands[i] = force_const_mem (DFmode, operands[i]);
- }
- }
operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
}")
(define_expand "movxfcc"
[(match_dup 4)
- (set (match_operand 0 "register_operand" "t")
+ (set (match_operand 0 "register_operand" "")
(if_then_else:XF (match_operand 1 "comparison_operator" "")
- (match_operand:XF 2 "general_operand" "")
- (match_operand:XF 3 "general_operand" "")))]
- "TARGET_CMOVE"
+ (match_operand:XF 2 "register_operand" "")
+ (match_operand:XF 3 "register_operand" "")))]
+ "0 && TARGET_CMOVE"
"
{
- int i;
-
- for (i = 2; i <= 3; i++)
- {
- if ((reload_in_progress | reload_completed) == 0
- && CONSTANT_P (operands[i]))
- {
- operands[i] = force_const_mem (XFmode, operands[i]);
- }
- }
operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
}")
(define_insn "movsfcc_1"
- [(set (match_operand:SF 0 "general_operand" "=f,=f,=f,=f")
+ [(set (match_operand:SF 0 "general_operand" "=f,f,&f")
(if_then_else:SF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:SF 2 "general_operand" "0,f,f,fFm")
- (match_operand:SF 3 "general_operand" "f,0,f,fFm")))]
+ [(cc0) (const_int 0)])
+ (match_operand:SF 2 "register_operand" "0,f,f")
+ (match_operand:SF 3 "register_operand" "f,0,f")))]
"TARGET_CMOVE"
"*
{
- if (which_alternative == 0)
+ switch (which_alternative)
{
+ case 0:
/* r <- cond ? arg : r */
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
+ break;
+
+ case 1:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- else if (which_alternative == 2)
- {
+ break;
+
+ case 2:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
+ break;
}
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- rtx xops[3];
-
- xops[0] = gen_label_rtx ();
- xops[1] = gen_label_rtx ();
- xops[2] = operands[1];
- output_asm_insn (\"j%f2 %l0\", xops);
- if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- else
- {
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- }
- output_asm_insn (\"jmp %l1\", xops);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
- if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- else
- {
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
-}
RET;
}")
(define_insn "movdfcc_1"
- [(set (match_operand:DF 0 "general_operand" "=f,=f,=f,=f")
+ [(set (match_operand:DF 0 "general_operand" "=f,f,&f")
(if_then_else:DF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:DF 2 "general_operand" "0,f,f,fFm")
- (match_operand:DF 3 "general_operand" "f,0,f,fFm")))]
+ [(cc0) (const_int 0)])
+ (match_operand:DF 2 "register_operand" "0,f,f")
+ (match_operand:DF 3 "register_operand" "f,0,f")))]
"TARGET_CMOVE"
"*
{
- if (which_alternative == 0)
+ switch (which_alternative)
{
+ case 0:
/* r <- cond ? arg : r */
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- else if (which_alternative == 2)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- rtx xops[3];
-
- xops[0] = gen_label_rtx ();
- xops[1] = gen_label_rtx ();
- xops[2] = operands[1];
-
- output_asm_insn (\"j%f2 %l0\", xops);
- if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- else
- {
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- }
- output_asm_insn (\"jmp %l1\", xops);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
- if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- else
- {
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
-}
- RET;
-}")
+ break;
-(define_insn "movxfcc_1"
- [(set (match_operand:XF 0 "register_operand" "=f,=f,=f,=f")
- (if_then_else:XF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:XF 2 "register_operand" "0,f,f,fFm")
- (match_operand:XF 3 "register_operand" "f,0,f,fFm")))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
+ case 1:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- else if (which_alternative == 2)
- {
+ break;
+
+ case 2:
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
+ break;
}
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- rtx xops[3];
-
- xops[0] = gen_label_rtx ();
- xops[1] = gen_label_rtx ();
- xops[2] = operands[1];
- output_asm_insn (\"j%f2 %l0\", xops);
- if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- else
- {
- operands[2] = XEXP (operands[2], 0);
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- }
- output_asm_insn (\"jmp %l1\", xops);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
- if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- else
- {
- operands[3] = XEXP (operands[3], 0);
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
-}
RET;
}")