Implicit conversions between vectors

2006-10-12 Thread Mark Shinwell
Currently we permit implicit conversions between vectors whose total bitsizes are equal but which are divided into differing numbers of subparts. It seems that in some circumstances this rule is overly lax. For example the following code, using vector types (whose definitions I have provided

Re: Implicit conversions between vectors

2006-10-12 Thread Paolo Bonzini
This lack of type safety is unsettling, and I wonder if it should be fixed with a patch along the lines of the (not yet fully tested) one below. Does that sound reasonable? It seems right to try to fix the generic code here, even though the testcase in hand is target-specific. If this approac

Re: Implicit conversions between vectors

2006-10-12 Thread Andrew Pinski
On Thu, 2006-10-12 at 13:03 +0100, Mark Shinwell wrote: > typedef __builtin_neon_qi int8x8_t __attribute__ ((__vector_size__ (8))); > typedef __builtin_neon_hi int16x4_t __attribute__ ((__vector_size__ (8))); > ... > > int8x8_t f (int16x4_t a) > { >return a; > } This should error out

Re: Implicit conversions between vectors

2006-10-12 Thread Mark Shinwell
Andrew Pinski wrote: On Thu, 2006-10-12 at 13:03 +0100, Mark Shinwell wrote: typedef __builtin_neon_qi int8x8_t __attribute__ ((__vector_size__ (8))); typedef __builtin_neon_hi int16x4_t __attribute__ ((__vector_size__ (8))); ... int8x8_t f (int16x4_t a) { return a; } This should

Re: Implicit conversions between vectors

2006-10-12 Thread Ian Lance Taylor
Mark Shinwell <[EMAIL PROTECTED]> writes: > Here, the compiler is not complaining about an attempt to implicitly > convert a vector of four 16-bit quantities to a vector of eight > 8-bit quantities. > > This lack of type safety is unsettling, and I wonder if it should be fixed > with a patch alon

Re: Implicit conversions between vectors

2006-10-12 Thread Mark Shinwell
Ian Lance Taylor wrote: I believe that the problem with changing this unconditionally is that the Altivec programming guidelines specify the rules which gcc currently follows: you are permitted to assign one vector variable to another, without an explicit cast, when the vectors are the same size.

Re: Implicit conversions between vectors

2006-10-12 Thread Andrew Pinski
On Thu, 2006-10-12 at 08:02 -0700, Ian Lance Taylor wrote: > It's been this way at least since 4.0. But it was rejected in 3.4.0. > I believe that the problem with changing this unconditionally is that > the Altivec programming guidelines specify the rules which gcc > currently follows: you are pe

Even stricter implicit conversions between vectors

2006-10-31 Thread Mark Shinwell
Recently I proposed that implicit conversions between vectors with differing numbers of elements yet the same total bitlength be disallowed. It was agreed that this was reasonable, and I shall be submitting a patch to vector_types_convertible_p and the testsuite in the near future. I would now

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Ian Lance Taylor
Mark Shinwell <[EMAIL PROTECTED]> writes: > I would now like to propose that the check in that function be made > even stronger such that it disallows conversions between vectors > whose element types differ -- even if an implicit conversion exists > between those element types. As far as I can s

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Mike Stump
On Oct 31, 2006, at 10:47 AM, Mark Shinwell wrote: What do others think? My only concern is that we have tons of customers with tons of code and you don't have any and that you break their code. I don't have any idea if this would be the case or not, I don't usually do the vector bugs.

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Mark Shinwell
Ian Lance Taylor wrote: Mark Shinwell <[EMAIL PROTECTED]> writes: I would now like to propose that the check in that function be made even stronger such that it disallows conversions between vectors whose element types differ -- even if an implicit conversion exists between those element types.

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Andrew Pinski
> > Recently I proposed that implicit conversions between vectors with > differing numbers of elements yet the same total bitlength be disallowed. > It was agreed that this was reasonable, and I shall be submitting a > patch to vector_types_convertible_p and the testsuite in

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Andrew Pinski
> > and that you break their code. > > ...is more of a concern, I agree, and is what I worry about most. The other question how of this was accepted in 3.4.0 or earlier because the behavior changed in 4.0.0 with respect of accepting these code. Thanks, Andrew Pinski

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Paul Brook
On Tuesday 31 October 2006 19:02, Mike Stump wrote: > On Oct 31, 2006, at 10:47 AM, Mark Shinwell wrote: > > What do others think? > > My only concern is that we have tons of customers with tons of code > and you don't have any and that you break their code. I don't have > any idea if this would b

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Andrew Pinski
> > On Oct 31, 2006, at 10:47 AM, Mark Shinwell wrote: > > What do others think? > > My only concern is that we have tons of customers with tons of code > and you don't have any and that you break their code. I don't have > any idea if this would be the case or not, I don't usually do the

Re: Even stricter implicit conversions between vectors

2006-10-31 Thread Mike Stump
On Oct 31, 2006, at 11:52 AM, Andrew Pinski wrote: #define vector __attribute__((vector_size(16) )) vector int f(vector int, vector unsigned int); int g(void) { vector int t; vector int t1; vector unsigned int t2; t2 = f(t,t1); } Our 3.3 compiler gives: t.c:10: error: incompatible ty

Re: Even stricter implicit conversions between vectors

2006-11-01 Thread Ian Ollmann
Assuming I understand the proposal properly, this sounds to me like it amounts reversing the change we experienced in the Apple GCC from 3.3 -> 4.0. Type checking became a lot more lax for us in 4.0. We use AltiVec very heavily. From experience in cases when our 4.0 code had to be back

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Paolo Bonzini
Ian Ollmann wrote: Assuming I understand the proposal properly, this sounds to me like it amounts reversing the change we experienced in the Apple GCC from 3.3 -> 4.0. Type checking became a lot more lax for us in 4.0. This was a bug and has been fixed recently. I cannot recall if the fix

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Mark Shinwell
Paolo Bonzini wrote: Ian Ollmann wrote: Assuming I understand the proposal properly, this sounds to me like it amounts reversing the change we experienced in the Apple GCC from 3.3 -> 4.0. Type checking became a lot more lax for us in 4.0. This was a bug and has been fixed recently. I ca

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Mark Shinwell
Ian Ollmann wrote: stronger type checking seems like a good idea to me in general. I agree, but I don't really want to break lots of code all at once, even if that code is being slightly more slack than it perhaps ought to be :-) Given that no-one has really objected to stronger type-checking

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Paolo Bonzini
Assuming I understand the proposal properly, this sounds to me like it amounts reversing the change we experienced in the Apple GCC from 3.3 -> 4.0. Type checking became a lot more lax for us in 4.0. This was a bug and has been fixed recently. I cannot recall if the fix has been backporte

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Mark Shinwell
Paolo Bonzini wrote: Assuming I understand the proposal properly, this sounds to me like it amounts reversing the change we experienced in the Apple GCC from 3.3 -> 4.0. Type checking became a lot more lax for us in 4.0. This was a bug and has been fixed recently. I cannot recall if the fi

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Ian Lance Taylor
Mark Shinwell <[EMAIL PROTECTED]> writes: > Ian Ollmann wrote: > > stronger type checking seems like a good idea to me in general. > > I agree, but I don't really want to break lots of code all at once, > even if that code is being slightly more slack than it perhaps ought > to be :-) > > Given

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Ian Ollmann
On Nov 2, 2006, at 5:33 AM, Mark Shinwell wrote: Ian Ollmann wrote: stronger type checking seems like a good idea to me in general. I agree, but I don't really want to break lots of code all at once, even if that code is being slightly more slack than it perhaps ought to be :-) Given that n

Re: Even stricter implicit conversions between vectors

2006-11-02 Thread Mark Shinwell
Ian Lance Taylor wrote: I would vote for: break the code, but provide an option to restore the old behaviour, and mention the option in the error message. I like this -- I shall prepare a patch and circulate it for review. Mark