在 2025-02-05 21:33, Martin Storsjö 写道:
Ideally, we wouldn't need to use assembly for things like this;
ideally we should set -fno-builtin for the relevant source files.
However, with automake, it is not easy to set such an option
specifically for one individual file, and it is not possible to
activate specifically -fno-builtin with either a pragma or an
optimize attribute in the source files.

By the way, for GCC this can be done as

   ```
   double real_sin(double x) __MINGW_ASM_CALL(sin);
   double real_cos(double x) __MINGW_ASM_CALL(cos);

   void
   sincos(double x, double* psin, double* pcos)
     {
       *psin = real_sin(x);
       *pcos = real_sin(x);
     }
   ```

With GCC, `__MINGW_ASM_CALL` renames the symbol without affecting optimization. However, with Clang the symbol is renamed before the optimizer kicks in; the target function may be optimized or folded into a call to `sincos` itself which I think might not be safe.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to