Bug 14425 - [4.0 Regression] vec_splat broken
Summary: [4.0 Regression] vec_splat broken
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-03-04 03:55 UTC by Timothy J. Wood
Modified: 2004-09-13 14:15 UTC (History)
2 users (show)

See Also:
Host: powerpc-apple-darwin7.2.0
Target: powerpc-apple-darwin7.2.0
Build: powerpc-apple-darwin7.2.0
Known to work:
Known to fail:
Last reconfirmed: 2004-03-04 07:03:15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy J. Wood 2004-03-04 03:55:33 UTC
#include <altivec.h>

vector unsigned int splat0(vector unsigned int x)
{
    return vec_splat(x, 0);
}


$PREFIX/bin/g++ -faltivec -S splat.c 

/Volumes/Space/Users/bungi/Source/GNU/gcc/gcc-tree-ssa/install/bin/../lib/gcc/powerpc-
apple-darwin7.2.0/3.5-tree-ssa/include/altivec.h: In function `__bool int __vector__ 
vec_splat(__bool int __vector__, int)':
/Volumes/Space/Users/bungi/Source/GNU/gcc/gcc-tree-ssa/install/bin/../lib/gcc/powerpc-
apple-darwin7.2.0/3.5-tree-ssa/include/altivec.h:4562: error: argument 2 must be a 5-bit 
unsigned literal
/Volumes/Space/Users/bungi/Source/GNU/gcc/gcc-tree-ssa/install/bin/../lib/gcc/powerpc-
apple-darwin7.2.0/3.5-tree-ssa/include/altivec.h: In function `unsigned int __vector__ 
vec_splat(unsigned int __vector__, int)':
/Volumes/Space/Users/bungi/Source/GNU/gcc/gcc-tree-ssa/install/bin/../lib/gcc/powerpc-
apple-darwin7.2.0/3.5-tree-ssa/include/altivec.h:4556: error: argument 2 must be a 5-bit 
unsigned literal
Comment 1 Andrew Pinski 2004-03-04 07:03:13 UTC
This also happens in 3.5.0 (20040223):
GNU C++ version 3.5.0 20040223 (experimental) (powerpc-apple-darwin7.2.0)
        compiled by GNU C version 3.5.0 20040223 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
altivec.h: In function `__bool int __vector__ vec_splat(__bool int __vector__, int)':
altivec.h:4562: error: argument 2 must be a 5-bit unsigned literal
altivec.h: In function `unsigned int __vector__ vec_splat(unsigned int __vector__, int)':
altivec.h:4556: error: argument 2 must be a 5-bit unsigned literal

This was working before.
Comment 2 GCC Commits 2004-03-04 23:19:35 UTC
Subject: Bug 14425

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	zlaski@gcc.gnu.org	2004-03-04 23:19:29

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: altivec.h rs6000.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: altivec-4.C altivec-5.C 

Log message:
	[gcc/ChangeLog]
	2004-03-04  Ziemowit Laski  <zlaski@apple.com>
	
	PR c++/14425, c++/14426
	* config/rs6000/altivec.h (vec_splat_s8, vec_splat_s16,
	vec_splat_s32, vec_splat_u8, vec_splat_u16, vec_splat_u32):
	Change C++ definitions to accept a 'const int' argument;
	the prototypes already do.
	* config/rs6000/rs6000.c (rs6000_common_init_builtins):
	Rename v4si_ftype_char, v8hi_ftype_char, v16qi_ftype_char,
	v4sf_ftype_v4si_char, v4si_ftype_v4sf_char, v4si_ftype_v4si_char,
	v8hi_ftype_v8hi_char, v16qi_ftype_v16qi_char,
	v16qi_ftype_v16qi_v16qi_char, v8hi_ftype_v8hi_v8hi_char,
	v4si_ftype_v4si_v4si_char and v4sf_ftype_v4sf_v4sf_char to
	end in ..._int; change them to accept an int instead of a char
	as the last parameter.
	
	[gcc/testsuite/ChangeLog]
	2004-03-04  Ziemowit Laski  <zlaski@apple.com>
	
	PR c++/14425, c++/14426
	* g++.dg/ext/altivec-4.C: New test.
	* g++.dg/ext/altivec-5.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3049&r2=2.3050
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/altivec.h.diff?cvsroot=gcc&r1=1.28&r2=1.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.600&r2=1.601
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3568&r2=1.3569
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 Ziemowit Laski 2004-03-04 23:22:30 UTC
Fix committed to mainline.
Comment 4 GCC Commits 2004-05-11 15:49:36 UTC
Subject: Bug 14425

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	hammer-3_3-branch
Changes by:	matz@gcc.gnu.org	2004-05-11 15:49:29

Modified files:
	gcc/testsuite/gcc.dg: altivec-1.c altivec-2.c altivec-3.c 
	                      altivec-4.c altivec-5.c altivec-7.c 
	                      altivec-8.c altivec-10.c 
