Stricter implicit conversions between vectors, revised patch

Mark Shinwell shinwell@codesourcery.com
Thu Dec 21 16:57:00 GMT 2006


This patch is a revised version of the one in the thread "Patch for stricter
implicit conversions between vectors" back in November.  It addresses
recent concerns raised by Andrew Pinski, removing unnecessary modifications
from altivec.h and using comptypes from vector_types_convertible_p.  It also
adds documentation for -flax-vector-conversions and correctly fixes up
DejaGNU directives for certain testcases.

Whilst doing these modifications I noticed that comptypes_internal contains
logic that I believe needs updating as well; see the patch below.  Here I
have opted to define that compatibility and implicit convertibility for
vector types coincide, which I think is reasonable given how implicit
convertibility for these vector types is now checked (see patch).

Paulo, there is an outstanding modification to altivec.h -- see below -- of
which I am suspicious.  For some reason __builtin_altivec_vcmpgefp is
still being defined as returning vector signed int even though, as far as
I can see, it should be returning vector bool int as required for the
return type of vec_cmple.  Do you know what might be going on here (and
is it reasonable in any case to define vec_cmple in terms of
__builtin_vec_cmpge)?

This patch exhibits no changes in testsuite results with all default
languages on x86_64-unknown-linux-gnu.  I haven't quite reached this
on powerpc64-unknown-linux-gnu but I think the only outstanding problem
is due to this vcmpgefp issue.

Is this ok to apply once we have resolved that and obtained clean results
on powerpc64?

Mark

--


2006-12-21  Mark Shinwell  <shinwell@codesourcery.com>

	gcc/
	* c.opt: Add -flax-vector-conversions.
	* c-typeck.c (convert_for_assignment): Pass flag to
	vector_types_convertible_p to allow emission of note.
	(digest_init): Likewise.
	(comptypes_internal): Use vector_types_convertible_p.
	* c-opts.c: Handle -flax-vector-conversions.
	* c-common.c (flag_lax_vector_conversions): New.
	(vector_types_convertible_p): Unless -flax-vector conversions
	has been passed, disallow conversions between vectors with
	differing numbers of subparts and/or element types.  If such
	a conversion is disallowed, possibly emit a note on the first
	occasion only to inform the user of -flax-vector-conversions.
	The new last argument specifies this.
	* c-common.h (flag_lax_vector_conversions): New.
	(vector_types_convertible_p): Add extra argument.
	* config/i386/i386.c (ix86_init_mmx_sse_builtins): Use
	char_type_node for V*QI type vectors.
	* config/rs6000/rs6000-c.c (altivec_overloaded_builtins):
	Update to satisfy new typechecking rules.
	* config/rs6000/altivec.h (vec_cmple): Use vec_cmpge.
	* doc/invoke.texi (C Dialect Options): Document
	-flax-vector-conversions.

	gcc/cp/
	* call.c (standard_conversion): Pass flag to
	vector_types_convertible_p to disallow emission of note.
	* typeck.c (convert_for_assignment): Pass flag to
	vector_types_convertible_p to allow emission of note.
	(ptr_reasonably_similar): Pass flag to vector_types_convertible_p
	to disallow emission of note.

	gcc/testsuite/
	* gcc.target/i386/20020531-1.c: Use "char" not "unsigned char"
	in __v8qi typedef.
	* gcc.target/powerpc/altivec-vec-merge.c (foo): Add casts.
	* gcc.dg/simd-1.c: Update dg-error directives to reflect new
	compiler behaviour.
	* gcc.dg/simd-5.c: Likewise.
	* gcc.dg/simd-6.c: Likewise.
	* g++.dg/conversion/simd1.C: Likewise.
	* g++.dg/conversion/simd3.C: Likewise.
	* g++.dg/ext/attribute-test-2.C (data): Add "vs" member.
	(main): Use it.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vector-tightening-revised.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061221/3c209910/attachment.ksh>


More information about the Gcc-patches mailing list