Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On Tue, 13 Mar 2018, NightStrike wrote: Well, if it'd be inline functions in a header, I'd be inclined to agree. All of these are in non-inline functions (e.g. like the sqrt function, where you expect it to always produce one "fsqrt" instruction), so I don't expect any losses there. Is that always the case? I'm pretty sure that if they compiler can deduce any optimization, it'll take it. For instance, if it knows you want the square root of 4, it'll remove the instruction entirely and just use the number 2. Well, consider this: static inline double foo(double x) { double out; asm(/* math procedure */ :"=t"(out) :"0"(x)); return out; } void func(double x) { double y = foo(x); ... double z = foo(x); } If the asm is nonvolatile, I think the compiler could conclude that z and y will be identical and only expand the asm once. However, if the asm is volatile, it also means that the asm could have other side effects and can't be moved or omitted, but forcing the compiler to always emit it exactly where it's invoked. Or that's at least my understanding of the matter. Therefore, for cases when we have an implementation of a function in a standalone translation unit, volatile shouldn't really matter. But for public functions in headers, functions that can be inlined, volatile makes it potentially less efficient, inhibiting some optimizations. But our headers currently have all the corresponding inline asm in math.h marked as volatile. Theoretically, if everything is right (and if bugs like the clang bug I ran into were fixed), I think it should be fine to remove. But who knows how many other subtle issues it could cause or other lingering bugs it could expose. // Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
> > Well, if it'd be inline functions in a header, I'd be inclined to agree. > All of these are in non-inline functions (e.g. like the sqrt function, > where you expect it to always produce one "fsqrt" instruction), so I > don't expect any losses there. > Is that always the case? I'm pretty sure that if they compiler can deduce any optimization, it'll take it. For instance, if it knows you want the square root of 4, it'll remove the instruction entirely and just use the number 2. There's also unsafe math optimizations to consider. > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On Mon, 12 Mar 2018, Martin Storsjö wrote: On Sun, 11 Mar 2018, David Grayson wrote: Martell, did you send a bug report to clang too? That seems like a serious bug for them to have. I didn't send one yet, but I will. It's curious as it seems to work fine for x86_64 though. I reported the issue here, fwiw: https://bugs.llvm.org/show_bug.cgi?id=36698 // Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
No worries :) Just wanted to make sure you knew who you were talking to. On Mon 12 Mar 2018 at 13:55, David Grayson wrote: > Sorry to both of you. My brain just messed up there and I only > realized when it was too late. > > --David > > On Mon, Mar 12, 2018 at 1:37 PM, Martell Malone > wrote: > > Just so you are aware that is Martin not Martell. > > Not sure if that was just an autocorrect or a typo but Martin is the one > > doing this work here. > > > > On Mon 12 Mar 2018 at 12:20, Martin Storsjö wrote: > > > >> On Mon, 12 Mar 2018, Martin Storsjö wrote: > >> > >> > On Sun, 11 Mar 2018, David Grayson wrote: > >> > > >> >> Martell, did you send a bug report to clang too? That seems like a > >> >> serious bug for them to have. > >> > > >> > I didn't send one yet, but I will. It's curious as it seems to work > fine > >> for > >> > x86_64 though. > >> > > >> >> Also, "asm volatile" statements cannot be removed, reordered or > >> >> cached, right? It seems like a bad idea to hamper GCC's > optimizations > >> >> and performance as a workaround for a clang bug. > >> > > >> > Well, if it'd be inline functions in a header, I'd be inclined to > agree. > >> All > >> > of these are in non-inline functions (e.g. like the sqrt function, > where > >> you > >> > expect it to always produce one "fsqrt" instruction), so I don't > expect > >> any > >> > losses there. > >> > > >> > However, I do see a few instances of similar inline asm snippets in > >> math.h, > >> > and there, volatile indeed would be suboptimal. > >> > >> Actually, it seems like volatile already is specified in all the > >> corresponding cases in math.h. > >> > >> // Martin > >> > >> > -- > >> Check out the vibrant tech community on one of the world's most > >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot > >> ___ > >> Mingw-w64-public mailing list > >> Mingw-w64-public@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > >> > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > ___ > > Mingw-w64-public mailing list > > Mingw-w64-public@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
Sorry to both of you. My brain just messed up there and I only realized when it was too late. --David On Mon, Mar 12, 2018 at 1:37 PM, Martell Malone wrote: > Just so you are aware that is Martin not Martell. > Not sure if that was just an autocorrect or a typo but Martin is the one > doing this work here. > > On Mon 12 Mar 2018 at 12:20, Martin Storsjö wrote: > >> On Mon, 12 Mar 2018, Martin Storsjö wrote: >> >> > On Sun, 11 Mar 2018, David Grayson wrote: >> > >> >> Martell, did you send a bug report to clang too? That seems like a >> >> serious bug for them to have. >> > >> > I didn't send one yet, but I will. It's curious as it seems to work fine >> for >> > x86_64 though. >> > >> >> Also, "asm volatile" statements cannot be removed, reordered or >> >> cached, right? It seems like a bad idea to hamper GCC's optimizations >> >> and performance as a workaround for a clang bug. >> > >> > Well, if it'd be inline functions in a header, I'd be inclined to agree. >> All >> > of these are in non-inline functions (e.g. like the sqrt function, where >> you >> > expect it to always produce one "fsqrt" instruction), so I don't expect >> any >> > losses there. >> > >> > However, I do see a few instances of similar inline asm snippets in >> math.h, >> > and there, volatile indeed would be suboptimal. >> >> Actually, it seems like volatile already is specified in all the >> corresponding cases in math.h. >> >> // Martin >> >> -- >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> ___ >> Mingw-w64-public mailing list >> Mingw-w64-public@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public >> > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
Just so you are aware that is Martin not Martell. Not sure if that was just an autocorrect or a typo but Martin is the one doing this work here. On Mon 12 Mar 2018 at 12:20, Martin Storsjö wrote: > On Mon, 12 Mar 2018, Martin Storsjö wrote: > > > On Sun, 11 Mar 2018, David Grayson wrote: > > > >> Martell, did you send a bug report to clang too? That seems like a > >> serious bug for them to have. > > > > I didn't send one yet, but I will. It's curious as it seems to work fine > for > > x86_64 though. > > > >> Also, "asm volatile" statements cannot be removed, reordered or > >> cached, right? It seems like a bad idea to hamper GCC's optimizations > >> and performance as a workaround for a clang bug. > > > > Well, if it'd be inline functions in a header, I'd be inclined to agree. > All > > of these are in non-inline functions (e.g. like the sqrt function, where > you > > expect it to always produce one "fsqrt" instruction), so I don't expect > any > > losses there. > > > > However, I do see a few instances of similar inline asm snippets in > math.h, > > and there, volatile indeed would be suboptimal. > > Actually, it seems like volatile already is specified in all the > corresponding cases in math.h. > > // Martin > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On Mon, 12 Mar 2018, Martin Storsjö wrote: On Sun, 11 Mar 2018, David Grayson wrote: Martell, did you send a bug report to clang too? That seems like a serious bug for them to have. I didn't send one yet, but I will. It's curious as it seems to work fine for x86_64 though. Also, "asm volatile" statements cannot be removed, reordered or cached, right? It seems like a bad idea to hamper GCC's optimizations and performance as a workaround for a clang bug. Well, if it'd be inline functions in a header, I'd be inclined to agree. All of these are in non-inline functions (e.g. like the sqrt function, where you expect it to always produce one "fsqrt" instruction), so I don't expect any losses there. However, I do see a few instances of similar inline asm snippets in math.h, and there, volatile indeed would be suboptimal. Actually, it seems like volatile already is specified in all the corresponding cases in math.h. // Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On Sun, 11 Mar 2018, David Grayson wrote: Martell, did you send a bug report to clang too? That seems like a serious bug for them to have. I didn't send one yet, but I will. It's curious as it seems to work fine for x86_64 though. Also, "asm volatile" statements cannot be removed, reordered or cached, right? It seems like a bad idea to hamper GCC's optimizations and performance as a workaround for a clang bug. Well, if it'd be inline functions in a header, I'd be inclined to agree. All of these are in non-inline functions (e.g. like the sqrt function, where you expect it to always produce one "fsqrt" instruction), so I don't expect any losses there. However, I do see a few instances of similar inline asm snippets in math.h, and there, volatile indeed would be suboptimal. I'll see what I can do about the bug on the clang side, and maybe revert this patch after that. // Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
Martell, did you send a bug report to clang too? That seems like a serious bug for them to have. Also, "asm volatile" statements cannot be removed, reordered or cached, right? It seems like a bad idea to hamper GCC's optimizations and performance as a workaround for a clang bug. --David On Sun, Mar 11, 2018 at 3:16 PM, Martin Storsjö wrote: > On Sun, 11 Mar 2018, Kai Tietz via Mingw-w64-public wrote: > >> Patch is ok. > > > Thanks, pushed. > > // Martin > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On Sun, 11 Mar 2018, Kai Tietz via Mingw-w64-public wrote: Patch is ok. Thanks, pushed. // Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
Patch is ok. Thanks, Kai 2018-03-11 21:57 GMT+01:00 Martin Storsjö : > On 32 bit x86, clang seems to miss loading input parameters based > on asm constraints for inline assembly that uses the x87 floating > registers, unless the snippet has got the volatile keyword. > > Signed-off-by: Martin Storsjö > --- > mingw-w64-crt/math/fabs.c| 2 +- > mingw-w64-crt/math/fabsf.c | 2 +- > mingw-w64-crt/math/fabsl.c | 2 +- > mingw-w64-crt/math/modf.c| 4 ++-- > mingw-w64-crt/math/modff.c | 4 ++-- > mingw-w64-crt/math/modfl.c | 4 ++-- > mingw-w64-crt/math/sqrt.def.h| 10 +- > mingw-w64-crt/math/x86/acosf.c | 3 ++- > mingw-w64-crt/math/x86/acosl.c | 3 ++- > mingw-w64-crt/math/x86/asinf.c | 3 ++- > mingw-w64-crt/math/x86/asinl.c | 3 ++- > mingw-w64-crt/math/x86/atan2.c | 2 +- > mingw-w64-crt/math/x86/atan2f.c | 2 +- > mingw-w64-crt/math/x86/atan2l.c | 2 +- > mingw-w64-crt/math/x86/atanf.c | 3 ++- > mingw-w64-crt/math/x86/atanl.c | 3 ++- > mingw-w64-crt/math/x86/exp.def.h | 3 ++- > mingw-w64-crt/math/x86/fmod.c| 3 ++- > mingw-w64-crt/math/x86/fmodf.c | 3 ++- > mingw-w64-crt/math/x86/fmodl.c | 3 ++- > mingw-w64-crt/math/x86/logb.c| 3 ++- > mingw-w64-crt/math/x86/logbf.c | 3 ++- > mingw-w64-crt/math/x86/logbl.c | 3 ++- > mingw-w64-crt/math/x86/pow.def.h | 6 +++--- > 24 files changed, 46 insertions(+), 33 deletions(-) > > diff --git a/mingw-w64-crt/math/fabs.c b/mingw-w64-crt/math/fabs.c > index 2011378..a663711 100644 > --- a/mingw-w64-crt/math/fabs.c > +++ b/mingw-w64-crt/math/fabs.c > @@ -14,7 +14,7 @@ fabs (double x) > #elif defined(__i386__) || defined(_X86_) >double res = 0.0; > > - asm ("fabs;" : "=t" (res) : "0" (x)); > + asm volatile ("fabs;" : "=t" (res) : "0" (x)); >return res; > #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || > defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ > } > diff --git a/mingw-w64-crt/math/fabsf.c b/mingw-w64-crt/math/fabsf.c > index e8520d5..e7e9d8f 100644 > --- a/mingw-w64-crt/math/fabsf.c > +++ b/mingw-w64-crt/math/fabsf.c > @@ -12,7 +12,7 @@ fabsf (float x) >return __builtin_fabsf (x); > #elif defined(__i386__) || defined(_X86_) >float res = 0.0F; > - asm ("fabs;" : "=t" (res) : "0" (x)); > + asm volatile ("fabs;" : "=t" (res) : "0" (x)); >return res; > #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || > defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ > } > diff --git a/mingw-w64-crt/math/fabsl.c b/mingw-w64-crt/math/fabsl.c > index 20b8b22..1df48cf 100644 > --- a/mingw-w64-crt/math/fabsl.c > +++ b/mingw-w64-crt/math/fabsl.c > @@ -10,7 +10,7 @@ fabsl (long double x) > { > #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || > defined(_X86_) >long double res = 0.0L; > - asm ("fabs;" : "=t" (res) : "0" (x)); > + asm volatile ("fabs;" : "=t" (res) : "0" (x)); >return res; > #elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || > defined(_ARM64_) >return __builtin_fabsl (x); > diff --git a/mingw-w64-crt/math/modf.c b/mingw-w64-crt/math/modf.c > index f8ba64e..d262309 100644 > --- a/mingw-w64-crt/math/modf.c > +++ b/mingw-w64-crt/math/modf.c > @@ -13,7 +13,7 @@ modf (double value, double* iptr) >double int_part = 0.0; >/* truncate */ > #if defined(_AMD64_) || defined(__x86_64__) > - asm ("subq $8, %%rsp\n" > + asm volatile ("subq $8, %%rsp\n" > "fnstcw 4(%%rsp)\n" > "movzwl 4(%%rsp), %%eax\n" > "orb $12, %%ah\n" > @@ -23,7 +23,7 @@ modf (double value, double* iptr) > "fldcw 4(%%rsp)\n" > "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ > #elif defined(_X86_) || defined(__i386__) > - asm ("push %%eax\n\tsubl $8, %%esp\n" > + asm volatile ("push %%eax\n\tsubl $8, %%esp\n" > "fnstcw 4(%%esp)\n" > "movzwl 4(%%esp), %%eax\n" > "orb $12, %%ah\n" > diff --git a/mingw-w64-crt/math/modff.c b/mingw-w64-crt/math/modff.c > index 2c4de3e..dcf19cf 100644 > --- a/mingw-w64-crt/math/modff.c > +++ b/mingw-w64-crt/math/modff.c > @@ -14,7 +14,7 @@ modff (float value, float* iptr) >/* truncate */ >/* truncate */ > #if defined(_AMD64_) || defined(__x86_64__) > - asm ("subq $8, %%rsp\n" > + asm volatile ("subq $8, %%rsp\n" > "fnstcw 4(%%rsp)\n" > "movzwl 4(%%rsp), %%eax\n" > "orb $12, %%ah\n" > @@ -24,7 +24,7 @@ modff (float value, float* iptr) > "fldcw 4(%%rsp)\n" > "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ > #elif defined(_X86_) || defined(__i386__) > - asm ("push %%eax\n\tsubl $8, %%esp\n" > + asm volatile ("push %%eax\n\tsubl $8, %%esp\n" > "fnstcw 4(%%esp)\n" > "movzwl 4(%%esp), %%eax\n" > "orb $12, %%ah\n" > diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c > index ef1ab16..33593e6 100644 > --- a/mingw-w64-crt/math/modfl.c > +++ b/mingw-w64-crt/ma
[Mingw-w64-public] [PATCH] crt: Add "volatile" to all inline assembly snippets under math
On 32 bit x86, clang seems to miss loading input parameters based on asm constraints for inline assembly that uses the x87 floating registers, unless the snippet has got the volatile keyword. Signed-off-by: Martin Storsjö --- mingw-w64-crt/math/fabs.c| 2 +- mingw-w64-crt/math/fabsf.c | 2 +- mingw-w64-crt/math/fabsl.c | 2 +- mingw-w64-crt/math/modf.c| 4 ++-- mingw-w64-crt/math/modff.c | 4 ++-- mingw-w64-crt/math/modfl.c | 4 ++-- mingw-w64-crt/math/sqrt.def.h| 10 +- mingw-w64-crt/math/x86/acosf.c | 3 ++- mingw-w64-crt/math/x86/acosl.c | 3 ++- mingw-w64-crt/math/x86/asinf.c | 3 ++- mingw-w64-crt/math/x86/asinl.c | 3 ++- mingw-w64-crt/math/x86/atan2.c | 2 +- mingw-w64-crt/math/x86/atan2f.c | 2 +- mingw-w64-crt/math/x86/atan2l.c | 2 +- mingw-w64-crt/math/x86/atanf.c | 3 ++- mingw-w64-crt/math/x86/atanl.c | 3 ++- mingw-w64-crt/math/x86/exp.def.h | 3 ++- mingw-w64-crt/math/x86/fmod.c| 3 ++- mingw-w64-crt/math/x86/fmodf.c | 3 ++- mingw-w64-crt/math/x86/fmodl.c | 3 ++- mingw-w64-crt/math/x86/logb.c| 3 ++- mingw-w64-crt/math/x86/logbf.c | 3 ++- mingw-w64-crt/math/x86/logbl.c | 3 ++- mingw-w64-crt/math/x86/pow.def.h | 6 +++--- 24 files changed, 46 insertions(+), 33 deletions(-) diff --git a/mingw-w64-crt/math/fabs.c b/mingw-w64-crt/math/fabs.c index 2011378..a663711 100644 --- a/mingw-w64-crt/math/fabs.c +++ b/mingw-w64-crt/math/fabs.c @@ -14,7 +14,7 @@ fabs (double x) #elif defined(__i386__) || defined(_X86_) double res = 0.0; - asm ("fabs;" : "=t" (res) : "0" (x)); + asm volatile ("fabs;" : "=t" (res) : "0" (x)); return res; #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ } diff --git a/mingw-w64-crt/math/fabsf.c b/mingw-w64-crt/math/fabsf.c index e8520d5..e7e9d8f 100644 --- a/mingw-w64-crt/math/fabsf.c +++ b/mingw-w64-crt/math/fabsf.c @@ -12,7 +12,7 @@ fabsf (float x) return __builtin_fabsf (x); #elif defined(__i386__) || defined(_X86_) float res = 0.0F; - asm ("fabs;" : "=t" (res) : "0" (x)); + asm volatile ("fabs;" : "=t" (res) : "0" (x)); return res; #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ } diff --git a/mingw-w64-crt/math/fabsl.c b/mingw-w64-crt/math/fabsl.c index 20b8b22..1df48cf 100644 --- a/mingw-w64-crt/math/fabsl.c +++ b/mingw-w64-crt/math/fabsl.c @@ -10,7 +10,7 @@ fabsl (long double x) { #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) long double res = 0.0L; - asm ("fabs;" : "=t" (res) : "0" (x)); + asm volatile ("fabs;" : "=t" (res) : "0" (x)); return res; #elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) return __builtin_fabsl (x); diff --git a/mingw-w64-crt/math/modf.c b/mingw-w64-crt/math/modf.c index f8ba64e..d262309 100644 --- a/mingw-w64-crt/math/modf.c +++ b/mingw-w64-crt/math/modf.c @@ -13,7 +13,7 @@ modf (double value, double* iptr) double int_part = 0.0; /* truncate */ #if defined(_AMD64_) || defined(__x86_64__) - asm ("subq $8, %%rsp\n" + asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" "orb $12, %%ah\n" @@ -23,7 +23,7 @@ modf (double value, double* iptr) "fldcw 4(%%rsp)\n" "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ #elif defined(_X86_) || defined(__i386__) - asm ("push %%eax\n\tsubl $8, %%esp\n" + asm volatile ("push %%eax\n\tsubl $8, %%esp\n" "fnstcw 4(%%esp)\n" "movzwl 4(%%esp), %%eax\n" "orb $12, %%ah\n" diff --git a/mingw-w64-crt/math/modff.c b/mingw-w64-crt/math/modff.c index 2c4de3e..dcf19cf 100644 --- a/mingw-w64-crt/math/modff.c +++ b/mingw-w64-crt/math/modff.c @@ -14,7 +14,7 @@ modff (float value, float* iptr) /* truncate */ /* truncate */ #if defined(_AMD64_) || defined(__x86_64__) - asm ("subq $8, %%rsp\n" + asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" "orb $12, %%ah\n" @@ -24,7 +24,7 @@ modff (float value, float* iptr) "fldcw 4(%%rsp)\n" "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */ #elif defined(_X86_) || defined(__i386__) - asm ("push %%eax\n\tsubl $8, %%esp\n" + asm volatile ("push %%eax\n\tsubl $8, %%esp\n" "fnstcw 4(%%esp)\n" "movzwl 4(%%esp), %%eax\n" "orb $12, %%ah\n" diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c index ef1ab16..33593e6 100644 --- a/mingw-w64-crt/math/modfl.c +++ b/mingw-w64-crt/math/modfl.c @@ -13,7 +13,7 @@ modfl (long double value, long double* iptr) long double int_part = 0.0L; /* truncate */ #if defined(_AMD64_) || defined(__x86_64__) - asm ("subq $8, %%rsp\n" + asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" "orb $12, %%ah\n"