It seems to me that the test case in test/Sema/vector-cast.c looks incorrect. 
According to gcc’s documentation, you can cast vectors to and from scalars of 
the same size, so clang shouldn’t reject “double += <1 x double>".

https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html 
<https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html>

It is possible to cast from one vector type to another, provided they are of 
the same size (in fact, you can also cast vectors to and from other datatypes 
of the same size).


> On Sep 6, 2016, at 3:09 PM, Akira Hatanaka <ahatan...@apple.com> wrote:
> 
> This is urgent, so I’ve tried to come up with a patch to fix this. I tried 
> reverting r278501 and then made changes to have Sema::CheckVectorOperands 
> call tryVectorConvertAndSplat when the vector type is a normal gcc vector. 
> This fixes the test case I sent and also doesn’t affect the regression tests 
> except that clang prints different error messages in a few cases and doesn’t 
> print an expected diagnostic in one case, which is line 63 of 
> test/Sema/vector-cast.c. We currently expect clang to print a diagnostic when 
> we have a compound assignment like “double += <1 X double>”, but my patch 
> makes clang accept it.
> 
>> On Sep 5, 2016, at 6:36 AM, Vladimir Yakovlev via cfe-commits 
>> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote:
>> 
>> I'll fix this.
>> 
>> 
>> 
>> Vladimir
>> 
>> 
>> 
>> -----------------------------------------------------------------------------------
>> 
>> From: Akira Hatanaka <ahata...@gmail.com <mailto:ahata...@gmail.com>>
>> Date: Fri, Sep 2, 2016 at 3:00 AM
>> Subject: Re: [PATCH] D21678: Fix For pr28288 - Error message in shift of 
>> vector values
>> To: vladimi...@gmail.com <mailto:vladimi...@gmail.com>, 
>> ulrich.weig...@de.ibm.com <mailto:ulrich.weig...@de.ibm.com>, 
>> amjad.ab...@intel.com <mailto:amjad.ab...@intel.com>, guy.ben...@intel.com 
>> <mailto:guy.ben...@intel.com>, aaron.ball...@gmail.com 
>> <mailto:aaron.ball...@gmail.com>
>> Cc: ahata...@gmail.com <mailto:ahata...@gmail.com>, andreybokha...@gmail.com 
>> <mailto:andreybokha...@gmail.com>, anastasia.stul...@arm.com 
>> <mailto:anastasia.stul...@arm.com>, dmitry.poluk...@gmail.com 
>> <mailto:dmitry.poluk...@gmail.com>, cfe-commits@lists.llvm.org 
>> <mailto:cfe-commits@lists.llvm.org>
>> 
>> 
>> ahatanak added a subscriber: ahatanak.
>> ahatanak added a comment.
>> 
>> This patch causes clang to error out on the following code, which used to 
>> compile fine:
>> 
>> $ cat f2.c
>> 
>>   typedef __attribute__((__ext_vector_type__(8))) unsigned short 
>> vector_ushort8;
>> 
>>   vector_ushort8 foo1(void) {
>>     return 1 << (vector_ushort8){7,6,5,4,3,2,1,0};
>>   }
>> 
>> $ clang f2.c -c
>> 
>> clang used to transform the scaler operand to a vector operand (similar to 
>> the way gcc's vector is handled) when compiling for normal c/c++ (but 
>> printed an error message when compiling for opencl), but this patch dropped 
>> the check for LangOpts added in r230464 and changed that behavior. I don't 
>> think this was intentional?
>> 
>> 
>> 
>> Repository:
>>   rL LLVM
>> 
>> https://reviews.llvm.org/D21678 <https://reviews.llvm.org/D21678>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to