Commit 847535b6 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 277b4867
2008-08-31 Jakub Jelinek <jakub@redhat.com>
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 <jh@suse.cz> 2008-08-31 Jan Hubicka <jh@suse.cz>
* predict.c (PROB_VERY_LIKELY): Make small enough so things * predict.c (PROB_VERY_LIKELY): Make small enough so things
......
;; AltiVec patterns. ;; AltiVec patterns.
;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
;; Free Software Foundation, Inc. ;; Free Software Foundation, Inc.
;; Contributed by Aldy Hernandez (aldy@quesejoda.com) ;; Contributed by Aldy Hernandez (aldy@quesejoda.com)
...@@ -255,15 +255,15 @@ ...@@ -255,15 +255,15 @@
}) })
(define_split (define_split
[(set (match_operand:VI 0 "altivec_register_operand" "") [(set (match_operand:V 0 "altivec_register_operand" "")
(match_operand:VI 1 "easy_vector_constant_add_self" ""))] (match_operand:V 1 "easy_vector_constant_add_self" ""))]
"TARGET_ALTIVEC && reload_completed" "TARGET_ALTIVEC && reload_completed"
[(set (match_dup 0) (match_dup 3)) [(set (match_dup 0) (match_dup 3))
(set (match_dup 0) (plus:VI (match_dup 0) (set (match_dup 0) (match_dup 4))]
(match_dup 0)))]
{ {
rtx dup = gen_easy_altivec_constant (operands[1]); rtx dup = gen_easy_altivec_constant (operands[1]);
rtx const_vec; rtx const_vec;
enum machine_mode op_mode = <MODE>mode;
/* Divide the operand of the resulting VEC_DUPLICATE, and use /* Divide the operand of the resulting VEC_DUPLICATE, and use
simplify_rtx to make a CONST_VECTOR. */ simplify_rtx to make a CONST_VECTOR. */
...@@ -271,10 +271,16 @@ ...@@ -271,10 +271,16 @@
XEXP (dup, 0), const1_rtx); XEXP (dup, 0), const1_rtx);
const_vec = simplify_rtx (dup); const_vec = simplify_rtx (dup);
if (GET_MODE (const_vec) == <MODE>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; operands[3] = const_vec;
else else
operands[3] = gen_lowpart (<MODE>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" (define_insn "get_vrsave_internal"
......
;; Predicate definitions for POWER and PowerPC. ;; 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. ;; This file is part of GCC.
;; ;;
...@@ -325,8 +325,8 @@ ...@@ -325,8 +325,8 @@
(and (match_test "TARGET_ALTIVEC") (and (match_test "TARGET_ALTIVEC")
(match_test "easy_altivec_constant (op, mode)"))) (match_test "easy_altivec_constant (op, mode)")))
{ {
rtx last = CONST_VECTOR_ELT (op, GET_MODE_NUNITS (mode) - 1); HOST_WIDE_INT val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1);
HOST_WIDE_INT val = ((INTVAL (last) & 0xff) ^ 0x80) - 0x80; val = ((val & 0xff) ^ 0x80) - 0x80;
return EASY_VECTOR_15_ADD_SELF (val); return EASY_VECTOR_15_ADD_SELF (val);
}) })
......
/* Definitions of target machine for GNU compiler, for IBM RS/6000. /* 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. Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) 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); ...@@ -31,6 +31,7 @@ extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, int, int, int);
#endif /* TREE_CODE */ #endif /* TREE_CODE */
extern bool easy_altivec_constant (rtx, enum machine_mode); 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 bool macho_lo_sum_memory_operand (rtx, enum machine_mode);
extern int num_insns_constant (rtx, enum machine_mode); extern int num_insns_constant (rtx, enum machine_mode);
extern int num_insns_constant_wide (HOST_WIDE_INT); extern int num_insns_constant_wide (HOST_WIDE_INT);
......
...@@ -2690,7 +2690,7 @@ num_insns_constant (rtx op, enum machine_mode mode) ...@@ -2690,7 +2690,7 @@ num_insns_constant (rtx op, enum machine_mode mode)
corresponding element of the vector, but for V4SFmode and V2SFmode, corresponding element of the vector, but for V4SFmode and V2SFmode,
the corresponding "float" is interpreted as an SImode integer. */ 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) const_vector_elt_as_int (rtx op, unsigned int elt)
{ {
rtx tmp = CONST_VECTOR_ELT (op, elt); rtx tmp = CONST_VECTOR_ELT (op, elt);
......
2008-08-31 Jakub Jelinek <jakub@redhat.com>
PR target/37168
* gcc.target/powerpc/pr37168.c: New test.
2008-08-31 Jan Hubicka <jh@suse.cz> 2008-08-31 Jan Hubicka <jh@suse.cz>
* gcc.target/i386/cold-attribute-1.c: New testcase. * gcc.target/i386/cold-attribute-1.c: New testcase.
......
/* 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;
}
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