It has been discussed on the list recently:<div><br></div><div><a href="http://old.nabble.com/64bit-MRV-problem:-{-float,-float,-float}--">http://old.nabble.com/64bit-MRV-problem:-{-float,-float,-float}--</a>>-{-double,-float-}-td27304830.html<br>

<br></div><div>Best regards,</div><div>Victor</div><div><br><div class="gmail_quote">On 24 March 2010 13:24, Naoya Maruyama <span dir="ltr"><<a href="mailto:naoya.maruyama@gmail.com">naoya.maruyama@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Renato,<br>
<br>
Here's a sample code that is compiled as I wrote:<br>
<br>
-------------------------------------------------<br>
struct dim2<br>
{<br>
    float x;<br>
    float y;<br>
};<br>
<br>
struct dim2 kernel(struct dim2 *g)<br>
{<br>
    return *g;<br>
}<br>
-------------------------------------------------<br>
<br>
When this code is compiled with the clang command in the LLVM/Clang<br>
2.6 binary tarball:<br>
<br>
-------------------------------------------------<br>
$ clang --version<br>
clang version 1.0<br>
(<a href="https://llvm.org/svn/llvm-project/cfe/branches/release_26" target="_blank">https://llvm.org/svn/llvm-project/cfe/branches/release_26</a> exported)<br>
Target: x86_64-unknown-linux-gnu<br>
Thread model: posix<br>
$ clang -Wall -emit-llvm -S test.c -o -<br>
; ModuleID = 'test.c'<br>
target datalayout =<br>
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"<br>
target triple = "x86_64-unknown-linux-gnu"<br>
<br>
%struct.dim2 = type { float, float }<br>
<br>
define double @kernel(%struct.dim2* %g) nounwind {<br>
entry:<br>
  %retval = alloca %struct.dim2                   ; <%struct.dim2*> [#uses=2]<br>
  %g.addr = alloca %struct.dim2*                  ; <%struct.dim2**> [#uses=2]<br>
  store %struct.dim2* %g, %struct.dim2** %g.addr<br>
  %tmp = load %struct.dim2** %g.addr              ; <%struct.dim2*> [#uses=1]<br>
  %tmp1 = bitcast %struct.dim2* %retval to i8*    ; <i8*> [#uses=1]<br>
  %tmp2 = bitcast %struct.dim2* %tmp to i8*       ; <i8*> [#uses=1]<br>
  call void @llvm.memcpy.i64(i8* %tmp1, i8* %tmp2, i64 8, i32 4)<br>
  %0 = bitcast %struct.dim2* %retval to double*   ; <double*> [#uses=1]<br>
  %1 = load double* %0, align 1                   ; <double> [#uses=1]<br>
  ret double %1<br>
}<br>
<br>
declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind<br>
-------------------------------------------------<br>
<br>
What I want to see is the exactly same signature of the function named<br>
"kernel" as in the source code.<br>
<br>
Let me know if I'm doing anything wrong.<br>
<br>
Thanks,<br>
Naoya<br>
<br>
On Wed, Mar 24, 2010 at 8:58 PM, Renato Golin <<a href="mailto:rengolin@systemcall.org">rengolin@systemcall.org</a>> wrote:<br>
> On 24 March 2010 07:34, Naoya Maruyama <<a href="mailto:naoya.maruyama@gmail.com">naoya.maruyama@gmail.com</a>> wrote:<br>
>> However, for example, with Clang, if a function<br>
>> returns struct {float, float}, then the compiled function in the llvm<br>
>> bitcode returns a double that aggregates the two floats.<br>
><br>
> It's completely wrong to convert { float, float } into double. Just<br>
> because they have the same size doesn't mean they're identical.<br>
><br>
> Can you give us a simple example where this occurs?<br>
><br>
><br>
> --<br>
> cheers,<br>
> --renato<br>
><br>
> <a href="http://systemcall.org/" target="_blank">http://systemcall.org/</a><br>
><br>
> Reclaim your digital rights, eliminate DRM, learn more at<br>
> <a href="http://www.defectivebydesign.org/what_is_drm" target="_blank">http://www.defectivebydesign.org/what_is_drm</a><br>
><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>