<div dir="ltr"><div>Thanks, HJ.<br></div>I posted a question here:<br><a href="https://groups.google.com/forum/?hl=en#!topic/x86-64-abi/k9lgQogMZqw">https://groups.google.com/forum/?hl=en#!topic/x86-64-abi/k9lgQogMZqw</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 16, 2015 at 10:13 AM, H.J. Lu <span dir="ltr"><<a href="mailto:hjl.tools@gmail.com" target="_blank">hjl.tools@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Feb 16, 2015 at 8:40 AM, <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br>
> In <a href="http://reviews.llvm.org/D7614#124323" target="_blank">http://reviews.llvm.org/D7614#124323</a>, @spatel wrote:<br>
><br>
>> In <a href="http://reviews.llvm.org/D7614#124120" target="_blank">http://reviews.llvm.org/D7614#124120</a>, @hfinkel wrote:<br>
>><br>
>> > What happens when you try to pass a struct of { v4f32 x[2]; }?<br>
>><br>
>><br>
>> Great question. There's a check in classify() around here:<br>
>>  <a href="https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/TargetInfo.cpp#L2044" target="_blank">https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/TargetInfo.cpp#L2044</a><br>
>><br>
>>   // The only case a 256-bit wide vector could be used is when the struct<br>
>>   // contains a single 256-bit element. Since Lo and Hi logic isn't extended<br>
>>   // to work for sizes wider than 128, early check and fallback to memory.<br>
>>   //<br>
>>   if (Size > 128 && getContext().getTypeSize(i->getType()) != 256) {<br>
>><br>
>><br>
>> And so we don't try to pass/return anything in registers with an array of two 128-bit vectors.<br>
>><br>
>> And this also triggers on the even simpler case of:<br>
>>  struct v4f32_wrapper {<br>
>><br>
>>   v4f32 v1;<br>
>>   v4f32 v2;<br>
>><br>
>> };<br>
>><br>
>> Based on my reading of the ABI, I would've thought that could be passed as 2 xmm registers, but we pass by memory for this too. FWIW, gcc 4.9 and icc 15 do the same in these cases, so I think this is just the way things are supposed to be.<br>
><br>
><br>
> Okay, great. Please commit.<br>
><br>
> Also, if the ABI spec differs from implementation practice, we should also send a note to whomever maintains that and try to get it clarified.<br>
><br>
<br>
</div></div>All x86-64 psABI questions should go to<br>
<br>
<a href="https://groups.google.com/forum/#!forum/x86-64-abi" target="_blank">https://groups.google.com/forum/#!forum/x86-64-abi</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
H.J.<br>
</font></span></blockquote></div><br></div>