tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] x86-64 floating point arguments use the wrong registe


From: Michael Matz
Subject: Re: [Tinycc-devel] x86-64 floating point arguments use the wrong registers
Date: Mon, 21 Mar 2016 16:34:01 +0100 (CET)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)

Hi,

On Sun, 20 Mar 2016, Phillip McNallen wrote:

> Functions with floating point arguments(in x86-64) don't use the proper 
> calling convention.
> 
> Float values should be passed in XMM0 - XMM3
> 
> double sum(double a, double b)  { 
>     return (a+b); 
> }
> 
> Generates this:
> mov         qword ptr [rbp+10h],rcx  
> mov         qword ptr [rbp+18h],rdx  
> movq        xmm0,mmword ptr [rbp+10h]  
> addsd       xmm0,mmword ptr [rbp+18h]  

Which TCC version?  Current mob branch generates correct code (for linux 
and windows):

   b:   movq   %xmm0,-0x8(%rbp)
  10:   movq   %xmm1,-0x10(%rbp)
  15:   movq   -0x8(%rbp),%xmm0
  1a:   addsd  -0x10(%rbp),%xmm0


Ciao,
Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]