Commit 963fc8d0 by Andreas Krebbel Committed by Andreas Krebbel

constraints.md ('b', [...]): New constraint letters defined.

2008-05-28  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/constraints.md ('b', 'C', 'D', 'e'): New constraint
	letters defined.

	* config/s390/s390.c (s390_compare_and_branch_condition_mask,
	s390_contiguous_bitmask_p, s390_symref_operand_p,
	s390_check_symref_alignment, s390_reload_larl_operand,
	s390_reload_symref_address): New functions.
	(s390_branch_condition_mnemonic): Support compare and branch
	instructions.
	(s390_mem_constraint): Avoid symrefs to accepted by the 'T'
	and 'W' constraints.
	(s390_secondary_reload): Add secondary reloads for unaligned
	symbol refs or symbol refs to floating point or QI/TI mode
	integer values.
	(legitimate_address_p): Accept symbol references as addresses.
	(s390_expand_insv): Use rotate and insert selected bits
	instruction for insv when building for z10.
	(print_operand_address): Handle symbol ref addresses.
	(print_operand): Output modifier 'c' added for signed byte
	values.
	(s390_encode_section_info): Mark symbol refs with
	SYMBOL_FLAG_NOT_NATURALLY_ALIGNED if appropriate.

	* config/s390/s390.md (SIL,RRS,RIS): New instruction formats added.
	(length attribute): RRF, RRR have 4 byte length.
	(FPALL, INTALL): New mode iterators added.
	(*tstdi_sign, *cmpdi_ccs_sign, *cmpsi_ccs_sign,
	*cmp<mode>_ccs, *cmpdi_ccu_zero, *cmpdi_ccu, *cmpsi_ccu, *cmphi_ccu,
	*movdi_64, *movsi_zarch, *movhi, movmem<mode>, *movmem_short,
	*extendsidi2, *extendhidi2_extimm, *extendhisi2_extimm,
	*zero_extendsidi2, adddi3, *adddi3_31z, *adddi3_31, addsi3,
	*add<mode>3, *add<mode>3_carry1_cc, *add<mode>3_carry2_cc,
	*add<mode>3_cc, *add<mode>3_imm_cc, *muldi3_sign, muldi3,
	*mulsi3_sign, mulsi3, mulsidi3): Patterns enhanced with z10
	instructions.
	(*cmphi_ccs_z10, *cmpdi_ccs_signhi_rl, *cmpsi_ccu_zerohi_rlsi,
	*cmp<GPR:mode>_ccu_zerohi_rldi, *cmp_and_br_signed_<mode>,
	*cmp_and_br_unsigned_<mode>, reload<INTALL:mode><P:mode>_tomem_z10,
	reload<INTALL:mode><P:mode>_toreg_z10,
	reload<FPALL:mode><P:mode>_tomem_z10,
	reload<FPALL:mode><P:mode>_toreg_z10,
	reload<P:mode>_larl_odd_addend_z10, *execute_rl, *insv<mode>_z10,
	*insv<mode>_z10_noshift, *insv<mode>_or_z10_noshift,
	*zero_extendhi<mode>2_z10, *cmp_and_trap_signed_int<mode>,
	*cmp_and_trap_unsigned_int<mode>, prefetch): New pattern or expander
	definition.
	(movmem, clrmem, cmpmem): New splitters added.

	* config/s390/predicates.md (larl_operand): Use
	SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_ALIGN1 replaced with
	SYMBOL_REF_ALIGN1_P.
	(s390_signed_integer_comparison,
	s390_unsigned_integer_comparison): New predicates.

	* config/s390/s390-protos.h (s390_check_symref_alignment,
	s390_contiguous_bitmask_p, s390_reload_larl_operand,
	s390_reload_symref_address,
	s390_compare_and_branch_condition_mask): Prototypes added.

	* config/s390/s390.h (TARGET_MEM_CONSTRAINT,
	SYMBOL_REF_ALIGN1_P, SYMBOL_FLAG_NOT_NATURALLY_ALIGNED,
	SYMBOL_REF_NOT_NATURALLY_ALIGNED_P): Macro definition added.

From-SVN: r136098
parent 93538e8e
2008-05-28 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/constraints.md ('b', 'C', 'D', 'e'): New constraint
letters defined.
* config/s390/s390.c (s390_compare_and_branch_condition_mask,
s390_contiguous_bitmask_p, s390_symref_operand_p,
s390_check_symref_alignment, s390_reload_larl_operand,
s390_reload_symref_address): New functions.
(s390_branch_condition_mnemonic): Support compare and branch
instructions.
(s390_mem_constraint): Avoid symrefs to accepted by the 'T'
and 'W' constraints.
(s390_secondary_reload): Add secondary reloads for unaligned
symbol refs or symbol refs to floating point or QI/TI mode
integer values.
(legitimate_address_p): Accept symbol references as addresses.
(s390_expand_insv): Use rotate and insert selected bits
instruction for insv when building for z10.
(print_operand_address): Handle symbol ref addresses.
(print_operand): Output modifier 'c' added for signed byte
values.
(s390_encode_section_info): Mark symbol refs with
SYMBOL_FLAG_NOT_NATURALLY_ALIGNED if appropriate.
* config/s390/s390.md (SIL,RRS,RIS): New instruction formats added.
(length attribute): RRF, RRR have 4 byte length.
(FPALL, INTALL): New mode iterators added.
(*tstdi_sign, *cmpdi_ccs_sign, *cmpsi_ccs_sign,
*cmp<mode>_ccs, *cmpdi_ccu_zero, *cmpdi_ccu, *cmpsi_ccu, *cmphi_ccu,
*movdi_64, *movsi_zarch, *movhi, movmem<mode>, *movmem_short,
*extendsidi2, *extendhidi2_extimm, *extendhisi2_extimm,
*zero_extendsidi2, adddi3, *adddi3_31z, *adddi3_31, addsi3,
*add<mode>3, *add<mode>3_carry1_cc, *add<mode>3_carry2_cc,
*add<mode>3_cc, *add<mode>3_imm_cc, *muldi3_sign, muldi3,
*mulsi3_sign, mulsi3, mulsidi3): Patterns enhanced with z10
instructions.
(*cmphi_ccs_z10, *cmpdi_ccs_signhi_rl, *cmpsi_ccu_zerohi_rlsi,
*cmp<GPR:mode>_ccu_zerohi_rldi, *cmp_and_br_signed_<mode>,
*cmp_and_br_unsigned_<mode>, reload<INTALL:mode><P:mode>_tomem_z10,
reload<INTALL:mode><P:mode>_toreg_z10,
reload<FPALL:mode><P:mode>_tomem_z10,
reload<FPALL:mode><P:mode>_toreg_z10,
reload<P:mode>_larl_odd_addend_z10, *execute_rl, *insv<mode>_z10,
*insv<mode>_z10_noshift, *insv<mode>_or_z10_noshift,
*zero_extendhi<mode>2_z10, *cmp_and_trap_signed_int<mode>,
*cmp_and_trap_unsigned_int<mode>, prefetch): New pattern or expander
definition.
(movmem, clrmem, cmpmem): New splitters added.
* config/s390/predicates.md (larl_operand): Use
SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_ALIGN1 replaced with
SYMBOL_REF_ALIGN1_P.
(s390_signed_integer_comparison,
s390_unsigned_integer_comparison): New predicates.
* config/s390/s390-protos.h (s390_check_symref_alignment,
s390_contiguous_bitmask_p, s390_reload_larl_operand,
s390_reload_symref_address,
s390_compare_and_branch_condition_mask): Prototypes added.
* config/s390/s390.h (TARGET_MEM_CONSTRAINT,
SYMBOL_REF_ALIGN1_P, SYMBOL_FLAG_NOT_NATURALLY_ALIGNED,
SYMBOL_REF_NOT_NATURALLY_ALIGNED_P): Macro definition added.
2008-05-28 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.c (z10_cost): New cost function for z10.
(s390_handle_arch_option, override_options): Support
-march=z10 switch.
......
;; Constraints definitions belonging to the gcc backend for IBM S/390.
;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
;; Written by Wolfgang Gellerich, using code and information found in
;; files s390.md, s390.h, and s390.c.
;;
......@@ -24,10 +24,14 @@
;; Special constraints for s/390 machine description:
;;
;; a -- Any address register from 1 to 15.
;; b -- Memory operand whose address is a symbol reference or a symbol
;; reference + constant which can be proven to be naturally aligned.
;; c -- Condition code register 33.
;; d -- Any register from 0 to 15.
;; f -- Floating point registers.
;; t -- Access registers 36 and 37.
;; C -- A signed 8-bit constant (-128..127)
;; D -- An unsigned 16-bit constant (0..65535)
;; G -- Const double zero operand
;; I -- An 8-bit constant (0..255).
;; J -- A 12-bit constant (0..4095).
......@@ -102,6 +106,19 @@
;; General constraints for constants.
;;
(define_constraint "C"
"@internal
An 8-bit signed immediate constant (-128..127)"
(and (match_code "const_int")
(match_test "ival >= -128 && ival <= 127")))
(define_constraint "D"
"An unsigned 16-bit constant (0..65535)"
(and (match_code "const_int")
(match_test "ival >= 0 && ival <= 65535")))
(define_constraint "G"
"@internal
Const double zero operand"
......@@ -127,7 +144,6 @@
(match_test "ival >= -32768 && ival <= 32767")))
(define_constraint "L"
"Value appropriate as displacement.
(0..4095) for short displacement
......@@ -355,7 +371,6 @@
(match_test "s390_mem_constraint (\"Q\", op)"))
(define_memory_constraint "R"
"Memory reference with index register and short displacement"
(match_test "s390_mem_constraint (\"R\", op)"))
......@@ -371,6 +386,27 @@
(match_test "s390_mem_constraint (\"T\", op)"))
(define_memory_constraint "b"
"Memory reference whose address is a naturally aligned symbol reference."
(match_test "MEM_P (op)
&& s390_check_symref_alignment (XEXP (op, 0),
GET_MODE_SIZE (GET_MODE (op)))"))
(define_memory_constraint "e"
"Matches all memory references available on the current architecture
level. This constraint will never be used and using it in an inline
assembly is *always* a bug since there is no instruction accepting all
those addresses. It just serves as a placeholder for a generic memory
constraint."
(match_test "legitimate_address_p (GET_MODE (op), op, 1)"))
; This defines 'm' as normal memory constraint. This is only possible
; since the standard memory constraint is re-defined in s390.h using
; the TARGET_MEM_CONSTRAINT macro.
(define_memory_constraint "m"
"Matches the most general memory address for pre-z10 machines."
(match_test "s390_mem_constraint (\"R\", op)
|| s390_mem_constraint (\"T\", op)"))
(define_memory_constraint "AQ"
"@internal
......@@ -425,7 +461,6 @@
(match_test "s390_mem_constraint (\"BT\", op)"))
(define_address_constraint "U"
"Pointer with short displacement"
(match_test "s390_mem_constraint (\"U\", op)"))
......
;; Predicate definitions for S/390 and zSeries.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
;; Ulrich Weigand (uweigand@de.ibm.com).
;;
......@@ -110,7 +110,7 @@
if (GET_CODE (op) == LABEL_REF)
return true;
if (GET_CODE (op) == SYMBOL_REF)
return ((SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_ALIGN1) == 0
return (!SYMBOL_REF_ALIGN1_P (op)
&& SYMBOL_REF_TLS_MODEL (op) == 0
&& (!flag_pic || SYMBOL_REF_LOCAL_P (op)));
......@@ -172,6 +172,18 @@
return (s390_branch_condition_mask (op) >= 0);
})
(define_predicate "s390_signed_integer_comparison"
(match_code "eq, ne, lt, gt, le, ge")
{
return (s390_compare_and_branch_condition_mask (op) >= 0);
})
(define_predicate "s390_unsigned_integer_comparison"
(match_code "eq, ne, ltu, gtu, leu, geu")
{
return (s390_compare_and_branch_condition_mask (op) >= 0);
})
;; Return nonzero if OP is a valid comparison operator
;; for an ALC condition.
......
/* Definitions of target machine for GNU compiler, for IBM S/390.
Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free
Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com)
This file is part of GCC.
......@@ -27,7 +29,7 @@ extern int s390_mem_constraint (const char *str, rtx op);
extern int s390_O_constraint_str (const char c, HOST_WIDE_INT value);
extern int s390_N_constraint_str (const char *str, HOST_WIDE_INT value);
extern int s390_float_const_zero_p (rtx value);
extern bool s390_check_symref_alignment (rtx addr, HOST_WIDE_INT alignment);
/* Declare functions in s390.c. */
......@@ -51,6 +53,7 @@ extern int s390_const_ok_for_constraint_p (HOST_WIDE_INT, int, const char *);
extern int s390_const_double_ok_for_constraint_p (rtx, int, const char *);
extern int s390_single_part (rtx, enum machine_mode, enum machine_mode, int);
extern unsigned HOST_WIDE_INT s390_extract_part (rtx, enum machine_mode, int);
extern bool s390_contiguous_bitmask_p (unsigned HOST_WIDE_INT, int, int *, int *);
extern bool s390_split_ok_p (rtx, rtx, enum machine_mode, int);
extern bool s390_overlap_p (rtx, rtx, HOST_WIDE_INT);
extern bool s390_offset_p (rtx, rtx, rtx);
......@@ -80,6 +83,8 @@ extern enum reg_class s390_secondary_input_reload_class (enum reg_class,
extern enum reg_class s390_secondary_output_reload_class (enum reg_class,
enum machine_mode,
rtx);
extern void s390_reload_larl_operand (rtx , rtx , rtx);
extern void s390_reload_symref_address (rtx , rtx , rtx , bool);
extern void s390_expand_plus_operand (rtx, rtx, rtx);
extern void emit_symbolic_move (rtx *);
extern void s390_load_address (rtx, rtx);
......@@ -113,6 +118,7 @@ extern void s390_emit_tpf_eh_return (rtx);
extern bool s390_legitimate_address_without_index_p (rtx);
extern bool s390_decompose_shift_count (rtx, rtx *, HOST_WIDE_INT *);
extern int s390_branch_condition_mask (rtx);
extern int s390_compare_and_branch_condition_mask (rtx);
#endif /* RTX_CODE */
......
/* Definitions of target machine for GNU compiler, for IBM S/390
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007 Free Software Foundation, Inc.
2007, 2008 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (uweigand@de.ibm.com).
Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
This file is part of GCC.
......@@ -62,6 +63,10 @@ extern enum processor_flags s390_tune_flags;
extern enum processor_type s390_arch;
extern enum processor_flags s390_arch_flags;
/* These flags indicate that the generated code should run on a cpu
providing the respective hardware facility regardless of the
current cpu mode (ESA or z/Architecture). */
#define TARGET_CPU_IEEE_FLOAT \
(s390_arch_flags & PF_IEEE_FLOAT)
#define TARGET_CPU_ZARCH \
......@@ -75,6 +80,10 @@ extern enum processor_flags s390_arch_flags;
#define TARGET_CPU_Z10 \
(s390_arch_flags & PF_Z10)
/* These flags indicate that the generated code should run on a cpu
providing the respective hardware facility when run in
z/Architecture mode. */
#define TARGET_LONG_DISPLACEMENT \
(TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT)
#define TARGET_EXTIMM \
......@@ -491,11 +500,14 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
#define PREFERRED_RELOAD_CLASS(X, CLASS) \
s390_preferred_reload_class ((X), (CLASS))
/* We need secondary memory to move data between GPRs and FPRs. */
/* We need secondary memory to move data between GPRs and FPRs. With
DFP the ldgr lgdr instructions are available. But these
instructions do not handle GPR pairs so it is not possible for 31
bit. */
#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
((CLASS1) != (CLASS2) \
&& ((CLASS1) == FP_REGS || (CLASS2) == FP_REGS) \
&& (!TARGET_DFP || GET_MODE_SIZE (MODE) != 8))
&& (!TARGET_DFP || !TARGET_64BIT || GET_MODE_SIZE (MODE) != 8))
/* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on 64bit
because the movsi and movsf patterns don't handle r/f moves. */
......@@ -693,6 +705,13 @@ CUMULATIVE_ARGS;
/* Maximum number of registers that can appear in a valid memory address. */
#define MAX_REGS_PER_ADDRESS 2
/* This definition replaces the formerly used 'm' constraint with a
different constraint letter in order to avoid changing semantics of
the 'm' constraint when accepting new address formats in
legitimate_address_p. The constraint letter defined here must not be
used in insn definitions or inline assemblies. */
#define TARGET_MEM_CONSTRAINT 'e'
/* S/390 has no mode dependent addresses. */
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
......@@ -959,7 +978,12 @@ do { \
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1)
/* Machine-specific symbol_ref flags. */
#define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0)
#define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0)
#define SYMBOL_REF_ALIGN1_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ALIGN1))
#define SYMBOL_FLAG_NOT_NATURALLY_ALIGNED (SYMBOL_FLAG_MACH_DEP << 1)
#define SYMBOL_REF_NOT_NATURALLY_ALIGNED_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_NOT_NATURALLY_ALIGNED))
/* Check whether integer displacement is in range. */
#define DISP_IN_RANGE(d) \
......
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