This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix ACATS cxa5a09 & cxa5a10 on x86/x86-64


The assembly code of Ada.Numerics.Aux.Logarithmic_Pow was clobbering %st(2).

Tested on i586-suse-linux and x86_64-suse-linux, applied to mainline.


2007-09-10  Eric Botcazou  <ebotcazou@adacore.com>

        * a-numaux-x86.adb (Logarithmic_Pow): Do not silently clobber
	x87 registers.


-- 
Eric Botcazou
Index: a-numaux-x86.adb
===================================================================
--- a-numaux-x86.adb	(revision 128261)
+++ a-numaux-x86.adb	(working copy)
@@ -302,15 +302,14 @@ package body Ada.Numerics.Aux is
    begin
       Asm (Template => ""             --  X                  : Y
        & "fyl2x                " & NL --  Y * Log2 (X)
-       & "fst     %%st(1)      " & NL --  Y * Log2 (X)       : Y * Log2 (X)
+       & "fld     %%st(0)      " & NL --  Y * Log2 (X)       : Y * Log2 (X)
        & "frndint              " & NL --  Int (...)          : Y * Log2 (X)
        & "fsubr   %%st, %%st(1)" & NL --  Int (...)          : Fract (...)
        & "fxch                 " & NL --  Fract (...)        : Int (...)
        & "f2xm1                " & NL --  2**Fract (...) - 1 : Int (...)
        & "fld1                 " & NL --  1 : 2**Fract (...) - 1 : Int (...)
        & "faddp   %%st, %%st(1)" & NL --  2**Fract (...)     : Int (...)
-       & "fscale               " & NL --  2**(Fract (...) + Int (...))
-       & "fstp    %%st(1)      ",
+       & "fscale               ",     --  2**(Fract (...) + Int (...))
          Outputs  => Double'Asm_Output ("=t", Result),
          Inputs   =>
            (Double'Asm_Input  ("0", X),

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]