<div dir="ltr"><div>I see no errors with Clang 3.8, 3.9, 4.0 and GCC 5, 6, 7 on my Haswell Mac.  Try setting -std= appropriately, given that constexpr is a C++11 feature.</div><div><br></div><div>Jeff</div>







<p class="gmail-p1"><span class="gmail-s1">$</span><span class="gmail-s2"> cat v4si.cc</span></p>
<p class="gmail-p2"><span class="gmail-s1">typedef int v4si __attribute__ ((vector_size (16)));</span></p>
<p class="gmail-p3"><span class="gmail-s1"></span><br></p>
<p class="gmail-p2"><span class="gmail-s1">int main()</span></p>
<p class="gmail-p2"><span class="gmail-s1">{</span></p>
<p class="gmail-p2"><span class="gmail-s1"><span class="gmail-Apple-converted-space">    </span>constexpr v4si a = {1,2,3,4};</span></p>
<p class="gmail-p2"><span class="gmail-s1"><span class="gmail-Apple-converted-space">    </span>constexpr v4si b = {2,0,0,0};</span></p>
<p class="gmail-p2"><span class="gmail-s1"><span class="gmail-Apple-converted-space">    </span>v4si c = a + b;</span></p>
<p class="gmail-p2"><span class="gmail-s1">}</span></p>
<p class="gmail-p3"><span class="gmail-s1"></span><br></p>
<p class="gmail-p2"><span class="gmail-s3">$</span><span class="gmail-s1"> for cxx in /usr/bin/clang++ /usr/local/Cellar/llvm/4.0.1/bin/clang++ /usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 /usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ g++-7 g++-6 g++-5 ; do $cxx<span class="gmail-Apple-converted-space">  </span>-std=c++1z v4si.cc && echo $cxx SUCCESS || echo $cxx FAIL ; done</span></p>
<p class="gmail-p2"><span class="gmail-s1">/usr/bin/clang++ SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">/usr/local/Cellar/llvm/4.0.1/bin/clang++ SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">/usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">/usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">g++-7 SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">g++-6 SUCCESS</span></p>
<p class="gmail-p2"><span class="gmail-s1">g++-5 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s1">$</span><span class="gmail-s2"> for cxx in /usr/bin/clang++ /usr/local/Cellar/llvm/4.0.1/bin/clang++ /usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 /usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ g++-7 g++-6 g++-5 ; do $cxx<span class="gmail-Apple-converted-space">  </span>-std=c++11 v4si.cc && echo $cxx SUCCESS || echo $cxx FAIL ; done</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm/4.0.1/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">g++-7 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">g++-6 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">g++-5 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s1">$</span><span class="gmail-s2"> for cxx in /usr/bin/clang++ /usr/local/Cellar/llvm/4.0.1/bin/clang++ /usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 /usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ g++-7 g++-6 g++-5 ; do $cxx<span class="gmail-Apple-converted-space">  </span>-std=c++14 v4si.cc && echo $cxx SUCCESS || echo $cxx FAIL ; done</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm/4.0.1/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm@3.8/3.8.1/bin/clang++-3.8 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">/usr/local/Cellar/llvm@3.9/3.9.1_1/bin/clang++ SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">g++-7 SUCCESS</span></p><p class="gmail-p1"><span class="gmail-s2">g++-6 SUCCESS</span></p><p class="gmail-p2"><span class="gmail-s1">






















</span></p><p class="gmail-p1"><span class="gmail-s2">g++-5 SUCCESS</span></p><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 29, 2017 at 5:45 AM, Tom Westerhout via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Greetings!<br>
<br>
<br>
This is my first post on this ML so, please, do tell me if I'm doing it<br>
wrong.<br>
<br>
I've noticed the following difference between GCC and Clang. Consider<br>
this piece of code<br>
<br>
```<br>
typedef int v4si __attribute__ ((vector_size (16)));<br>
<br>
int main()<br>
{<br>
    constexpr v4si a = {1,2,3,4};<br>
    constexpr v4si b = {2,0,0,0};<br>
    v4si c = a + b;<br>
}<br>
```<br>
<br>
It compiles cleanly with both GCC and Clang. However, if I try to make c<br>
constexpr, Clang tells me that operator+ on vectors is not constexpr. I'm<br>
wondering if there's a reason for that. There are no constrains from the<br>
Standard as these are intrinsics, so I see no reason why we couldn't<br>
allow constexpr code benefit from SIMD.<br>
<br>
<br>
Tom<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Jeff Hammond<br><a href="mailto:jeff.science@gmail.com" target="_blank">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/" target="_blank">http://jeffhammond.github.io/</a></div>
</div></div>