A Far Less Ambitous AltiVec patch

Ziemowit Laski zlaski@apple.com
Tue Jan 13 02:11:00 GMT 2004


Ok, so per Geoff's suggestion, I've excised the controversial
portions of my original patch, and offer the following instead.

Note that the bulk of the changes is in the file 
gcc/config/rs6000/altivec.h,
which is not actually used in building gcc itself.  Rather, it is a
file that end-users #include when using AltiVec functionality.

Most of the remaining bits are also Darwin or RS6000-specific.  The only
platform-independent change is the addition of a target hook for
mangling of vendor-specific types (which AltiVec types are).  Luckily,
no demangler changes are needed.

I see that the Darwin build failure has gone away, and so will now
bootstrap the compiler and put it through DejaGNU.  OK to commit if
there are no regressions?

--Zem

[gcc/ChangeLog]
2004-01-12  Ziemowit Laski  <zlaski@apple.com>

	* c-common.c (vector_size_helper): Make externally visible.
	* c-common.h (vector_size_helper): Add prototype.
	* hooks.c (hook_constcharptr_tree_null): New hook.
	* hooks.h (hook_constcharptr_tree_null): New prototype.
	* target-def.h (TARGET_MANGLE_VENDOR_TYPE): New target hook.
	* target.h (mangle_vendor_type): New target hook.
	* 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;
	wrap C++-specific portion of header with 'extern "C++"'.
	(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; 
tighten
	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: #include target.h.
	(rs6000_cpu_cpp_builtins): Pre-define '__vector', '__pixel' and 
'__bool'
	macros using '__attribute__((altivec(...)))'; enable C++ mangling of
	AltiVec types.
	* config/rs6000/rs6000-protos.h (rs6000_mangle_vendor_type): New
	prototype.
	* config/rs6000/rs6000.c (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): Print a full register name instead of merely its
	number.
	(rs6000_attribute_table): Add "altivec" attribute.
	(rs6000_handle_altivec_attribute, rs6000_mangle_vendor_type): New
	functions.
	* 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.
	* config/rs6000/t-rs6000 (rs6000-c.o): Depend on $(TARGET_H).

[gcc/cp/ChangeLog]
2004-01-12  Ziemowit Laski  <zlaski@apple.com>

	* Make-lang.in (cp/mangle.o): Depend on $(TARGET_H).
	* mangle.c (write_type): Add call to 'mangle_vendor_type'
	target hook.
	* tree.c (pod_type_p): Treat VECTOR_TYPEs as PODs.
	* typeck.c (build_static_cast, build_reinterpret_cast):
	Allow casts among VECTOR_TYPEs.

[gcc/testsuite/ChangeLog]
2004-01-12  Ziemowit Laski  <zlaski@apple.com>

	* g++.dg/ext/altivec-1.C: Generalize target triple/quadruple.
	* g++.dg/ext/altivec-[2-5].C: New test cases.
	* gcc.dg/altivec-[1-5].c: Generalize target triple/quadruple.
	* gcc.dg/altivec-6.c: New test case.
	* gcc.dg/altivec-[7-9].c: Generalize target triple/quadruple; add
	type casts as needed.
	* gcc.dg/altivec-10.c: Likewise; use AltiVec register names instead
	of numbers in assembly; add type casts as needed.
	* gcc.dg/altivec-12.c: New test case.
	* gcc.dg/altivec-varargs-1.c: Generalize target triple/quadruple.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: altivec-20040112.diff.gz
Type: application/x-gzip
Size: 42442 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040113/4b26280c/attachment.bin>
-------------- next part --------------

--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477


More information about the Gcc-patches mailing list