From: David S. Miller Date: Sun, 23 Oct 2011 21:51:16 +0000 (+0000) Subject: Fix sparc so that reload doesn't try to load non-trivial vector consts directly. X-Git-Tag: releases/gcc-4.7.0~2881 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d1a883835b28085e2d6e6a13c4745680e4f2ef6;p=thirdparty%2Fgcc.git Fix sparc so that reload doesn't try to load non-trivial vector consts directly. * config/sparc/predicates.md (input_operand): Disallow vector constants other than 0 and -1. * config/sparc/sparc.c (sparc_preferred_reload_class): Return NO_REGS for vector constants other than 0 and -1. From-SVN: r180351 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e647a6037cc5..3dc4ba9bd749 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2011-10-23 David S. Miller + * config/sparc/predicates.md (input_operand): Disallow vector + constants other than 0 and -1. + * config/sparc/sparc.c (sparc_preferred_reload_class): Return + NO_REGS for vector constants other than 0 and -1. + * config/sparc/sparc.h (SPARC_FIRST_INT_REG, SPARC_LAST_INT_REG, SPARC_INT_REG_P): Define. (HARD_REGNO_NREGS): Use SPARC_INT_REG_P. diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md index f0be14997afc..4dd734f047e3 100644 --- a/gcc/config/sparc/predicates.md +++ b/gcc/config/sparc/predicates.md @@ -427,8 +427,12 @@ && (GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT)) return true; - if ((mclass == MODE_FLOAT && GET_CODE (op) == CONST_DOUBLE) - || (mclass == MODE_VECTOR_INT && GET_CODE (op) == CONST_VECTOR)) + if (mclass == MODE_FLOAT && GET_CODE (op) == CONST_DOUBLE) + return true; + + if (mclass == MODE_VECTOR_INT && GET_CODE (op) == CONST_VECTOR + && (const_zero_operand (op, mode) + || const_all_ones_operand (op, mode))) return true; if (register_operand (op, mode)) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 415ece8c647e..df0d825dbc48 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -11116,17 +11116,26 @@ sparc_conditional_register_usage (void) static reg_class_t sparc_preferred_reload_class (rtx x, reg_class_t rclass) { + enum machine_mode mode = GET_MODE (x); if (CONSTANT_P (x)) { if (FP_REG_CLASS_P (rclass) || rclass == GENERAL_OR_FP_REGS || rclass == GENERAL_OR_EXTRA_FP_REGS - || (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT && ! TARGET_FPU) - || (GET_MODE (x) == TFmode && ! const_zero_operand (x, TFmode))) + || (GET_MODE_CLASS (mode) == MODE_FLOAT && ! TARGET_FPU) + || (mode == TFmode && ! const_zero_operand (x, mode))) return NO_REGS; - if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT) + if (GET_MODE_CLASS (mode) == MODE_INT) return GENERAL_REGS; + + if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) + { + if (! FP_REG_CLASS_P (rclass) + || !(const_zero_operand (x, mode) + || const_all_ones_operand (x, mode))) + return NO_REGS; + } } return rclass;