Added files:
	gcc/testsuite/gcc.dg: altivec-12.c altivec-6.c altivec_check.h 
	gcc/testsuite/g++.dg/ext: altivec-1.C altivec-2.C altivec-3.C 
	                          altivec-4.C altivec-5.C altivec-6.C 
	                          altivec-7.C altivec_check.h 

Log message:
	Backport of various C++ stuff regarding ppc ABI with vector
	args (#39623)
	
	2003-08-25  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/8795
	* g++.dg/ext/altivec-1.C: New test.
	
	2004-02-21  Ziemowit Laski  <zlaski@apple.com>
	
	* g++.dg/ext/altivec-1.C: Generalize target triple.
	* g++.dg/ext/altivec-2.C: New test case.
	* g++.dg/ext/altivec_check.h: New file.
	* gcc.dg/altivec-1.c: Generalize target triple;
	include altivec_check.h and call altivec_check().
	* gcc.dg/altivec-[2-5].c: Generalize target triple.
	* gcc.dg/altivec-6.c: New test case.
	* gcc.dg/altivec-[7-8].c: Generalize target triple; add
	type casts as needed.
	[* gcc.dg/altivec-9.c: Generalize target triple; add
	type casts as needed. skipped, doesn't exist yet]
	* gcc.dg/altivec-10.c: Include altivec_check.h and call
	altivec_check().
	* gcc.dg/altivec-12.c: New test case.
	[* gcc.dg/altivec-varargs-1.c: Generalize target triple;
	include altivec_check.h and call altivec_check().
	skipped, doesn't exist yet]
	* gcc.dg/altivec_check.h: New file.
	
	2004-02-27  Ziemowit Laski  <zlaski@apple.com>
	
	* g++.dg/ext/altivec-3.C: New.
	
	2004-03-04  Ziemowit Laski  <zlaski@apple.com>
	
	PR c++/14425, c++/14426
	* g++.dg/ext/altivec-4.C: New test.
	* g++.dg/ext/altivec-5.C: New test.
	
	2004-03-19  Ziemowit Laski  <zlaski@apple.com>
	
	* g++.dg/ext/altivec-6.C: New test.
	
	2004-03-23  Ziemowit Laski  <zlaski@apple.com>
	
	* g++.dg/ext/altivec-7.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-12.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-6.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.2.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec_check.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-1.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.4&r2=1.4.20.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-2.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.3&r2=1.3.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-3.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1&r2=1.1.38.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-4.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.6&r2=1.6.32.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-5.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1&r2=1.1.26.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-7.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1&r2=1.1.26.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-8.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1&r2=1.1.26.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-10.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.4.1&r2=1.1.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-1.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.2.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-2.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-3.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-4.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-5.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-6.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec-7.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/altivec_check.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.18.1

Comment 5 GCC Commits 2004-05-11 15:52:27 UTC
Subject: Bug 14425

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	hammer-3_3-branch
Changes by:	matz@gcc.gnu.org	2004-05-11 15:52:23

Modified files:
	gcc/doc        : tm.texi 
	gcc/config     : darwin.h 
	gcc/config/rs6000: rs6000-c.c altivec.h darwin.h rs6000.c 
	                   rs6000.h 
	gcc/config/i386: darwin.h 

Log message:
	Backport of various C++ stuff regarding ppc ABI with vector
	args (#39623)
	
	2003-08-25  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/8795
	* tree.h (build_method_type_directly): Declare.
	* c-common.c (handle_vector_size_attributes): Handle METHOD_TYPEs.
	(vector_size_helper): Likewise.
	* tree.c (build_method_type_directly): New function.
	(build_method_type): Use it.
	
	PR c++/8795
	* g++.dg/ext/altivec-1.C: New test.
	
	2004-02-10  Ziemowit Laski  <zlaski@apple.com>
	
	* c-common.c (vector_size_helper): Remove; call
	reconstruct_complex_type() instead.
	* tree.c (reconstruct_complex_type): New function
	(formerly vector_size_helper() in c-common.c).
	(make_vector): Make externally visible.
	* tree.h (reconstruct_complex_type, make_vector): Add prototypes.
	
	2004-02-21  Ziemowit Laski  <zlaski@apple.com>
	
	* config/darwin.h (TARGET_OPTION_TRANSLATE_TABLE): Refer to
	SUBTARGET_OPTION_TRANSLATE_TABLE for architecture-specific options.
	* config/i386/darwin.h (SUBTARGET_OPTION_TRANSLATE_TABLE): Define it.
	* config/rs6000/altivec.h: #error out if '-maltivec' not specified.
	(vector, pixel, bool): #define to __vector, __pixel and __bool.
	(__un_args_eq, __bin_args_eq, __tern_args_eq): Move to C-specific
	portion of header.
	(__altivec_link_error_invalid_argument): Remove prototype; will use
	__builtin_altivec_compiletime_error("vec_*") instead.
	(vec_*): Fix/complete set of available operation overloads given the
	existence of distinct 'vector bool ...' and 'vector pixel' types; tight
	en
	cv-correctness of pointer arguments; in C, always check for correct
	argument types before macro expansion.
	* config/rs6000/darwin.h (SUBTARGET_OPTION_TRANSLATE_TABLE): New macro
	defining Darwin/PowerPC-specific '-f[no-]altivec' and
	'-W[no-]altivec-long-deprecated' switches.
	* config/rs6000/rs6000-c (rs6000_cpu_cpp_builtins): Pre-define
	'__vector', '__pixel' and '__bool' macros using
	'__attribute__((altivec(...)))' types.
	* config/rs6000/rs6000.c (bool_char_type_node, bool_short_type_node,
	bool_int_type_node, pixel_type_node,
	bool_V16QI_type_node,
	bool_V8HI_type_node, bool_V4SI_type_node,
	pixel_V8HI_type_node): New type nodes.
	(rs6000_warn_altivec_long, rs6000_warn_altivec_long_switch): New, for
	handling '-W[no-]altivec-long-deprecated'.
	(rs6000_override_options): Handle '-W[no-]altivec-long-deprecated'.
	(rs6000_expand_binop_builtin, rs6000_expand_ternop_builtin,
	altivec_expand_dst_builtin): Remove casts from integer literals.
	(altivec_expand_builtin): Likewise; handle expansion of new
	'__builtin_altivec_compiletime_error' function.
	(rs6000_init_builtins): Initialize 'vector bool ...' and 'vector pixel'
	types, and make them distinct from other vector types; register
	'__builtin_altivec_compiletime_error' function.
	(print_operand): For 'P', print a full target register name instead of
	merely its number.
	(rs6000_attribute_table): Add "altivec" attribute.
	(rs6000_handle_altivec_attribute): New function.
	* config/rs6000/rs6000.h (TARGET_OPTIONS): Describe
	'-m[no-]-warn-altivec-long' (which '-W[no-]altivec-long-deprecated'
	maps to).
	(rs6000_warn_altivec_long, rs6000_warn_altivec_long_switch): Forward
	declare.
	(ALTIVEC_BUILTIN_COMPILETIME_ERROR): New built-in enumeration.
	
	2004-02-27  Ziemowit Laski  <zlaski@apple.com>
	
	* tree.c (pod_type_p): Treat VECTOR_TYPEs as PODs.
	
	2004-03-04  Ziemowit Laski  <zlaski@apple.com>
	
	PR c++/14425, c++/14426
	* config/rs6000/altivec.h (vec_splat_s8, vec_splat_s16,
	vec_splat_s32, vec_splat_u8, vec_splat_u16, vec_splat_u32):
	Change C++ definitions to accept a 'const int' argument;
	the prototypes already do.
	* config/rs6000/rs6000.c (rs6000_common_init_builtins):
	Rename v4si_ftype_char, v8hi_ftype_char, v16qi_ftype_char,
	v4sf_ftype_v4si_char, v4si_ftype_v4sf_char,
	v4si_ftype_v4si_char,
	v8hi_ftype_v8hi_char, v16qi_ftype_v16qi_char,
	v16qi_ftype_v16qi_v16qi_char, v8hi_ftype_v8hi_v8hi_char,
	v4si_ftype_v4si_v4si_char and v4sf_ftype_v4sf_v4sf_char to
	end in ..._int; change them to accept an int instead of a char
	as the last parameter.
	
	2004-03-19  Ziemowit Laski  <zlaski@apple.com>
	
	* config/rs6000/altivec.h (vec_dst, vec_dstst, vec_dststt,
	vec_dstt, vec_sld, vec_splat): Add prototypes, marked with
	always_inline attribute.
	* config/rs6000/rs6000.c (altivec_expand_dst_builtin):
	Treat expansion as completed even if literal argument is
	invalid (so that other expansions are not tried in vain).
	
	2004-03-23  Ziemowit Laski  <zlaski@apple.com>
	
	* hooks.c (hook_constcharptr_tree_null): New hook.
	* hooks.h (hook_constcharptr_tree_null): New prototype.
	* target-def.h (TARGET_MANGLE_FUNDAMENTAL_TYPE): New target
	hook.
	* target.h (mangle_fundamental_type): New target hook.
	* config/rs6000/rs6000.c (TARGET_MANGLE_FUNDAMENTAL_TYPE):
	Point target hook at rs6000_mangle_fundamental_type.
	(rs6000_mangle_fundamental_type): New function.
	* doc/tm.texi (TARGET_MANGLE_FUNDAMENTAL_TYPE): Document.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/tm.texi.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.180.2.14&r2=1.180.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/darwin.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.42.4.5&r2=1.42.4.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000-c.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.5.12.1&r2=1.5.12.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/altivec.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.20.18.3&r2=1.20.18.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/darwin.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.29.2.6&r2=1.29.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.397.2.39&r2=1.397.2.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.234.2.26&r2=1.234.2.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/darwin.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.3.4.1&r2=1.3.4.2