<div dir="ltr">Yeah,  I do like how the 7.8 calling convention allows up to 6 Double args to go in registers.<div><br></div><div style>Thats a good idea actually, </div><div style><br></div><div style>so it&#39;d be adding </div>

<div style><br></div><div style><pre class="" style="background-color:rgb(247,247,247);border:1px solid rgb(215,215,215);margin-right:1.75em;margin-left:1.75em;padding:0.25em;overflow:auto;color:rgb(0,0,0);font-size:13px">

  // Pass in STG registers for  128bit simd vectors
  CCIfType&lt;[ v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
            CCIfSubtarget&lt;&quot;hasSSE1()&quot;,
            CCAssignToReg&lt;[XMM1, XMM2, XMM3, XMM4, XMM5, XMM6]&gt;&gt;&gt;,

// Pass in STG registers for first 7  256bit simd vectors
CCIfType&lt;[v32i8, v16i16, v8i32, v4i64, v8f32, v4f64],
                          CCIfSubtarget&lt;&quot;hasAVX()&quot;,
                          CCAssignToReg&lt;[YMM0, YMM1, YMM2, YMM3,
                                         YMM4, YMM5, YMM6]&gt;&gt;&gt;</pre></div><div class="gmail_extra"><br></div><div class="gmail_extra" style>to the X86_32 convention then. so floats and doubles would still be spilled to stack, but SIMD  (short vectors) could use the registers as applicable.</div>

<div class="gmail_extra" style><br></div><div class="gmail_extra" style>That would preserve calling convention compatibility, but still allow adding SIMD to 32bit x86.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>

<br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>If that&#39;d be kosher / looks good, please indicate so on the ghc trac ticket, so i can fold this into the patch on the llvm-commits list post haste. Would rather not have it be a whole separate patch</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 8, 2013 at 6:22 PM, Geoffrey Mainland <span dir="ltr">&lt;<a href="mailto:mainland@apeiron.net" target="_blank">mainland@apeiron.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We would like code compiled with the LLVM back-end that doesn&#39;t use SIMD<br>
vectors to inter-operate with code compiled with the native codegen. The<br>
native codegen passes floating point arguments on the stack, so if we<br>
changed the GHC LLVM calling convention to pass Floats and Doubles in<br>
registers, we would need to change the native codegen to do the same.<br>
<br>
Or are you suggesting that we only pass SIMD short-vectors in the xmm<br>
registers on x86?<br>
<br>
I changed the calling convention (for both back-ends) when I did the<br>
SIMD work. It was a lucky accident that I didn&#39;t have to patch LLVM.<br>
<br>
Geoff<br>
<div class="HOEnZb"><div class="h5"><br>
On 07/08/2013 07:57 PM, Carter Schonwald wrote:<br>
&gt; Hey All,<br>
&gt; Is there any reasons *not* to add SSE / AVX register support  to the<br>
llvm 32 bit x86 ghc calling convention? It looks like (as with x86_64)<br>
that adding additional simd registers to the calling convention would be<br>
fully backwards compatible with current ghc approach to 32bit function<br>
calls, but would allow ghc 32bit (at some future point) to have decent<br>
floating point performance when applicable.<br>
&gt;<br>
&gt; I&#39;m ok either way, but would be helpful to get some opinions.<br>
&gt;<br>
&gt; just to recap, i&#39;m working on getting a patch sorted out for adding<br>
AVX support to the ghc x86_64 LLVM calling convention<br>
<a href="http://ghc.haskell.org/trac/ghc/ticket/8033" target="_blank">http://ghc.haskell.org/trac/ghc/ticket/8033</a>, and now would be a good<br>
time to add anything to the 32bit x86 calling convention<br>
&gt;<br>
&gt; thanks<br>
&gt; -Carter<br>
<br>
</div></div></blockquote></div><br></div></div>