* gcc.target/i386/sse4_1-round.h (do_round): Fix inline asm statements.
* gcc.target/i386/sse4_1-roundsd-4.c (do_round): Ditto.
* gcc.target/i386/sse4_1-roundss-4.c (do_round): Ditto.
From-SVN: r231418
+2015-12-08 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/sse4_1-round.h (do_round): Fix inline asm statements.
+ * gcc.target/i386/sse4_1-roundsd-4.c (do_round): Ditto.
+ * gcc.target/i386/sse4_1-roundss-4.c (do_round): Ditto.
+
2015-12-08 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/sso-9.c (foo): Robustify trick.
static FP_T
do_round (FP_T f, int type)
{
- short saved_cw, new_cw, clr_mask;
+ unsigned short saved_cw, new_cw, clr_mask;
FP_T ret;
if ((type & 4))
clr_mask = ~0x0C3F;
}
- __asm__ ("fld" ASM_SUFFIX " %0" : : "m" (*&f));
+ __asm__ ("fnstcw %0" : "=m" (saved_cw));
- __asm__ ("fstcw %0" : "=m" (*&saved_cw));
new_cw = saved_cw & clr_mask;
new_cw |= type;
- __asm__ ("fldcw %0" : : "m" (*&new_cw));
- __asm__ ("frndint\n"
- "fstp" ASM_SUFFIX " %0\n" : "=m" (*&ret));
- __asm__ ("fldcw %0" : : "m" (*&saved_cw));
+ __asm__ ("fldcw %2\n\t"
+ "frndint\n\t"
+ "fldcw %3" : "=t" (ret)
+ : "0" (f), "m" (new_cw), "m" (saved_cw));
return ret;
}
static double
do_round (double f, int type)
{
- short saved_cw, new_cw, clr_mask;
+ unsigned short saved_cw, new_cw, clr_mask;
double ret;
if ((type & 4))
clr_mask = ~0x0C3F;
}
- __asm__ ("fldl %0" : : "m" (*&f));
+ __asm__ ("fnstcw %0" : "=m" (saved_cw));
- __asm__ ("fstcw %0" : "=m" (*&saved_cw));
new_cw = saved_cw & clr_mask;
new_cw |= type;
- __asm__ ("fldcw %0" : : "m" (*&new_cw));
- __asm__ ("frndint\n"
- "fstpl %0\n" : "=m" (*&ret));
- __asm__ ("fldcw %0" : : "m" (*&saved_cw));
+ __asm__ ("fldcw %2\n\t"
+ "frndint\n\t"
+ "fldcw %3" : "=t" (ret)
+ : "0" (f), "m" (new_cw), "m" (saved_cw));
return ret;
}
static float
do_round (float f, int type)
{
- short saved_cw, new_cw, clr_mask;
+ unsigned short saved_cw, new_cw, clr_mask;
float ret;
if ((type & 4))
clr_mask = ~0x0C3F;
}
- __asm__ ("flds %0" : : "m" (*&f));
+ __asm__ ("fnstcw %0" : "=m" (saved_cw));
- __asm__ ("fstcw %0" : "=m" (*&saved_cw));
new_cw = saved_cw & clr_mask;
new_cw |= type;
- __asm__ ("fldcw %0" : : "m" (*&new_cw));
- __asm__ ("frndint\n"
- "fstps %0\n" : "=m" (*&ret));
- __asm__ ("fldcw %0" : : "m" (*&saved_cw));
+ __asm__ ("fldcw %2\n\t"
+ "frndint\n\t"
+ "fldcw %3" : "=t" (ret)
+ : "0" (f), "m" (new_cw), "m" (saved_cw));
return ret;
}