From patchwork Mon Aug 22 23:13:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [i386] : Use AVX FP instructions in libgcc soft-fp exception handler Date: Mon, 22 Aug 2011 13:13:09 -0000 From: Uros Bizjak X-Patchwork-Id: 111023 Message-Id: To: gcc-patches@gcc.gnu.org Hello! 2011-08-23 Uros Bizjak * config/i386/64/sfp-machine.h (ASM_INVALID): New define. (ASM_DIVZERO): Ditto. (FP_HANLDE_EXCEPTIONS): Use ASM_INVALID and ASM_DIVZERO. Tested on x86_64-pc-linux-gnu {,-m32}. Committed to mainline SVN, will be backported to release branches. Uros. Index: config/i386/64/sfp-machine.h =================================================================== --- config/i386/64/sfp-machine.h (revision 177972) +++ config/i386/64/sfp-machine.h (working copy) @@ -73,17 +73,25 @@ unsigned short int __unused5; }; +#ifdef __AVX__ + #define ASM_INVALID "vdivss %0, %0, %0" + #define ASM_DIVZERO "vdivss %1, %0, %0" +#else + #define ASM_INVALID "divss %0, %0" + #define ASM_DIVZERO "divss %1, %0" +#endif + #define FP_HANDLE_EXCEPTIONS \ do { \ if (_fex & FP_EX_INVALID) \ { \ float f = 0.0; \ - __asm__ __volatile__ ("divss %0, %0 " : : "x" (f)); \ + __asm__ __volatile__ (ASM_INVALID : : "x" (f)); \ } \ if (_fex & FP_EX_DIVZERO) \ { \ float f = 1.0, g = 0.0; \ - __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g)); \ + __asm__ __volatile__ (ASM_DIVZERO : : "x" (f), "x" (g)); \ } \ if (_fex & FP_EX_OVERFLOW) \ { \