--- old/usr/src/lib/libm/common/m9x/fenv_inlines.h	2014-05-04 03:06:24.742450005 +0200
+++ new/usr/src/lib/libm/common/m9x/fenv_inlines.h	2014-05-04 03:06:24.772096466 +0200
@@ -42,13 +42,12 @@
 extern __inline__ void
 __fenv_getcwsw(unsigned int *value)
 {
-	union fp_cwsw ret;
+	union fp_cwsw *u = (union fp_cwsw *)value;
 
 	__asm__ __volatile__(
 	    "fstsw %0\n\t"
 	    "fstcw %1\n\t"
-	    : "=m" (ret.words.cw), "=m" (ret.words.sw));
-	*value = ret.cwsw;
+	    : "=m" (u->words.cw), "=m" (u->words.sw));
 }
 
 extern __inline__ void
@@ -66,7 +65,7 @@
 	    "fldenv %0\n\t"
 	    "fwait\n\t"
 	    : "=m" (fenv), "=m" (fenv[0]), "=m" (fenv[2])
-	    : "d" (cwsw.words.cw), "c" (cwsw.words.sw)
+	    : "r" (cwsw.words.cw), "r" (cwsw.words.sw)
 	    /* For practical purposes, we clobber the whole FPU */
 	    : "cc", "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)",
 	      "st(6)", "st(7)");
@@ -75,7 +74,7 @@
 extern __inline__ void
 __fenv_getmxcsr(unsigned int *value)
 {
-	__asm__ __volatile__("stmxcsr %1" : "+m" (*value));
+	__asm__ __volatile__("stmxcsr %0" : "=m" (*value));
 }
 
 extern __inline__ void
@@ -89,7 +88,7 @@
 {
 	long double ret;
 
-	__asm__ __volatile__("f2xm1" : "=t" (ret) : "0" (x));
+	__asm__ __volatile__("f2xm1" : "=t" (ret) : "0" (x) : "cc");
 	return (ret);
 }
 
@@ -98,7 +97,10 @@
 {
 	long double ret;
 
-	__asm__ __volatile__("fyl2x" : "=t" (ret): "0" (x), "u" (y) : "st(1)");
+	__asm__ __volatile__("fyl2x"
+	    : "=t" (ret)
+	    : "0" (x), "u" (y)
+	    : "st(1)", "cc");
 	return (ret);
 }
 
@@ -112,7 +114,10 @@
 	long double ret;
 	long double dummy;
 
-	__asm__ __volatile__("fptan" : "=t" (dummy), "=u" (ret) : "0" (x));
+	__asm__ __volatile__("fptan"
+	    : "=t" (dummy), "=u" (ret)
+	    : "0" (x)
+	    : "cc");
 	return (ret);
 }
 
