<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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>".<div class=""><br class=""></div><div class=""><a href="https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html" class="">https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html</a></div><div class=""><br class=""></div><div class=""><span style="font-family: -webkit-standard; font-size: medium; background-color: rgb(255, 255, 255);" class="">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).</span></div><div class=""><font face="-webkit-standard" size="3" class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></font><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 6, 2016, at 3:09 PM, Akira Hatanaka <<a href="mailto:ahatanaka@apple.com" class="">ahatanaka@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">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.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Sep 5, 2016, at 6:36 AM, Vladimir Yakovlev via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><p class="MsoNormal">I'll fix this.</p><p class="MsoNormal"><br class=""></p><p class="MsoNormal">Vladimir</p><p class="MsoNormal"><br class=""></p><p class="MsoNormal">-----------------------------------------------------------------------------------</p><p class="MsoNormal">From: <b class="">Akira Hatanaka</b> <<a href="mailto:ahatanak@gmail.com" class="">ahatanak@gmail.com</a>><br class="">
Date: Fri, Sep 2, 2016 at 3:00 AM<br class="">
Subject: Re: [PATCH] D21678: Fix For pr28288 - Error message in shift of vector
values<br class="">
To: <a href="mailto:vladimir.1@gmail.com" class="">vladimir.1@gmail.com</a>, <a href="mailto:ulrich.weigand@de.ibm.com" class="">ulrich.weigand@de.ibm.com</a>, <a href="mailto:amjad.aboud@intel.com" class="">amjad.aboud@intel.com</a>, <a href="mailto:guy.benyei@intel.com" class="">guy.benyei@intel.com</a>, <a href="mailto:aaron.ballman@gmail.com" class="">aaron.ballman@gmail.com</a><br class="">
Cc: <a href="mailto:ahatanak@gmail.com" class="">ahatanak@gmail.com</a>, <a href="mailto:andreybokhanko@gmail.com" class="">andreybokhanko@gmail.com</a>, <a href="mailto:anastasia.stulova@arm.com" class="">anastasia.stulova@arm.com</a>, <a href="mailto:dmitry.polukhin@gmail.com" class="">dmitry.polukhin@gmail.com</a>, <a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<br class="">
<br class="">
ahatanak added a subscriber: ahatanak.<br class="">
ahatanak added a comment.<br class="">
<br class="">
This patch causes clang to error out on the following code, which used to
compile fine:<br class="">
<br class="">
$ cat f2.c<br class="">
<br class="">
  typedef __attribute__((__ext_vector_type__(8))) unsigned short
vector_ushort8;<br class="">
<br class="">
  vector_ushort8 foo1(void) {<br class="">
    return 1 << (vector_ushort8){7,6,5,4,3,2,1,0};<br class="">
  }<br class="">
<br class="">
$ clang f2.c -c<br class="">
<br class="">
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?<span class=""></span></p>

<span style="font-size:12pt;font-family:"times new roman",serif" class=""><br class="">
<br class="">
Repository:<br class="">
  rL LLVM<br class="">
<br class="">
<a href="https://reviews.llvm.org/D21678" target="_blank" class="">https://reviews.llvm.org/D21678</a></span><br class=""></div>
_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>