From: Uros Bizjak Date: Tue, 8 Dec 2015 18:21:15 +0000 (+0100) Subject: sse4_1-round.h (do_round): Fix inline asm statements. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b8d93e55fb1a43538bcdfa81af1d7fd58617bd3;p=gcc.git sse4_1-round.h (do_round): Fix inline asm statements. * 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 669f69fb1ea..80f85c836e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-12-08 Uros Bizjak + + * 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 * gcc.dg/sso-9.c (foo): Robustify trick. diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-round.h b/gcc/testsuite/gcc.target/i386/sse4_1-round.h index 0210ac130b6..dfb0b778cdc 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-round.h +++ b/gcc/testsuite/gcc.target/i386/sse4_1-round.h @@ -28,7 +28,7 @@ init_round (FP_T *src) 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)) @@ -42,16 +42,15 @@ do_round (FP_T f, int type) 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; } diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c index 124f825021d..ff8b09eeba6 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c @@ -36,7 +36,7 @@ init_round (double *src) 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)) @@ -50,16 +50,15 @@ do_round (double f, int type) 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; } diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c index 71042d1b777..95488908630 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c @@ -36,7 +36,7 @@ init_round (float *src) 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)) @@ -50,16 +50,15 @@ do_round (float f, int type) 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; }