@@ -124,35 +129,29 @@
 	__asm__ __volatile__("fpatan"
 	    : "=t" (ret)
 	    : "0" (y), "u" (x)
-	    : "st(1)");
+	    : "st(1)", "cc");
 	return (ret);
 }
 
 extern __inline__ long double
 fxtract(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("fxtract" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("fxtract" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ long double
 fprem1(long double idend, long double div)
 {
-	long double ret;
-
-	__asm__ __volatile__("fprem1" : "=t" (ret) : "0" (div), "u" (idend));
-	return (ret);
+	__asm__ __volatile__("fprem1" : "+t" (div) : "u" (idend) : "cc");
+	return (div);
 }
 
 extern __inline__ long double
 fprem(long double idend, long double div)
 {
-	long double ret;
-
-	__asm__ __volatile__("fprem" : "=t" (ret) : "0" (div), "u" (idend));
-	return (ret);
+	__asm__ __volatile__("fprem" : "+t" (div) : "u" (idend) : "cc");
+	return (div);
 }
 
 extern __inline__ long double
@@ -163,35 +162,29 @@
 	__asm__ __volatile__("fyl2xp1"
 	    : "=t" (ret)
 	    : "0" (x), "u" (y)
-	    : "st(1)");
+	    : "st(1)", "cc");
 	return (ret);
 }
 
 extern __inline__ long double
 fsqrt(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("fsqrt" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("fsqrt" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ long double
 fsincos(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("fsincos" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("fsincos" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ long double
 frndint(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("frndint" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("frndint" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ long double
@@ -199,26 +192,22 @@
 {
 	long double ret;
 
-	__asm__ __volatile__("fscale" : "=t" (ret) : "0" (y), "u" (x));
+	__asm__ __volatile__("fscale" : "=t" (ret) : "0" (y), "u" (x) : "cc");
 	return (ret);
 }
 
 extern __inline__ long double
 fsin(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("fsin" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("fsin" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ long double
 fcos(long double x)
 {
-	long double ret;
-
-	__asm__ __volatile__("fcos" : "=t" (ret) : "0" (x));
-	return (ret);
+	__asm__ __volatile__("fcos" : "+t" (x) : : "cc");
+	return (x);
 }
 
 extern __inline__ void
@@ -227,8 +216,9 @@
 	__asm__ __volatile__(
 	    "cmpeqss %2, %1\n\t"
 	    "movss   %1, %0"
-	    : "=m" (*i1)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
 }
 
 extern __inline__ void
@@ -237,8 +227,9 @@
 	__asm__ __volatile__(
 	    "cmpltss %2, %1\n\t"
 	    "movss   %1, %0"
-	    : "=m" (*i1)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
 }
 
 extern __inline__ void
@@ -247,8 +238,9 @@
 	__asm__ __volatile__(
 	    "cmpless %2, %1\n\t"
 	    "movss   %1, %0"
-	    : "=m" (*i1)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
 }
 
 extern __inline__ void
@@ -257,8 +249,9 @@
 	__asm__ __volatile__(
 	    "cmpunordss %2, %1\n\t"
 	    "movss      %1, %0"
-	    : "=m" (*i1)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*i1), "+x" (*f1)
+	    : "x" (*f2)
+	    : "cc");
 }
 
 extern __inline__ void
@@ -267,8 +260,8 @@
 	__asm__ __volatile__(
 	    "minss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
@@ -277,8 +270,8 @@
 	__asm__ __volatile__(
 	    "maxss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
@@ -287,8 +280,8 @@
 	__asm__ __volatile__(
 	    "addss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
@@ -297,8 +290,8 @@
 	__asm__ __volatile__(
 	    "subss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
@@ -307,8 +300,8 @@
 	__asm__ __volatile__(
 	    "mulss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
@@ -317,19 +310,20 @@
 	__asm__ __volatile__(
 	    "divss %2, %1\n\t"
 	    "movss %1, %0"
-	    : "=m" (*f3)
-	    : "x" (*f1), "x" (*f2));
+	    : "=m" (*f3), "+x" (*f1)
+	    : "x" (*f2));
 }
 
 extern __inline__ void
 sse_sqrtss(float *f1, float *f2)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "sqrtss %1, %%xmm0\n\t"
-	    "movss  %%xmm0, %0"
-	    : "=m" (*f2)
-	    : "m" (*f1)
-	    : "xmm0");
+	    "sqrtss %2, %1\n\t"
+	    "movss  %1, %0"
+	    : "=m" (*f2), "=x" (tmp)
+	    : "m" (*f1));
 }
 
 extern __inline__ void
@@ -348,79 +342,86 @@
 extern __inline__ void
 sse_cvtss2sd(float *f1, double *d1)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "cvtss2sd %1, %%xmm0\n\t"
-	    "movsd    %%xmm0, %0"
-	    : "=m" (*d1)
-	    : "m" (*f1)
-	    : "xmm0");
+	    "cvtss2sd %2, %1\n\t"
+	    "movsd    %1, %0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*f1));
 }
 
 extern __inline__ void
 sse_cvtsi2ss(int *i1, float *f1)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "cvtsi2ss %1, %%xmm0\n\t"
-	    "movss    %%xmm0, %0"
-	    : "=m" (*f1)
-	    : "m" (*i1)
-	    : "xmm0");
+	    "cvtsi2ss %2, %1\n\t"
+	    "movss    %1, %0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*i1));
 }
 
 extern __inline__ void
 sse_cvttss2si(float *f1, int *i1)
 {
+	int tmp;
+
 	__asm__ __volatile__(
-	    "cvttss2si %1, %%ecx\n\t"
-	    "movl      %%ecx, %0"
-	    : "=m" (*i1)
-	    : "m" (*f1)
-	    : "ecx");
+	    "cvttss2si %2, %1\n\t"
+	    "movl      %1, %0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*f1));
 }
 
 extern __inline__ void
 sse_cvtss2si(float *f1, int *i1)
 {
+	int tmp;
+
 	__asm__ __volatile__(
-	    "cvtss2si %1, %%ecx\n\t"
-	    "movl     %%ecx, %0"
-	    : "=m" (*i1)
-	    : "m" (*f1)
-	    : "ecx");
+	    "cvtss2si %2, %1\n\t"
+	    "movl     %1, %0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*f1));
 }
 
 #if defined(__amd64)
 extern __inline__ void
 sse_cvtsi2ssq(long long *ll1, float *f1)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "cvtsi2ssq %1, %%xmm0\n\t"
-	    "movss     %%xmm0, %0"
-	    : "=m" (*f1)
-	    : "m" (*ll1)
-	    : "xmm0");
+	    "cvtsi2ssq %2, %1\n\t"
+	    "movss     %1, %0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*ll1));
 }
 
 extern __inline__ void
 sse_cvttss2siq(float *f1, long long *ll1)
 {
+	uint64_t tmp;
+
 	__asm__ __volatile__(
-	    "cvttss2siq %1, %%rcx\n\t"
-	    "movq       %%rcx, %0"
-	    : "=m" (*ll1)
-	    : "m" (*f1)
-	    : "rcx");
+	    "cvttss2siq %2, %1\n\t"
+	    "movq       %1, %0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*f1));
 }
 
 extern __inline__ void
 sse_cvtss2siq(float *f1, long long *ll1)
 {
+	uint64_t tmp;
+
 	__asm__ __volatile__(
-	    "cvtss2siq %1, %%rcx\n\t"
-	    "movq      %%rcx, %0"
-	    : "=m" (*ll1)
-	    : "m" (*f1)
-	    : "rcx");
+	    "cvtss2siq %2, %1\n\t"
+	    "movq      %1, %0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*f1));
 }
 
 #endif
@@ -431,8 +432,8 @@
 	__asm__ __volatile__(
 	    "cmpeqsd %2,%1\n\t"
 	    "movsd   %1,%0"
-	    : "=m" (*ll1)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*ll1), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -441,8 +442,8 @@
 	__asm__ __volatile__(
 	    "cmpltsd %2,%1\n\t"
 	    "movsd   %1,%0"
-	    : "=m" (*ll1)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*ll1), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -451,8 +452,8 @@
 	__asm__ __volatile__(
 	    "cmplesd %2,%1\n\t"
 	    "movsd   %1,%0"
-	    : "=m" (*ll1)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*ll1), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -461,8 +462,8 @@
 	__asm__ __volatile__(
 	    "cmpunordsd %2,%1\n\t"
 	    "movsd      %1,%0"
-	    : "=m" (*ll1)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*ll1), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 
@@ -472,8 +473,8 @@
 	__asm__ __volatile__(
 	    "minsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -482,8 +483,8 @@
 	__asm__ __volatile__(
 	    "maxsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -492,8 +493,8 @@
 	__asm__ __volatile__(
 	    "addsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -502,8 +503,8 @@
 	__asm__ __volatile__(
 	    "subsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -512,8 +513,8 @@
 	__asm__ __volatile__(
 	    "mulsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2));
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
@@ -522,20 +523,20 @@
 	__asm__ __volatile__(
 	    "divsd %2,%1\n\t"
 	    "movsd %1,%0"
-	    : "=m" (*d3)
-	    : "x" (*d1), "x" (*d2)
-	    : "xmm0");
+	    : "=m" (*d3), "=x" (*d1)
+	    : "x" (*d2));
 }
 
 extern __inline__ void
 sse_sqrtsd(double *d1, double *d2)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "sqrtsd %1, %%xmm0\n\t"
-	    "movsd %%xmm0, %0"
-	    : "=m" (*d2)
-	    : "m" (*d1)
-	    : "xmm0");
+	    "sqrtsd %2, %1\n\t"
+	    "movsd %1, %0"
+	    : "=m" (*d2), "=x" (tmp)
+	    : "m" (*d1));
 }
 
 extern __inline__ void
@@ -553,117 +554,123 @@
 extern __inline__ void
 sse_cvtsd2ss(double *d1, float *f1)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "cvtsd2ss %1,%%xmm0\n\t"
-	    "movss    %%xmm0,%0"
-	    : "=m" (*f1)
-	    : "m" (*d1)
-	    : "xmm0");
+	    "cvtsd2ss %2,%1\n\t"
+	    "movss    %1,%0"
+	    : "=m" (*f1), "=x" (tmp)
+	    : "m" (*d1));
 }
 
-
 extern __inline__ void
 sse_cvtsi2sd(int *i1, double *d1)
 {
+	double tmp;
 	__asm__ __volatile__(
-	    "cvtsi2sd %1,%%xmm0\n\t"
-	    "movsd    %%xmm0,%0"
-	    : "=m" (*d1)
-	    : "m" (*i1)
-	    : "xmm0");
+	    "cvtsi2sd %2,%1\n\t"
+	    "movsd    %1,%0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*i1));
 }
 
 extern __inline__ void
 sse_cvttsd2si(double *d1, int *i1)
 {
+	int tmp;
+
 	__asm__ __volatile__(
-	    "cvttsd2si %1,%%ecx\n\t"
-	    "movl      %%ecx,%0"
-	    : "=m" (*i1)
-	    : "m" (*d1)
-	    : "ecx");
+	    "cvttsd2si %2,%1\n\t"
+	    "movl      %1,%0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*d1));
 }
 
 extern __inline__ void
 sse_cvtsd2si(double *d1, int *i1)
 {
+	int tmp;
+
 	__asm__ __volatile__(
-	    "cvtsd2si %1,%%ecx\n\t"
-	    "movl     %%ecx,%0"
-	    : "=m" (*i1)
-	    : "m" (*d1)
-	    : "ecx");
+	    "cvtsd2si %2,%1\n\t"
+	    "movl     %1,%0"
+	    : "=m" (*i1), "=r" (tmp)
+	    : "m" (*d1));
 }
 
 #if defined(__amd64)
 extern __inline__ void
 sse_cvtsi2sdq(long long *ll1, double *d1)
 {
+	double tmp;
+
 	__asm__ __volatile__(
-	    "cvtsi2sdq %1,%%xmm0\n\t"
-	    "movsd     %%xmm0,%0"
-	    : "=m" (*d1)
-	    : "m" (*ll1)
-	    : "xmm0");
+	    "cvtsi2sdq %2,%1\n\t"
+	    "movsd     %1,%0"
+	    : "=m" (*d1), "=x" (tmp)
+	    : "m" (*ll1));
 }
 
 extern __inline__ void
 sse_cvttsd2siq(double *d1, long long *ll1)
 {
+	uint64_t tmp;
+
 	__asm__ __volatile__(
-	    "cvttsd2siq %1,%%rcx\n\t"
-	    "movq       %%rcx,%0"
-	    : "=m" (*ll1)
-	    : "m" (*d1)
-	    : "rcx");
+	    "cvttsd2siq %2,%1\n\t"
+	    "movq       %1,%0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*d1));
 }
 
 extern __inline__ void
 sse_cvtsd2siq(double *d1, long long *ll1)
 {
+	uint64_t tmp;
+
 	__asm__ __volatile__(
-	    "cvtsd2siq %1,%%rcx\n\t"
-	    "movq      %%rcx,%0"
-	    : "=m" (*ll1)
-	    : "m" (*d1)
-	    : "rcx");
+	    "cvtsd2siq %2,%1\n\t"
+	    "movq      %1,%0"
+	    : "=m" (*ll1), "=r" (tmp)
+	    : "m" (*d1));
 }
 #endif
