This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Predicates used by x86_64 patterns
- To: rth at cygnus dot com, patches at x86-64 dot org, gcc-patches at gcc dot gnu dot org
- Subject: Predicates used by x86_64 patterns
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 19 Mar 2001 18:08:03 +0100
Hi
x86_64 64bit operands are limited to 32bit sign extended values. By using 32bit
instruction you may use implicit zero extensions and move patterns support full
64bit operands.
These predicates are used by x86_64 patterns to get proper operands.
Honza
Mon Mar 19 18:05:13 CET 2001 Jan Hubicka <jh@suse.cz>
* i386-protos.h (x86_64_general_operand, x86_64_zext_general_operand,
x86_64_nonmemory_operand, x86_64_zext_nonmemory_operand,
x86_64_immediate_operand, x86_64_immediate_operand,
zero_extended_immediate_operand): Declare.
* i386.c (x86_64_general_operand, x86_64_zext_general_operand,
x86_64_nonmemory_operand, x86_64_zext_nonmemory_operand,
x86_64_immediate_operand, x86_64_immediate_operand,
zero_extended_immediate_operand): define.
* i386.h (PREDICATE_CODES): Add new predicates.
Index: i386-protos.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386-protos.h,v
retrieving revision 1.45
diff -c -3 -p -r1.45 i386-protos.h
*** i386-protos.h 2001/03/16 13:51:48 1.45
--- i386-protos.h 2001/03/19 16:58:30
*************** extern int standard_80387_constant_p PAR
*** 43,48 ****
--- 43,54 ----
extern int standard_sse_constant_p PARAMS ((rtx));
extern int symbolic_reference_mentioned_p PARAMS ((rtx));
+ extern int x86_64_general_operand PARAMS ((rtx, enum machine_mode));
+ extern int x86_64_zext_general_operand PARAMS ((rtx, enum machine_mode));
+ extern int x86_64_nonmemory_operand PARAMS ((rtx, enum machine_mode));
+ extern int x86_64_zext_nonmemory_operand PARAMS ((rtx, enum machine_mode));
+ extern int x86_64_immediate_operand PARAMS ((rtx, enum machine_mode));
+ extern int zero_extended_immediate_operand PARAMS ((rtx, enum machine_mode));
extern int const_int_1_operand PARAMS ((rtx, enum machine_mode));
extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int pic_symbolic_operand PARAMS ((rtx, enum machine_mode));
Index: i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.236
diff -c -3 -p -r1.236 i386.c
*** i386.c 2001/03/16 13:51:48 1.236
--- i386.c 2001/03/19 16:58:41
*************** function_arg (cum, mode, type, named)
*** 1127,1132 ****
--- 1127,1227 ----
}
+ /* Return nonzero if OP is general operand representable on x86_64. */
+
+ int
+ x86_64_general_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT)
+ return general_operand (op, mode);
+ if (nonimmediate_operand (op, mode))
+ return 1;
+ return x86_64_sign_extended_value (op);
+ }
+
+ /* Return nonzero if OP is general operand representable on x86_64
+ as eighter sign extended or zero extended constant. */
+
+ int
+ x86_64_zext_general_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT)
+ return general_operand (op, mode);
+ if (nonimmediate_operand (op, mode))
+ return 1;
+ return x86_64_sign_extended_value (op) || x86_64_zero_extended_value (op);
+ }
+
+ /* Return nonzero if OP is nonmemory operand representable on x86_64. */
+
+ int
+ x86_64_nonmemory_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT)
+ return nonmemory_operand (op, mode);
+ if (register_operand (op, mode))
+ return 1;
+ return x86_64_sign_extended_value (op);
+ }
+
+ /* Return nonzero if OP is nonmemory operand acceptable by movabs patterns. */
+
+ int
+ x86_64_movabs_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT || !flag_pic)
+ return nonmemory_operand (op, mode);
+ if (register_operand (op, mode) || x86_64_sign_extended_value (op))
+ return 1;
+ if (CONSTANT_P (op) && !symbolic_reference_mentioned_p (op))
+ return 1;
+ return 0;
+ }
+
+ /* Return nonzero if OP is nonmemory operand representable on x86_64. */
+
+ int
+ x86_64_zext_nonmemory_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT)
+ return nonmemory_operand (op, mode);
+ if (register_operand (op, mode))
+ return 1;
+ return x86_64_sign_extended_value (op) || x86_64_zero_extended_value (op);
+ }
+
+ /* Return nonzero if OP is immediate operand representable on x86_64. */
+
+ int
+ x86_64_immediate_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+ {
+ if (!TARGET_64BIT)
+ return immediate_operand (op, mode);
+ return x86_64_sign_extended_value (op);
+ }
+
+ /* Return nonzero if OP is immediate operand representable on x86_64. */
+
+ int
+ zero_extended_immediate_operand (op, mode)
+ rtx op;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
+ {
+ return x86_64_zero_extended_value (op);
+ }
+
/* Return nonzero if OP is (const_int 1), else return zero. */
int
Index: i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.168
diff -c -3 -p -r1.168 i386.h
*** i386.h 2001/03/14 21:35:58 1.168
--- i386.h 2001/03/19 16:58:44
*************** do { long l; \
*** 3022,3027 ****
--- 3022,3041 ----
/* Define the codes that are matched by predicates in i386.c. */
#define PREDICATE_CODES \
+ {"x86_64_immediate_operand", {CONST_INT, SUBREG, REG, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"x86_64_nonmemory_operand", {CONST_INT, SUBREG, REG, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"x86_64_movabs_operand", {CONST_INT, SUBREG, REG, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"x86_64_zext_nonmemory_operand", {CONST_INT, SUBREG, REG, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"x86_64_general_operand", {CONST_INT, SUBREG, REG, MEM, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"x86_64_zext_general_operand", {CONST_INT, SUBREG, REG, MEM, \
+ SYMBOL_REF, LABEL_REF, CONST}}, \
+ {"zero_extended_immediate_operand", {const_int, const_double, const, \
+ symbol_ref, label_ref}}, \
{"const_int_1_operand", {CONST_INT}}, \
{"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
{"aligned_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \