This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Fix PR middle-end/30789, complex math folding via MPC


From: "Joseph S. Myers" <joseph@codesourcery.com>

On Fri, 14 Aug 2009, Kaveh R. GHAZI wrote:

The Annex G special cases only occur in cases where NaN is returned. Since
GCC's MPC infrastructure already backs out when encountering NaN values,
using MPC here means folding doesn't occur and the correct Annex G values
are calculated by libgcc at runtime.

These cases still need to work in static initializers, so you may need to avoid the MPC infrastructure backing out when evaluating static initializers, and add tests of them to your testcase.

+  /* This becomes (NaN + iInf).  */
+#define VAL1 ((_Complex double)__builtin_inf() * 1i)
+
+  /* Test some C99 Annex G special cases.  */
+  TEST_ONE_PART_INF ((VAL1) * (VAL1));
+  TEST_ONE_PART_INF ((_Complex double)1 / (_Complex double)0);
+  TEST_ONE_PART_INF ((VAL1) / (_Complex double)1);

I don't see a test of the ((_Complex double) 1 / (VAL1)) example I gave (that should produce a zero).

Thanks for catching these, I'll address these in a followup patch. (The new behavior is guarded by HAVE_mpc so no one is affected right now.)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]