+
 #elif defined(__sparc)
 extern __inline__ void
 __fenv_getfsr(unsigned long *l)
 {
-    __asm__ __volatile__(
+	__asm__ __volatile__(
 #if defined(__sparcv9)
-        "stx %%fsr,%0\n\t"
+		"stx %%fsr,%0\n\t"
 #else
-        "st  %%fsr,%0\n\t"
+		"st  %%fsr,%0\n\t"
 #endif
-        : "=m" (*l));
+		: "=m" (*l));
 }
 
 extern __inline__ void
 __fenv_setfsr(const unsigned long *l)
 {
-    __asm__ __volatile__(
+	__asm__ __volatile__(
 #if defined(__sparcv9)
-        "ldx %0,%%fsr\n\t"
+		"ldx %0,%%fsr\n\t"
 #else
-        "ld %0,%%fsr\n\t"
+		"ld %0,%%fsr\n\t"
 #endif
-        : : "m" (*l));
+		: : "m" (*l) : "cc");
 }
 
 extern __inline__ void
 __fenv_getfsr32(unsigned int *l)
 {
-    __asm__ __volatile__("st %%fsr,%0\n\t" : "=m" (*l));
+	__asm__ __volatile__("st %%fsr,%0\n\t" : "=m" (*l));
 }
 
 extern __inline__ void
 __fenv_setfsr32(const unsigned int *l)
 {
-    __asm__ __volatile__("ld %0,%%fsr\n\t" : : "m" (*l));
+	__asm__ __volatile__("ld %0,%%fsr\n\t" : : "m" (*l));
 }
 #else
 #error "GCC FENV inlines not implemented for this platform"
