on the floating-point control register.
-/* $OpenBSD: fenv.c,v 1.6 2022/12/27 17:10:07 jmc Exp $ */
+/* $OpenBSD: fenv.c,v 1.7 2023/01/27 16:43:33 miod Exp $ */
/*
* Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
u.bits[0] &= ~(excepts << _MASK_SHIFT);
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m" (u.fpsr));
return (0);
}
u.bits[0] |= (*flagp & excepts) << _MASK_SHIFT;
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m" (u.fpsr));
return (0);
}
u.bits[0] |= round;
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m"(u.fpsr));
return (0);
}
/* Mask all exceptions */
u.bits[0] &= ~FE_ALL_EXCEPT;
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m"(u.fpsr));
return (0);
}
(FE_ALL_EXCEPT << _MASK_SHIFT));
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m"(u.fpsr));
return (0);
}
u.bits[0] |= mask;
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m"(u.fpsr));
return (omask);
u.bits[0] &= ~mask;
/* Load the floating-point status register */
- __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr));
+ __asm__ volatile ("fldd 0(%0), %%fr0" : : "r" (&u.fpsr), "m"(u.fpsr));
return (omask);
}
-/* $OpenBSD: s_ceil.c,v 1.10 2016/09/12 19:47:01 guenther Exp $ */
+/* $OpenBSD: s_ceil.c,v 1.11 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = (ofpsr & ~((u_int64_t)FP_RM << (9 + 32))) |
((u_int64_t)FP_RP << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,dbl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (ofpsr));
return (x);
}
DEF_STD(ceil);
-/* $OpenBSD: s_ceilf.c,v 1.8 2016/09/12 19:47:01 guenther Exp $ */
+/* $OpenBSD: s_ceilf.c,v 1.9 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = (ofpsr & ~((u_int64_t)FP_RM << (9 + 32))) |
((u_int64_t)FP_RP << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,sgl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (ofpsr));
return (x);
}
DEF_STD(ceilf);
-/* $OpenBSD: s_floor.c,v 1.12 2016/09/12 19:47:01 guenther Exp $ */
+/* $OpenBSD: s_floor.c,v 1.13 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = ofpsr | ((u_int64_t)FP_RM << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,dbl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (fpsr));
return (x);
}
DEF_STD(floor);
-/* $OpenBSD: s_floorf.c,v 1.10 2016/09/12 19:47:01 guenther Exp $ */
+/* $OpenBSD: s_floorf.c,v 1.11 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = ofpsr | ((u_int64_t)FP_RM << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,sgl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (ofpsr));
return (x);
}
DEF_STD(floorf);
-/* $OpenBSD: s_trunc.c,v 1.8 2016/09/12 19:47:02 guenther Exp $ */
+/* $OpenBSD: s_trunc.c,v 1.9 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = (ofpsr & ~((u_int64_t)FP_RM << (9 + 32))) |
((u_int64_t)FP_RZ << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,dbl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (ofpsr));
return (x);
}
DEF_STD(trunc);
-/* $OpenBSD: s_truncf.c,v 1.5 2015/01/20 04:41:01 krw Exp $ */
+/* $OpenBSD: s_truncf.c,v 1.6 2023/01/27 16:43:33 miod Exp $ */
/*
* Written by Michael Shalayeff. Public Domain
*/
{
u_int64_t ofpsr, fpsr;
- __asm__ volatile("fstds %%fr0,0(%0)" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fstds %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
fpsr = (ofpsr & ~((u_int64_t)FP_RM << (9 + 32))) |
((u_int64_t)FP_RZ << (9 + 32));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&fpsr), "m" (fpsr));
__asm__ volatile("frnd,sgl %0,%0" : "+f" (x));
- __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr) : "memory");
+ __asm__ volatile("fldds 0(%0), %%fr0" :: "r" (&ofpsr), "m" (ofpsr));
return (x);
}