/* Decimal floating point support.
- Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
- Foundation, Inc.
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of GCC.
decNumberFromString (dn, "nan", &set);
break;
case rvc_normal:
- gcc_assert (r->decimal);
+ if (!r->decimal)
+ {
+ /* dconst{1,2,m1,half} are used in various places in
+ the middle-end and optimizers, allow them here
+ as an exception by converting them to decimal. */
+ if (memcmp (r, &dconst1, sizeof (*r)) == 0)
+ {
+ decNumberFromString (dn, "1", &set);
+ break;
+ }
+ if (memcmp (r, &dconst2, sizeof (*r)) == 0)
+ {
+ decNumberFromString (dn, "2", &set);
+ break;
+ }
+ if (memcmp (r, &dconstm1, sizeof (*r)) == 0)
+ {
+ decNumberFromString (dn, "-1", &set);
+ break;
+ }
+ if (memcmp (r, &dconsthalf, sizeof (*r)) == 0)
+ {
+ decNumberFromString (dn, "0.5", &set);
+ break;
+ }
+ gcc_unreachable ();
+ }
decimal128ToNumber ((const decimal128 *) r->sig, dn);
break;
default: