Commit a5381466 by Zack Weinberg Committed by Zack Weinberg

Makefile.in (MACHMODE_H): Add @extra_modes_file@.

	* Makefile.in (MACHMODE_H): Add @extra_modes_file@.
	* configure.in: If $srcdir/config/${cpu_type}/${cpu_type}-modes.def
	exists, substitute its pathname as @extra_modes_file@, define
	EXTRA_MODES_FILE to be an appropriate string to #include it
	with, and define EXTRA_CC_MODES to 1.

	* machmode.def: Update comments.  Include EXTRA_MODES_FILE if
	it's defined.  Get rid of redundancy in calling sequence for
	CC; don't use it to define CCmode, to avoid a warning.
	* libgcc2.c: Include symcat.h for the sake of machmode.def.

	* arc-modes.def, arm-modes.def, c4x-modes.def, i386-modes.def,
	i960-modes.def, ia64-modes.def, m88k-modes.def, mmix-modes.def,
	pa-modes.def, pdp11-modes.def, rs6000-modes.def, sparc-modes.def:
	New files.
	* arc.h, arm.h, c4x.h, i386.h, i960.h, ia64.h, m88k.h, mmix.h,
	pa.h, pdp11.h, rs6000.h, sparc.h: Don't define EXTRA_CC_MODES.

	* doc/sourcebuild.texi, doc/tm.texi: Document new scheme for
	defining extra CC modes.

