diff mbox

[committed] Work around bug in powf function on HP-UX

Message ID 20130218164557.GA2332@hiauly1.hia.nrc.ca
State New
Headers show

Commit Message

John David Anglin Feb. 18, 2013, 4:45 p.m. UTC
The powf function on HP-UX incorrectly clobbers floating point register
%fr12.  It is supposed to be saved and restored by callee.  The patch
marks the register(s) as call used on HP-UX.  We still save and restore
the register is the prologue/epilogue, so the runtime isn't changed.

Tested on hppa2.0w-hp-hpux11 and hppa64-hp-hpux11.11.  Committed to
trunk.

Dave
diff mbox

Patch

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 196122)
+++ config/pa/pa.c	(working copy)
@@ -10313,6 +10313,21 @@ 
 {
   int i;
 
+  if (TARGET_HPUX)
+    {
+      /* Work around powf bug in libm.  */
+      if (TARGET_64BIT)
+	{
+	  /* Mark %fr12 as call used.  */
+	  call_used_regs[40] = 1;
+	}
+      else
+	{
+	  /* Mark %fr12 and %fr12R as call used.  */
+	  call_used_regs[48] = 1;
+	  call_used_regs[49] = 1;
+	}
+    }
   if (!TARGET_64BIT && !TARGET_PA_11)
     {
       for (i = 56; i <= FP_REG_LAST; i++)