From a946dd00743b24b4ac24ed1f5d39df34bc263964 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 13 Feb 2001 10:05:56 +0000 Subject: [PATCH] i386.h (VALID_FP_MODE_P, [...]): New. * i386.h (VALID_FP_MODE_P, VALID_INT_MODE_P): New. (HARD_REGNO_MODE_OK): Move offline to .... * i386.c (ix86_hard_regno_mode_ok) ... here; refuse all incorrect modes. * i386-protos.h (ix86_hard_regno_mode_ok): Declare. From-SVN: r39621 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386-protos.h | 1 + gcc/config/i386/i386.c | 30 ++++++++++++++++++++++++++++++ gcc/config/i386/i386.h | 34 ++++++++++++++-------------------- gcc/configure | 2 +- 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e5f0f5147d..aac7623b7c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Die Feb 13 11:04:25 CET 2001 Jan Hubicka + + * i386.h (VALID_FP_MODE_P, VALID_INT_MODE_P): New. + (HARD_REGNO_MODE_OK): Move offline to .... + * i386.c (ix86_hard_regno_mode_ok) ... here; + refuse all incorrect modes. + * i386-protos.h (ix86_hard_regno_mode_ok): Declare. + 2001-02-13 Richard Henderson * sparc.md (cmp_cc_arith_op_set): Don't use match_dup on the diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 03fa84f3795..57fdaa417b5 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -131,6 +131,7 @@ extern enum machine_mode ix86_fp_compare_mode PARAMS ((enum rtx_code)); extern rtx ix86_force_to_memory PARAMS ((enum machine_mode, rtx)); extern void ix86_free_from_memory PARAMS ((enum machine_mode)); extern void ix86_split_fp_branch PARAMS ((rtx, rtx, rtx, rtx, rtx, rtx)); +extern int ix86_hard_regno_mode_ok PARAMS ((int, enum machine_mode)); #ifdef TREE_CODE extern void init_cumulative_args PARAMS ((CUMULATIVE_ARGS *, tree, rtx)); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 2737b6bccd4..683c8817b3d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8724,3 +8724,33 @@ ix86_free_from_memory (mode) ? 2 : 4)))); } + +/* Return 1 if hard register REGNO can hold a value of machine-mode MODE. */ +int +ix86_hard_regno_mode_ok (regno, mode) + int regno; + enum machine_mode mode; +{ + /* Flags and only flags can only hold CCmode values. */ + if (CC_REGNO_P (regno)) + return GET_MODE_CLASS (mode) == MODE_CC; + if (GET_MODE_CLASS (mode) == MODE_CC + || GET_MODE_CLASS (mode) == MODE_RANDOM + || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) + return 0; + if (FP_REGNO_P (regno)) + return VALID_FP_MODE_P (mode); + if (SSE_REGNO_P (regno)) + return VALID_SSE_REG_MODE (mode); + if (MMX_REGNO_P (regno)) + return VALID_MMX_REG_MODE (mode); + /* We handle both integer and floats in the general purpose registers. + In future we should be able to handle vector modes as well. */ + if (!VALID_INT_MODE_P (mode) && !VALID_FP_MODE_P (mode)) + return 0; + /* Take care for QImode values - they can be in non-QI regs, but then + they do cause partial register stalls. */ + if (QI_REG_P (regno) || mode != QImode) + return 1; + return reload_in_progress || reload_completed || !TARGET_PARTIAL_REG_STALL; +} diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 48008724198..162da52ff14 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -775,28 +775,22 @@ extern int ix86_arch; (VALID_SSE_REG_MODE (MODE) && TARGET_SSE ? 1 \ : VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1 : 0) +#define VALID_FP_MODE_P(mode) \ + ((mode) == SFmode || (mode) == DFmode || (mode) == TFmode \ + || (mode) == XFmode \ + || (mode) == SCmode || (mode) == DCmode || (mode) == TCmode\ + || (mode) == XCmode) + +#define VALID_INT_MODE_P(mode) \ + ((mode) == QImode || (mode) == HImode || (mode) == SImode \ + || (mode) == DImode \ + || (mode) == CQImode || (mode) == CHImode || (mode) == CSImode \ + || (mode) == CDImode) + /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - /* Flags and only flags can only hold CCmode values. */ \ - (CC_REGNO_P (REGNO) \ - ? GET_MODE_CLASS (MODE) == MODE_CC \ - : GET_MODE_CLASS (MODE) == MODE_CC ? 0 \ - /* FP regs can only hold floating point; make it clear they \ - cannot hold TFmode floats. */ \ - : FP_REGNO_P (REGNO) \ - ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \ - && GET_MODE_UNIT_SIZE (MODE) <= 16)\ - : SSE_REGNO_P (REGNO) ? VALID_SSE_REG_MODE (MODE) \ - : MMX_REGNO_P (REGNO) ? VALID_MMX_REG_MODE (MODE) \ - /* Only SSE and MMX regs can hold vector modes. */ \ - : VECTOR_MODE_P (MODE) || (MODE) == TImode ? 0 \ - : (REGNO) < 4 ? 1 \ - /* Other regs cannot do byte accesses. */ \ - : (MODE) != QImode ? 1 \ - : reload_in_progress || reload_completed \ - || !TARGET_PARTIAL_REG_STALL) +#define HARD_REGNO_MODE_OK(REGNO, MODE) \ + ix86_hard_regno_mode_ok (REGNO, MODE) /* Value is 1 if it is a good idea to tie two pseudo registers when one has mode MODE1 and one has mode MODE2. diff --git a/gcc/configure b/gcc/configure index 6ec98d75760..2fa46112e26 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1571,7 +1571,7 @@ esac # Find some useful tools -for ac_prog in gawk mawk nawk awk +for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -- 2.30.2