From: Jakub Jelinek Date: Sun, 31 Aug 2008 12:08:35 +0000 (+0200) Subject: re PR target/37168 (ICE: in final_scan_insn, at final.c:2615 (altivec)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=847535b6255a78ba618745d501b772ac95230359;p=gcc.git re PR target/37168 (ICE: in final_scan_insn, at final.c:2615 (altivec)) PR target/37168 * config/rs6000/rs6000-protos.h (const_vector_elt_as_int): Add prototype. * config/rs6000/rs6000.c (const_vector_elt_as_int): No longer static. * config/rs6000/altivec.md (easy_vector_constant_add_self splitter): Also split V4SFmode. * config/rs6000/predicates.md (easy_vector_constant_add_self): Handle vector float modes. * gcc.target/powerpc/pr37168.c: New test. From-SVN: r139828 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b7ece09082..c5690fcd8e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2008-08-31 Jakub Jelinek + + PR target/37168 + * config/rs6000/rs6000-protos.h (const_vector_elt_as_int): Add + prototype. + * config/rs6000/rs6000.c (const_vector_elt_as_int): No longer static. + * config/rs6000/altivec.md (easy_vector_constant_add_self splitter): + Also split V4SFmode. + * config/rs6000/predicates.md (easy_vector_constant_add_self): Handle + vector float modes. + 2008-08-31 Jan Hubicka * predict.c (PROB_VERY_LIKELY): Make small enough so things diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index f8ed145350e..e8028edf067 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -1,5 +1,5 @@ ;; AltiVec patterns. -;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 ;; Free Software Foundation, Inc. ;; Contributed by Aldy Hernandez (aldy@quesejoda.com) @@ -255,15 +255,15 @@ }) (define_split - [(set (match_operand:VI 0 "altivec_register_operand" "") - (match_operand:VI 1 "easy_vector_constant_add_self" ""))] + [(set (match_operand:V 0 "altivec_register_operand" "") + (match_operand:V 1 "easy_vector_constant_add_self" ""))] "TARGET_ALTIVEC && reload_completed" [(set (match_dup 0) (match_dup 3)) - (set (match_dup 0) (plus:VI (match_dup 0) - (match_dup 0)))] + (set (match_dup 0) (match_dup 4))] { rtx dup = gen_easy_altivec_constant (operands[1]); rtx const_vec; + enum machine_mode op_mode = mode; /* Divide the operand of the resulting VEC_DUPLICATE, and use simplify_rtx to make a CONST_VECTOR. */ @@ -271,10 +271,16 @@ XEXP (dup, 0), const1_rtx); const_vec = simplify_rtx (dup); - if (GET_MODE (const_vec) == mode) + if (op_mode == V4SFmode) + { + op_mode = V4SImode; + operands[0] = gen_lowpart (op_mode, operands[0]); + } + if (GET_MODE (const_vec) == op_mode) operands[3] = const_vec; else - operands[3] = gen_lowpart (mode, const_vec); + operands[3] = gen_lowpart (op_mode, const_vec); + operands[4] = gen_rtx_PLUS (op_mode, operands[0], operands[0]); }) (define_insn "get_vrsave_internal" diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 8e97c79acd2..f6929706899 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -1,5 +1,5 @@ ;; Predicate definitions for POWER and PowerPC. -;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; ;; This file is part of GCC. ;; @@ -325,8 +325,8 @@ (and (match_test "TARGET_ALTIVEC") (match_test "easy_altivec_constant (op, mode)"))) { - rtx last = CONST_VECTOR_ELT (op, GET_MODE_NUNITS (mode) - 1); - HOST_WIDE_INT val = ((INTVAL (last) & 0xff) ^ 0x80) - 0x80; + HOST_WIDE_INT val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1); + val = ((val & 0xff) ^ 0x80) - 0x80; return EASY_VECTOR_15_ADD_SELF (val); }) diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 762f784ed69..a9fb2ab237f 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -1,5 +1,5 @@ /* Definitions of target machine for GNU compiler, for IBM RS/6000. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) @@ -31,6 +31,7 @@ extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, int, int, int); #endif /* TREE_CODE */ extern bool easy_altivec_constant (rtx, enum machine_mode); +extern HOST_WIDE_INT const_vector_elt_as_int (rtx, unsigned int); extern bool macho_lo_sum_memory_operand (rtx, enum machine_mode); extern int num_insns_constant (rtx, enum machine_mode); extern int num_insns_constant_wide (HOST_WIDE_INT); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e2743edce29..d3821a8cfa9 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2690,7 +2690,7 @@ num_insns_constant (rtx op, enum machine_mode mode) corresponding element of the vector, but for V4SFmode and V2SFmode, the corresponding "float" is interpreted as an SImode integer. */ -static HOST_WIDE_INT +HOST_WIDE_INT const_vector_elt_as_int (rtx op, unsigned int elt) { rtx tmp = CONST_VECTOR_ELT (op, elt); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e4a2e9cc27..c03514ceee0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-31 Jakub Jelinek + + PR target/37168 + * gcc.target/powerpc/pr37168.c: New test. + 2008-08-31 Jan Hubicka * gcc.target/i386/cold-attribute-1.c: New testcase. diff --git a/gcc/testsuite/gcc.target/powerpc/pr37168.c b/gcc/testsuite/gcc.target/powerpc/pr37168.c new file mode 100644 index 00000000000..8d35157d0f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr37168.c @@ -0,0 +1,14 @@ +/* PR target/37168 */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -maltivec" } */ + +#define C 3.68249351546114573519399405666776E-44f +#define vector __attribute__ ((altivec (vector__))) + +vector float +foo (vector float a) +{ + vector float b = __builtin_vec_madd (b, a, (vector float) { C, C, C, C }); + return b; +}