r309722 - [Sema] Fix lax conversion between non ext vectors

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 16:55:55 PDT 2017


On Tue, Aug 1, 2017 at 4:41 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> I assume there's an implied "merge to 5.0 branch?" question here :)

Yes :-) I lost that part somehow.

>
> Yes, horrible as lax vector conversions are, we shouldn't accidentally
> regress support for them.

r309770. Thanks.

>
>
> On 1 August 2017 at 16:28, Hans Wennborg via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>>
>> Sounds good to me. Richard, what do you think?
>>
>> On Tue, Aug 1, 2017 at 12:05 PM, Bruno Cardoso Lopes via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>> > Author: bruno
>> > Date: Tue Aug  1 12:05:25 2017
>> > New Revision: 309722
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=309722&view=rev
>> > Log:
>> > [Sema] Fix lax conversion between non ext vectors
>> >
>> > r282968 introduced a regression due to the lack of proper testing.
>> > Re-add lax conversion support between non ext vectors for compound
>> > assignments and add a test for that.
>> >
>> > rdar://problem/28639467
>> >
>> > Modified:
>> >     cfe/trunk/lib/Sema/SemaExpr.cpp
>> >     cfe/trunk/test/Sema/vector-cast.c
>> >
>> > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=309722&r1=309721&r2=309722&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Aug  1 12:05:25 2017
>> > @@ -8288,7 +8288,7 @@ QualType Sema::CheckVectorOperands(ExprR
>> >      // type. Note that this is already done by non-compound assignments
>> > in
>> >      // CheckAssignmentConstraints. If it's a scalar type, only bitcast
>> > for
>> >      // <1 x T> -> T. The result is also a vector type.
>> > -    } else if (OtherType->isExtVectorType() ||
>> > +    } else if (OtherType->isExtVectorType() ||
>> > OtherType->isVectorType() ||
>> >                 (OtherType->isScalarType() && VT->getNumElements() ==
>> > 1)) {
>> >        ExprResult *RHSExpr = &RHS;
>> >        *RHSExpr = ImpCastExprToType(RHSExpr->get(), LHSType,
>> > CK_BitCast);
>> >
>> > Modified: cfe/trunk/test/Sema/vector-cast.c
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vector-cast.c?rev=309722&r1=309721&r2=309722&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/Sema/vector-cast.c (original)
>> > +++ cfe/trunk/test/Sema/vector-cast.c Tue Aug  1 12:05:25 2017
>> > @@ -48,6 +48,9 @@ typedef float float2 __attribute__ ((vec
>> >  typedef __attribute__((vector_size(8))) double float64x1_t;
>> >  typedef __attribute__((vector_size(16))) double float64x2_t;
>> >  float64x1_t vget_low_f64(float64x2_t __p0);
>> > +typedef float float16 __attribute__((__vector_size__(16)));
>> > +typedef signed int vSInt32 __attribute__((__vector_size__(16)));
>> > +typedef unsigned int vUInt32 __attribute__((__vector_size__(16)));
>> >
>> >  void f4() {
>> >    float2 f2;
>> > @@ -73,3 +76,8 @@ void f5() {
>> >    v = ptr; // expected-error-re {{assigning to 'short_sizeof_pointer'
>> > (vector of {{[0-9]+}} 'short' values) from incompatible type 'void *'}}
>> >    ptr = v; // expected-error {{assigning to 'void *' from incompatible
>> > type 'short_sizeof_pointer'}}
>> >  }
>> > +
>> > +void f6(vSInt32 a0) {
>> > +  vUInt32 counter = (float16){0.0f, 0.0f, 0.0f, 0.0f}; //
>> > expected-warning {{incompatible vector types initializing 'vUInt32' (vector
>> > of 4 'unsigned int' values) with an expression of type 'float16' (vector of
>> > 4 'float' values)}}
>> > +  counter -= a0;
>> > +}
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>


More information about the cfe-commits mailing list