Bug 18506 - Altivec definitions of vec_init
Summary: Altivec definitions of vec_init
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.1.0
Assignee: Aldy Hernandez
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization
Depends on:
Blocks: 10469 34529
  Show dependency treegraph
 
Reported: 2004-11-15 22:44 UTC by David Edelsohn
Modified: 2007-12-20 02:10 UTC (History)
1 user (show)

See Also:
Host: *-*-*
Target: powerpc*-*-*
Build: *-*-*
Known to work:
Known to fail:
Last reconfirmed: 2005-05-18 20:24:36


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edelsohn 2004-11-15 22:44:56 UTC
Poor generated code for initializing vectors with constants because vec_init
pattern is not defined for Altivec.
Comment 1 Andrew Pinski 2004-11-15 22:51:15 UTC
PR 10469 looks like a testcase where this could improve the code generation.
Comment 2 Dorit Naishlos 2004-11-17 11:09:32 UTC
(In reply to comment #1)
> PR 10469 looks like a testcase where this could improve the code generation.\

gcc.dg/vect/vect-25.c is a testcase too.

This is what is currently generated (the invariant is in r3):

        mr r9,r3
        mr r10,r3
        mr r11,r3
        mr r12,r3 
L6:
        addi r7,r1,1104
        stw r9,0(r7)
        stw r10,4(r7)
        stw r11,8(r7)
        stw r12,12(r7)
        lvx v0,0,r7
        stvx v0,0,r2
        addi r2,r2,16
        bdnz L6

instead of:

        stw r3,0(r2)
        lvewx v0,0,r2
        vspltw v0,v0,0
L4:
        stvx v0,r2,r0
        addi r2,r2,16
        bdnz L4 

Comment 3 GCC Commits 2005-08-08 16:36:33 UTC
Subject: Bug 18506

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dje@gcc.gnu.org	2005-08-08 16:36:27

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: altivec.md rs6000.c rs6000.h rs6000-protos.h 

Log message:
	PR target/18506
	* config/rs6000/altivec.md (vec_init<mode>): New.
	(vec_set<mode>): New.
	(vec_extract<mode>): New.
	* config/rs6000/rs6000.c (rs6000_expand_vector_init): New.
	(rs6000_expand_vector_set): New.
	(rs6000_expand_vector_extract): New.
	(rs6000_legitimate_offset_address_p): Offset addresses are valid
	for Altivec modes before reload.
	(altivec_expand_vec_init_builtin): New.
	(get_element_number): New.
	(altivec_expand_vec_set_builtin): New.
	(altivec_expand_vec_ext_builtin): New.
	(altivec_expand_builtin): Expand vec_init, vec_set, and vec_ext
	builtins.
	(altivec_init_builtins): Init vec_init, vec_set, and vec_ext
	builtins.
	* config/rs6000/rs6000.h (rs6000_builtins): Add
	ALTIVEC_BUILTIN_VEC_INIT_<mode>, ALTIVEC_BUILTIN_VEC_SET_<mode>,
	ALTIVEC_BUILTIN_VEC_EXT_<mode>.
	* config/rs6000/rs6000-protos.h: Declare new functions.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9679&r2=2.9680
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/altivec.md.diff?cvsroot=gcc&r1=1.41&r2=1.42
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.857&r2=1.858
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&r1=1.381&r2=1.382
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000-protos.h.diff?cvsroot=gcc&r1=1.105&r2=1.106

Comment 4 David Edelsohn 2005-08-08 18:04:06 UTC
Patch committed