From-SVN: r54478
parent 852c6ec7
2002-06-10 Zack Weinberg <zack@codesourcery.com>
* Makefile.in (MACHMODE_H): Add @extra_modes_file@.
* configure.in: If $srcdir/config/${cpu_type}/${cpu_type}-modes.def
exists, substitute its pathname as @extra_modes_file@, define
EXTRA_MODES_FILE to be an appropriate string to #include it
with, and define EXTRA_CC_MODES to 1.
* machmode.def: Update comments. Include EXTRA_MODES_FILE if
it's defined. Get rid of redundancy in calling sequence for
CC; don't use it to define CCmode, to avoid a warning.
* libgcc2.c: Include symcat.h for the sake of machmode.def.
* arc-modes.def, arm-modes.def, c4x-modes.def, i386-modes.def,
i960-modes.def, ia64-modes.def, m88k-modes.def, mmix-modes.def,
pa-modes.def, pdp11-modes.def, rs6000-modes.def, sparc-modes.def:
New files.
* arc.h, arm.h, c4x.h, i386.h, i960.h, ia64.h, m88k.h, mmix.h,
pa.h, pdp11.h, rs6000.h, sparc.h: Don't define EXTRA_CC_MODES.
* doc/sourcebuild.texi, doc/tm.texi: Document new scheme for
defining extra CC modes.
2002-06-10 Roger Sayle <roger@eyesopen.com>
Andreas Jaeger <aj@suse.de>
......
......@@ -548,7 +548,7 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h $(HOOKS_H)
TM_P_H = tm_p.h $(tm_p_file_list) tm-preds.h
MACHMODE_H = machmode.h machmode.def
MACHMODE_H = machmode.h machmode.def @extra_modes_file@
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H)
RTL_H = $(RTL_BASE_H) genrtl.h
PARAMS_H = params.h params.def
......
/* config.in. Generated automatically from configure.in by autoheader. */
/* config.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
......@@ -482,6 +482,14 @@
/* Define if host mkdir takes a single argument. */
#undef MKDIR_TAKES_ONE_ARG
/* Define if the target architecture needs extra machine modes to represent
the results of comparisons. */
#undef EXTRA_CC_MODES
/* Define to the name of a file containing a list of extra machine modes
for this architecture. */
#undef EXTRA_MODES_FILE
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
......
/* Definitions of target machine for GNU compiler, Argonaut ARC cpu.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Some insns set all condition code flags, some only set the ZNC flags, and
some only set the ZN flags. */
CC (CCZNC)
CC (CCZN)
......@@ -990,15 +990,6 @@ do { \
goto LABEL; \
}
/* Condition code usage. */
/* Some insns set all condition code flags, some only set the ZNC flags, and
some only set the ZN flags. */
#define EXTRA_CC_MODES \
CC(CCZNCmode, "CCZNC") \
CC(CCZNmode, "CCZN")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. */
#define SELECT_CC_MODE(OP, X, Y) \
......
/* Definitions of target machine for GNU compiler, for ARM.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
and Martin Simmons (@harleqn.co.uk).
More major hacks by Richard Earnshaw (rearnsha@arm.com)
Minor hacks by Nick Clifton (nickc@cygnus.com)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* CCFPEmode should be used with floating inequalities,
CCFPmode should be used with floating equalities.
CC_NOOVmode should be used with SImode integer equalities.
CC_Zmode should be used if only the Z flag is set correctly
CCmode should be used otherwise. */
CC (CC_NOOV)
CC (CC_Z)
CC (CC_SWP)
CC (CCFP)
CC (CCFPE)
CC (CC_DNE)
CC (CC_DEQ)
CC (CC_DLE)
CC (CC_DLT)
CC (CC_DGE)
CC (CC_DGT)
CC (CC_DLEU)
CC (CC_DLTU)
CC (CC_DGEU)
CC (CC_DGTU)
CC (CC_C)
......@@ -2417,30 +2417,7 @@ extern int making_const_table;
/* Condition code information. */
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison.
CCFPEmode should be used with floating inequalities,
CCFPmode should be used with floating equalities.
CC_NOOVmode should be used with SImode integer equalities.
CC_Zmode should be used if only the Z flag is set correctly
CCmode should be used otherwise. */
#define EXTRA_CC_MODES \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CC_Zmode, "CC_Z") \
CC(CC_SWPmode, "CC_SWP") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE") \
CC(CC_DNEmode, "CC_DNE") \
CC(CC_DEQmode, "CC_DEQ") \
CC(CC_DLEmode, "CC_DLE") \
CC(CC_DLTmode, "CC_DLT") \
CC(CC_DGEmode, "CC_DGE") \
CC(CC_DGTmode, "CC_DGT") \
CC(CC_DLEUmode, "CC_DLEU") \
CC(CC_DLTUmode, "CC_DLTU") \
CC(CC_DGEUmode, "CC_DGEU") \
CC(CC_DGTUmode, "CC_DGTU") \
CC(CC_Cmode, "CC_C")
return the mode to be used for the comparison. */
#define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y)
......
/* Definitions of target machine for GNU compiler. TMS320C[34]x
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
and Herman Ten Brugge (Haj.Ten.Brugge@net.HCC.nl).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
On the C4x, we have a "no-overflow" mode which is used when an ADD,
SUB, NEG, or MPY insn is used to set the condition code. This is
to prevent the combiner from optimising away a following CMP of the
result with zero when a signed conditional branch or load insn
follows.
The problem is a subtle one and deals with the manner in which the
negative condition (N) flag is used on the C4x. This flag does not
reflect the status of the actual result but of the ideal result had
no overflow occurred (when considering signed operands).
For example, 0x7fffffff + 1 => 0x80000000 Z=0 V=1 N=0 C=0. Here
the flags reflect the untruncated result, not the actual result.
While the actual result is less than zero, the N flag is not set
since the ideal result of the addition without truncation would
have been positive.
Note that the while the N flag is handled differently to most other
architectures, the use of it is self consistent and is not the
cause of the problem.
Logical operations set the N flag to the MSB of the result so if
the result is negative, N is 1. However, integer and floating
point operations set the N flag to be the MSB of the result
exclusive ored with the overflow (V) flag. Thus if an overflow
occurs and the result does not have the MSB set (i.e., the result
looks like a positive number), the N flag is set. Conversely, if
an overflow occurs and the MSB of the result is set, N is set to 0.
Thus the N flag represents the sign of the result if it could have
been stored without overflow but does not represent the apparent
sign of the result. Note that most architectures set the N flag to
be the MSB of the result.
The C4x approach to setting the N flag simplifies signed
conditional branches and loads which only have to test the state of
the N flag, whereas most architectures have to look at both the N
and V flags. The disadvantage is that there is no flag giving the
status of the sign bit of the operation. However, there are no
conditional load or branch instructions that make use of this
feature (e.g., BMI---branch minus) instruction. Note that BN and
BLT are identical in the C4x.
To handle the problem where the N flag is set differently whenever
there is an overflow we use a different CC mode, CC_NOOVmode which
says that the CC reflects the comparison of the result against zero
if no overflow occurred.
For example,
[(set (reg:CC_NOOV 21)
(compare:CC_NOOV (minus:QI (match_operand:QI 1 "src_operand" "")
(match_operand:QI 2 "src_operand" ""))
(const_int 0)))
(set (match_operand:QI 0 "ext_reg_operand" "")
(minus:QI (match_dup 1)
(match_dup 2)))]
Note that there is no problem for insns that don't return a result
like CMP, since the CC reflects the effect of operation.
An example of a potential problem is when GCC
converts (LTU (MINUS (0x80000000) (0x7fffffff) (0x80000000)))
to (LEU (MINUS (0x80000000) (0x7fffffff) (0x7fffffff)))
to (GE (MINUS (0x80000000) (0x7fffffff) (0x00000000)))
Now (MINUS (0x80000000) (0x7fffffff)) returns 0x00000001 but the
C4x sets the N flag since the result without overflow would have
been 0xffffffff when treating the operands as signed integers.
Thus (GE (MINUS (0x80000000) (0x7fffffff) (0x00000000))) sets the N
flag but (GE (0x00000001)) does not set the N flag.
The upshot is that we can not use signed branch and conditional
load instructions after an add, subtract, neg, abs or multiply.
We must emit a compare insn to check the result against 0. */
CC (CC_NOOV)
......@@ -1284,85 +1284,6 @@ CUMULATIVE_ARGS;
#define TARGET_MEM_FUNCTIONS
/* Add any extra modes needed to represent the condition code.
On the C4x, we have a "no-overflow" mode which is used when an ADD,
SUB, NEG, or MPY insn is used to set the condition code. This is
to prevent the combiner from optimising away a following CMP of the
result with zero when a signed conditional branch or load insn
follows.
The problem is a subtle one and deals with the manner in which the
negative condition (N) flag is used on the C4x. This flag does not
reflect the status of the actual result but of the ideal result had
no overflow occurred (when considering signed operands).
For example, 0x7fffffff + 1 => 0x80000000 Z=0 V=1 N=0 C=0. Here
the flags reflect the untruncated result, not the actual result.
While the actual result is less than zero, the N flag is not set
since the ideal result of the addition without truncation would
have been positive.
Note that the while the N flag is handled differently to most other
architectures, the use of it is self consistent and is not the
cause of the problem.
Logical operations set the N flag to the MSB of the result so if
the result is negative, N is 1. However, integer and floating
point operations set the N flag to be the MSB of the result
exclusive ored with the overflow (V) flag. Thus if an overflow
occurs and the result does not have the MSB set (i.e., the result
looks like a positive number), the N flag is set. Conversely, if
an overflow occurs and the MSB of the result is set, N is set to 0.
Thus the N flag represents the sign of the result if it could have
been stored without overflow but does not represent the apparent
sign of the result. Note that most architectures set the N flag to
be the MSB of the result.
The C4x approach to setting the N flag simplifies signed
conditional branches and loads which only have to test the state of
the N flag, whereas most architectures have to look at both the N
and V flags. The disadvantage is that there is no flag giving the
status of the sign bit of the operation. However, there are no
conditional load or branch instructions that make use of this
feature (e.g., BMI---branch minus) instruction. Note that BN and
BLT are identical in the C4x.
To handle the problem where the N flag is set differently whenever
there is an overflow we use a different CC mode, CC_NOOVmode which
says that the CC reflects the comparison of the result against zero
if no overflow occurred.
For example,
[(set (reg:CC_NOOV 21)
(compare:CC_NOOV (minus:QI (match_operand:QI 1 "src_operand" "")
(match_operand:QI 2 "src_operand" ""))
(const_int 0)))
(set (match_operand:QI 0 "ext_reg_operand" "")
(minus:QI (match_dup 1)
(match_dup 2)))]
Note that there is no problem for insns that don't return a result
like CMP, since the CC reflects the effect of operation.
An example of a potential problem is when GCC
converts (LTU (MINUS (0x80000000) (0x7fffffff) (0x80000000)))
to (LEU (MINUS (0x80000000) (0x7fffffff) (0x7fffffff)))
to (GE (MINUS (0x80000000) (0x7fffffff) (0x00000000)))
Now (MINUS (0x80000000) (0x7fffffff)) returns 0x00000001 but the
C4x sets the N flag since the result without overflow would have
been 0xffffffff when treating the operands as signed integers.
Thus (GE (MINUS (0x80000000) (0x7fffffff) (0x00000000))) sets the N
flag but (GE (0x00000001)) does not set the N flag.
The upshot is that we can not use signed branch and conditional
load instructions after an add, subtract, neg, abs or multiply.
We must emit a compare insn to check the result against 0. */
#define EXTRA_CC_MODES CC(CC_NOOVmode, "CC_NOOV")
/* CC_NOOVmode should be used when the first operand is a PLUS, MINUS, NEG
or MULT.
CCmode should be used when no special processing is needed. */
......
/* Definitions of target machine for GNU compiler for IA-32.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
For the i386, we need separate modes when floating-point
equality comparisons are being done.
Add CCNO to indicate comparisons against zero that requires
Overflow flag to be unset. Sign bit test is used instead and
thus can be used to form "a&b>0" type of tests.
Add CCGC to indicate comparisons agains zero that allows
unspecified garbage in the Carry flag. This mode is used
by inc/dec instructions.
Add CCGOC to indicate comparisons agains zero that allows
unspecified garbage in the Carry and Overflow flag. This
mode is used to simulate comparisons of (a-b) and (a+b)
against zero using sub/cmp/add operations.
Add CCZ to indicate that only the Zero flag is valid. */
CC (CCGC)
CC (CCGOC)
CC (CCNO)
CC (CCZ)
CC (CCFP)
CC (CCFPU)
......@@ -2834,34 +2834,6 @@ do { \
#define NO_RECURSIVE_FUNCTION_CSE
/* Add any extra modes needed to represent the condition code.
For the i386, we need separate modes when floating-point
equality comparisons are being done.
Add CCNO to indicate comparisons against zero that requires
Overflow flag to be unset. Sign bit test is used instead and
thus can be used to form "a&b>0" type of tests.
Add CCGC to indicate comparisons agains zero that allows
unspecified garbage in the Carry flag. This mode is used
by inc/dec instructions.
Add CCGOC to indicate comparisons agains zero that allows
unspecified garbage in the Carry and Overflow flag. This
mode is used to simulate comparisons of (a-b) and (a+b)
against zero using sub/cmp/add operations.
Add CCZ to indicate that only the Zero flag is valid. */
#define EXTRA_CC_MODES \
CC (CCGCmode, "CCGC") \
CC (CCGOCmode, "CCGOC") \
CC (CCNOmode, "CCNO") \
CC (CCZmode, "CCZ") \
CC (CCFPmode, "CCFP") \
CC (CCFPUmode, "CCFPU")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison.
......
/* Definitions of target machine for GNU compiler, for Intel 80960
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Steven McGeady, Intel Corp.
Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
Also, signed and unsigned comparisons are distinguished, as
are operations which are compatible with chkbit insns. */
CC (CC_UNS)
CC (CC_CHK)
......@@ -1200,14 +1200,6 @@ struct cum_args { int ca_nregparms; int ca_nstackparms; };
extern struct rtx_def *i960_compare_op0, *i960_compare_op1;
/* Add any extra modes needed to represent the condition code.
Also, signed and unsigned comparisons are distinguished, as
are operations which are compatible with chkbit insns. */
#define EXTRA_CC_MODES \
CC(CC_UNSmode, "CC_UNS") \
CC(CC_CHKmode, "CC_CHK")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode
should be used. CC_NOOVmode should be used when the first operand is a
......
/* Definitions of target machine GNU compiler. IA-64 version.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by James E. Wilson <wilson@cygnus.com> and
David Mosberger <davidm@hpl.hp.com>.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
CCImode is used to mark a single predicate register instead
of a register pair. This is currently only used in reg_raw_mode
so that flow doesn't do something stupid. */
CC (CCI)
......@@ -595,14 +595,6 @@ while (0)
#define LOCAL_REGNO(REGNO) \
(IN_REGNO_P (REGNO) || LOC_REGNO_P (REGNO))
/* Add any extra modes needed to represent the condition code.
CCImode is used to mark a single predicate register instead
of a register pair. This is currently only used in reg_raw_mode
so that flow doesn't do something stupid. */
#define EXTRA_CC_MODES CC(CCImode, "CCI")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. Must be defined if
EXTRA_CC_MODES is defined. */
......
/* Definitions of target machine for GNU compiler for Motorola m88100.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com).
Currently maintained by (gcc@dg-rtp.dg.com)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Extra machine modes to represent the condition code. */
CC (CCEVEN)
......@@ -1162,8 +1162,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
/*** Addressing Modes ***/
#define EXTRA_CC_MODES CC(CCEVENmode, "CCEVEN")
#define SELECT_CC_MODE(OP,X,Y) CCmode
/* #define HAVE_POST_INCREMENT 0 */
......
/* Definitions of target machine for GNU compiler, for MMIX.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson (hp@bitrange.com)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Extra machine modes to represent the condition code. */
CC (CC_UNS)
CC (CC_FP)
CC (CC_FPEQ)
CC (CC_FUN)
......@@ -851,12 +851,6 @@ typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS;
/* Node: Condition Code */
#define EXTRA_CC_MODES \
CC(CC_UNSmode, "CC_UNS") \
CC(CC_FPmode, "CC_FP") \
CC(CC_FPEQmode, "CC_FPEQ") \
CC(CC_FUNmode, "CC_FUN")
#define SELECT_CC_MODE(OP, X, Y) \
mmix_select_cc_mode (OP, X, Y)
......
/* Definitions of target machine for GNU compiler, for the HP Spectrum.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
Software Science at the University of Utah.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
HPPA floating comparisons produce condition codes. */
CC (CCFP)
......@@ -1515,11 +1515,6 @@ do { \
between pointers and any other objects of this machine mode. */
#define Pmode word_mode
/* Add any extra modes needed to represent the condition code.
HPPA floating comparisons produce condition codes. */
#define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode
should be used. CC_NOOVmode should be used when the first operand is a
......
/* Definitions of target machine for GNU compiler, for the pdp-11
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
CCFPmode is used for FPU, but should we use a separate reg? */
CC (CCFP)
......@@ -884,12 +884,6 @@ extern int may_call_alloca;
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
/* Add any extra modes needed to represent the condition code.
CCFPmode is used for FPU, but should we use a separate reg? */
#define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
/* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode
should be used. */
......
/* Definitions of target machine for GNU compiler, for IBM RS/6000.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
For the RS/6000, we need separate modes when unsigned (logical) comparisons
are being done and we need a separate mode for floating-point. We also
use a mode for the case when we are comparing the results of two
comparisons, as then only the EQ bit is valid in the register. */
CC (CCUNS)
CC (CCFP)
CC (CCEQ)
......@@ -2379,18 +2379,6 @@ do { \
/* #define ADJUST_INSN_LENGTH(X,LENGTH) */
/* Add any extra modes needed to represent the condition code.
For the RS/6000, we need separate modes when unsigned (logical) comparisons
are being done and we need a separate mode for floating-point. We also
use a mode for the case when we are comparing the results of two
comparisons, as then only the EQ bit is valid in the register. */
#define EXTRA_CC_MODES \
CC(CCUNSmode, "CCUNS") \
CC(CCFPmode, "CCFP") \
CC(CCEQmode, "CCEQ")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a
COMPARE, return the mode to be used for the comparison. For
floating-point, CCFPmode should be used. CCUNSmode should be used
......
/* Definitions of target machine for GNU compiler, for IBM S/390
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (uweigand@de.ibm.com).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code. */
CC (CCZ)
CC (CCA)
CC (CCL)
CC (CCU)
CC (CCS)
CC (CCT)
......@@ -1207,15 +1207,6 @@ CUMULATIVE_ARGS;
#define BRANCH_COST 1
/* Add any extra modes needed to represent the condition code. */
#define EXTRA_CC_MODES \
CC (CCZmode, "CCZ") \
CC (CCAmode, "CCA") \
CC (CCLmode, "CCL") \
CC (CCUmode, "CCU") \
CC (CCSmode, "CCS") \
CC (CCTmode, "CCT")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. */
......
/* Definitions of target machine for GNU compiler, for Sun SPARC.
Copyright (C) 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com).
64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
at Cygnus Support.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Add any extra modes needed to represent the condition code.
On the Sparc, we have a "no-overflow" mode which is used when an add or
subtract insn is used to set the condition code. Different branches are
used in this case for some operations.
We also have two modes to indicate that the relevant condition code is
in the floating-point condition code register. One for comparisons which
will generate an exception if the result is unordered (CCFPEmode) and
one for comparisons which will never trap (CCFPmode).
CCXmode and CCX_NOOVmode are only used by v9. */
CC (CCX)
CC (CC_NOOV)
CC (CCX_NOOV)
CC (CCFP)
CC (CCFPE)
......@@ -2484,26 +2484,6 @@ do { \
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Add any extra modes needed to represent the condition code.
On the Sparc, we have a "no-overflow" mode which is used when an add or
subtract insn is used to set the condition code. Different branches are
used in this case for some operations.
We also have two modes to indicate that the relevant condition code is
in the floating-point condition code register. One for comparisons which
will generate an exception if the result is unordered (CCFPEmode) and
one for comparisons which will never trap (CCFPmode).
CCXmode and CCX_NOOVmode are only used by v9. */
#define EXTRA_CC_MODES \
CC(CCXmode, "CCX") \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CCX_NOOVmode, "CCX_NOOV") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point,
CCFP[E]mode is used. CC_NOOVmode should be used when the first operand
......
......@@ -869,6 +869,19 @@ if test x$thread_file = x; then
fi
fi
# Look for a file containing extra machine modes.
if test -f $srcdir/config/${cpu_type}/${cpu_type}-modes.def; then
extra_modes_file='$(srcdir)/config/'${cpu_type}/${cpu_type}-modes.def
AC_SUBST(extra_modes_file)
AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE,
"${cpu_type}/${cpu_type}-modes.def",
[Define to the name of a file containing a list of extra machine modes
for this architecture.])
AC_DEFINE(EXTRA_CC_MODES, 1,
[Define if the target architecture needs extra machine modes to represent
the results of comparisons.])
fi
# auto-host.h is the file containing items generated by autoconf and is
# the first file included by config.h.
# If host=build, it is correct to have hconfig include auto-host.h
......
......@@ -674,6 +674,10 @@ possibly a target Makefile fragment @file{t-@var{machine}}
some other files. The names of these files may be changed from the
defaults given by explicit specifications in @file{config.gcc}.
@item
If necessary, a file @file{@var{machine}-modes.def} in the
@file{@var{machine}} directory, containing additional machine modes to
represent condition codes. @xref{Condition Code}, for further details.
@item
Entries in @file{config.gcc} (@pxref{System Config, , The
@file{config.gcc} File}) for the systems with this target
architecture.
......
......@@ -4985,24 +4985,29 @@ two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
@findex EXTRA_CC_MODES
@item EXTRA_CC_MODES
A list of additional modes for condition code values in registers
(@pxref{Jump Patterns}). This macro should expand to a sequence of
calls of the macro @code{CC} separated by white space. @code{CC} takes
two arguments. The first is the enumeration name of the mode, which
should begin with @samp{CC} and end with @samp{mode}. The second is a C
string giving the printable name of the mode; it should be the same as
the first argument, but with the trailing @samp{mode} removed.
Condition codes are represented in registers by machine modes of class
@code{MODE_CC}. By default, there is just one mode, @code{CCmode}, with
this class. If you need more such modes, create a file named
@file{@var{machine}-modes.def} in your @file{config/@var{machine}}
directory (@pxref{Back End, , Anatomy of a Target Back End}), containing
a list of these modes. Each entry in the list should be a call to the
macro @code{CC}. This macro takes one argument, which is the name of
the mode: it should begin with @samp{CC}. Do not put quotation marks
around the name, or include the trailing @samp{mode}; these are
automatically added. There should not be anything else in the file
except comments.
A sample @file{@var{machine}-modes.def} file might look like this:
You should only define this macro if additional modes are required.
A sample definition of @code{EXTRA_CC_MODES} is:
@smallexample
#define EXTRA_CC_MODES \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE")
CC (CC_NOOV) /* @r{Comparison only valid if there was no overflow.} */
CC (CCFP) /* @r{Floating point comparison that cannot trap.} */
CC (CCFPE) /* @r{Floating point comparison that may trap.} */
@end smallexample
When you create this file, the macro @code{EXTRA_CC_MODES} is
automatically defined by @command{configure}, with value @samp{1}.
@findex SELECT_CC_MODE
@item SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
Returns a mode from class @code{MODE_CC} to be used when comparison
......
......@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tconfig.h"
#include "tsystem.h"
#include "symcat.h"
#include "machmode.h"
/* Don't use `fancy_abort' here even if config.h says to use it. */
......
......@@ -151,18 +151,20 @@ DEF_MACHMODE (BLKmode, "BLK", MODE_RANDOM, 0, 0, 0, VOIDmode, VOIDmode)
/* The modes for representing the condition codes come last. CCmode
is always defined. Additional modes for the condition code can be
specified in the EXTRA_CC_MODES macro. All MODE_CC modes are the
specified in the EXTRA_CC_MODES header. All MODE_CC modes are the
same width as SImode and have VOIDmode as their next wider mode. */
#define CC(E, M) DEF_MACHMODE (E, M, MODE_CC, BITS_PER_UNIT*4, 4, 4, VOIDmode, VOIDmode)
CC (CCmode, "CC")
#ifdef EXTRA_CC_MODES
EXTRA_CC_MODES
#endif
/* We do not use CC() for CCmode to avoid a warning about use of
function-like macros with no arguments. */
DEF_MACHMODE (CCmode, "CC", MODE_CC, BITS_PER_UNIT*4, 4, 4, VOIDmode, VOIDmode)
#ifdef EXTRA_MODES_FILE
#define CC(N) \
DEF_MACHMODE (CONCAT2 (N,mode), STRINGX (N), \
MODE_CC, BITS_PER_UNIT*4, 4, 4, VOIDmode, VOIDmode)
#include EXTRA_MODES_FILE
#undef CC
#endif
/* The symbol Pmode stands for one of the above machine modes (usually SImode).
The tm file specifies which one. It is not a distinct mode. */
......
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