aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/dfp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/dfp')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wbad-function-cast-1.c44
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wtraditional-conversion-2.c46
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/altivec-types.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/builtin-complex.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/cast-bad.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/composite-type.c55
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-c99.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-hex.c14
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c14
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-complex.c118
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c494
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round.c124
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/ctypes.c52
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/ddmode-ice.c54
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method-2.c20
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-dbg.h12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-except.h13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-round.h22
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp.exp65
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-binop.c105
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-check.h68
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-1.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-2.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-3.c45
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/float-constant-double.c20
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c89.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c99.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-ignored-c99.c15
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-pedantic.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-reserved.c16
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/operator-bitwise.c63
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr31344.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr37435.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr41049.c562
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48204.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48928.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr52140.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c85
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c86
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c83
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c45
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c46
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c46
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c39
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c174
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/struct-union.c62
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/typespec.c302
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/union-init.c58
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c49
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/dfp/wtr-conversion-1.c75
54 files changed, 3509 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wbad-function-cast-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wbad-function-cast-1.c
new file mode 100644
index 000000000..99d8f0655
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wbad-function-cast-1.c
@@ -0,0 +1,44 @@
+/* Test operation of -Wbad-function-cast. */
+/* Based on gcc.dg/Wbad-function-cast-1.c. */
+
+/* { dg-do compile } */
+/* { dg-options "-Wbad-function-cast" } */
+
+int if1(void);
+char if2(void);
+long if3(void);
+float rf1(void);
+double rf2(void);
+_Decimal32 rf3(void);
+_Decimal64 rf4(void);
+_Decimal128 rf5(void);
+_Complex double cf(void);
+
+void
+foo(void)
+{
+ /* Casts to void types are always OK. */
+ (void)rf3();
+ (void)rf4();
+ (void)rf5();
+ (const void)rf3();
+ /* Casts to the same type or similar types are OK. */
+ (_Decimal32)rf1();
+ (_Decimal64)rf2();
+ (_Decimal128)rf3();
+ (_Decimal128)rf4();
+ (_Decimal128)rf5();
+ (float)rf3();
+ (double)rf4();
+ (long double)rf5();
+ /* Casts to types with different TREE_CODE (which is how this
+ warning has been defined) are not OK, except for casts to void
+ types. */
+ (_Decimal32)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Decimal32'" } */
+ (_Decimal64)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Decimal64'" } */
+ (_Decimal128)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Decimal128'" } */
+ (int)rf3(); /* { dg-warning "cast from function call of type '_Decimal32' to non-matching type 'int'" } */
+ (long)rf4(); /* { dg-warning "cast from function call of type '_Decimal64' to non-matching type 'long int'" } */
+ (long int)rf5(); /* { dg-warning "cast from function call of type '_Decimal128' to non-matching type 'long int'" } */
+ (_Decimal32)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Decimal32'" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wtraditional-conversion-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wtraditional-conversion-2.c
new file mode 100644
index 000000000..2436afc8a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/Wtraditional-conversion-2.c
@@ -0,0 +1,46 @@
+/* Test messages for -Wtraditional-conversion
+ (based on gcc.dg/Wtraditional-conversion-2.c). */
+
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional-conversion" } */
+
+void fsi(signed int);
+void fd32(_Decimal32);
+void fd64(_Decimal64);
+void fd128(_Decimal128);
+
+struct s {
+ void (*fsi)(signed int);
+ void (*fd32)(_Decimal32);
+ void (*fd64)(_Decimal64);
+ void (*fd128)(_Decimal128);
+} x;
+
+signed int si;
+unsigned int ui;
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+void
+g (void)
+{
+ fsi(d32); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */
+ x.fsi(d32); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */
+ fsi(d64); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */
+ x.fsi(d64); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */
+ fsi(d128); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */
+ x.fsi(d128); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */
+ fd32(si); /* { dg-warning "passing argument 1 of 'fd32' as floating rather than integer due to prototype" } */
+ x.fd32(si); /* { dg-warning "passing argument 1 of 'x.fd32' as floating rather than integer due to prototype" } */
+ fd64(ui); /* { dg-warning "passing argument 1 of 'fd64' as floating rather than integer due to prototype" } */
+ x.fd64(ui); /* { dg-warning "passing argument 1 of 'x.fd64' as floating rather than integer due to prototype" } */
+ fd128(si); /* { dg-warning "passing argument 1 of 'fd128' as floating rather than integer due to prototype" } */
+ x.fd128(ui); /* { dg-warning "passing argument 1 of 'x.fd128' as floating rather than integer due to prototype" } */
+ fd32(1.0); /* { dg-warning "passing argument 1 of 'fd32' as '_Decimal32' rather than 'double' due to prototype" } */
+ x.fd32(1.0); /* { dg-warning "passing argument 1 of 'x.fd32' as '_Decimal32' rather than 'double' due to prototype" } */
+ fd64(1.0); /* { dg-warning "passing argument 1 of 'fd64' as '_Decimal64' rather than 'double' due to prototype" } */
+ x.fd64(1.0); /* { dg-warning "passing argument 1 of 'x.fd64' as '_Decimal64' rather than 'double' due to prototype" } */
+ fd128(1.0); /* { dg-warning "passing argument 1 of 'fd128' as '_Decimal128' rather than 'double' due to prototype" } */
+ x.fd128(1.0); /* { dg-warning "passing argument 1 of 'x.fd128' as '_Decimal128' rather than 'double' due to prototype" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/altivec-types.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/altivec-types.c
new file mode 100644
index 000000000..e11ddc5e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/altivec-types.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_altivec_ok } } } */
+/* { dg-options "-maltivec" } */
+
+/* GNU extension: PowerPC AltiVec Built-in Functions.
+ These should be rejected as invalid AltiVec types. */
+
+__vector _Decimal32 vd32; /* { dg-error "AltiVec types" "" } */
+__vector _Decimal64 vd64; /* { dg-error "AltiVec types" "" } */
+__vector _Decimal128 vd128; /* { dg-error "AltiVec types" "" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/builtin-complex.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/builtin-complex.c
new file mode 100644
index 000000000..6bb2ec738
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/builtin-complex.c
@@ -0,0 +1,10 @@
+/* Test __builtin_complex errors with DFP. */
+/* { dg-do compile } */
+
+_Decimal32 a, b;
+
+void
+f (void)
+{
+ __builtin_complex (a, b); /* { dg-error "not of real binary floating-point type" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/cast-bad.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/cast-bad.c
new file mode 100644
index 000000000..e9e31ff30
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/cast-bad.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+
+/* C99 6.5.4 Cast operators.
+ Test invalid casts involving decimal float. */
+
+struct s { _Decimal32 d32; } sv;
+union u { _Decimal32 d32; } uv;
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+_Decimal32* d32p;
+_Decimal64* d64p;
+_Decimal128* d128p;
+
+void
+f (void)
+{
+ (_Decimal32 []) d32p; /* { dg-error "cast specifies array type" } */
+ (_Decimal32 ()) d32p; /* { dg-error "cast specifies function type" } */
+ (_Decimal64 []) d64p; /* { dg-error "cast specifies array type" } */
+ (_Decimal64 ()) d64p; /* { dg-error "cast specifies function type" } */
+ (_Decimal128 []) d128p; /* { dg-error "cast specifies array type" } */
+ (_Decimal128 ()) d128p; /* { dg-error "cast specifies function type" } */
+
+ (struct s) d32; /* { dg-error "conversion to non-scalar type requested" } */
+ (union u) d32;
+ (struct s) d64; /* { dg-error "conversion to non-scalar type requested" } */
+ (union u) d64; /* { dg-error "cast to union type from type not present in union" } */
+ (struct s) d128; /* { dg-error "conversion to non-scalar type requested" } */
+ (union u) d128; /* { dg-error "cast to union type from type not present in union" } */
+
+ (_Decimal32) sv; /* { dg-error "aggregate value used where a float was expected" } */
+ (_Decimal32) uv; /* { dg-error "aggregate value used where a float was expected" } */
+ (_Decimal64) sv; /* { dg-error "aggregate value used where a float was expected" } */
+ (_Decimal64) uv; /* { dg-error "aggregate value used where a float was expected" } */
+ (_Decimal128) sv; /* { dg-error "aggregate value used where a float was expected" } */
+ (_Decimal128) uv; /* { dg-error "aggregate value used where a float was expected" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/composite-type.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/composite-type.c
new file mode 100644
index 000000000..6bf35f5c9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/composite-type.c
@@ -0,0 +1,55 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wall -ftrack-macro-expansion=0" } */
+
+/* C99 6.2.7: Compatible type and composite type. */
+
+#define DECIMAL_COMPOSITE_DECL(TYPE) \
+ _Decimal##TYPE g1_##TYPE(); \
+ _Decimal##TYPE g2_##TYPE(); \
+ _Decimal##TYPE (*h1_##TYPE)[2]; \
+ _Decimal##TYPE (*h2_##TYPE)[3]; \
+ _Decimal##TYPE (*h3_##TYPE)[4]; \
+ _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)()); \
+ _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)(_Decimal##TYPE*)); \
+ _Decimal##TYPE f1_##TYPE (_Decimal##TYPE(*g)(_Decimal##TYPE*)) \
+ { \
+ _Decimal##TYPE d##TYPE; \
+ d##TYPE = ((_Decimal##TYPE (*) (_Decimal##TYPE*)) g)(&d##TYPE); \
+ d##TYPE = ((_Decimal##TYPE (*) ()) g); \
+ return d##TYPE; \
+ } \
+ _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[]); \
+ _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[3]);
+
+#define DECIMAL_COMPOSITE_TEST(TYPE) \
+do \
+{ \
+ _Decimal##TYPE d##TYPE; \
+ d##TYPE = f1_##TYPE(g1_##TYPE); \
+ d##TYPE = f1_##TYPE(g2_##TYPE); \
+ d##TYPE = f2_##TYPE(h1_##TYPE); \
+ d##TYPE = f2_##TYPE(h2_##TYPE); \
+ d##TYPE = f2_##TYPE(h3_##TYPE); \
+ (void) d##TYPE; \
+} while(0)
+
+DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 36 } */
+
+
+DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 40 } */
+
+
+DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 44 } */
+
+
+int main()
+{
+ DECIMAL_COMPOSITE_TEST(32); /* { dg-warning "incompatible pointer type" } */
+ DECIMAL_COMPOSITE_TEST(64); /* { dg-warning "incompatible pointer type" } */
+ DECIMAL_COMPOSITE_TEST(128); /* { dg-warning "incompatible pointer type" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-c99.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-c99.c
new file mode 100644
index 000000000..6a48bf501
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-c99.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -Wno-overflow" } */
+
+/* N1150 6: Constants.
+ C99 6.4.4.2: Floating constants. */
+
+_Decimal32 a = 1.1df; /* { dg-error "" } */
+_Decimal32 b = -.003DF; /* { dg-error "" } */
+_Decimal64 c = 11e-1dl; /* { dg-error "" } */
+_Decimal64 d = -.3DL; /* { dg-error "" } */
+_Decimal128 e = 000.3e0dl; /* { dg-error "" } */
+_Decimal128 f = 3000300030003e0DL; /* { dg-error "" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-hex.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-hex.c
new file mode 100644
index 000000000..980eae012
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-hex.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+/* N1150 6: Constants.
+ C99 6.4.4.2: Floating constants.
+
+ The df, dd, dl, DF, DD and DL suffixes shall not be used in a
+ hexadecimal-floating-constant. */
+
+_Decimal32 bad1 = 0x1.0p1df; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
+_Decimal32 bad2 = 0x1.0p1DF; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
+_Decimal64 bad3 = 0x2.0p-2dd; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
+_Decimal64 bad4 = 0x2.0p2DD; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
+_Decimal128 bad5 = 0x3.0p3dl; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
+_Decimal128 bad6 = 0x3.0p3DL; /* { dg-error "invalid suffix" "hexadecimal floating constant" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c
new file mode 100644
index 000000000..be81b0fc4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+
+/* N1150 6: Constants.
+ C99 6.4.4.2: Floating constants. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 a = 1.1df; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal32 b = -.003DF; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal64 c = 11e-1dl; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal64 d = -.3DL; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal128 e = 000.3e0dl; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal128 f = 3000300030003e0DL; /* { dg-warning "GCC extension|ISO C" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants.c
new file mode 100644
index 000000000..bb61ea335
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/constants.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+/* N1150 6: Constants.
+ C99 6.4.4.2: Floating constants. */
+
+_Decimal32 a = 1.1df;
+_Decimal32 b = -.003DF;
+_Decimal64 c = 11e-1dl;
+_Decimal64 d = -.3DL;
+_Decimal128 e = 000.3e0dl;
+_Decimal128 f = 3000300030003e0DL;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-complex.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-complex.c
new file mode 100644
index 000000000..76eef87cb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-complex.c
@@ -0,0 +1,118 @@
+/* { dg-options "-O3" } */
+
+/* N1150 5.3 Conversions between decimal floating and complex.
+ C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */
+
+#include "dfp-dbg.h"
+
+int
+main ()
+{
+ _Complex float cf;
+ _Complex double cd;
+ _Complex long double cld;
+
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ cf = 2.0f * __extension__ 1i + 3.0f;
+ cd = 2.0 * __extension__ 1i + 3.0;
+ cld = 2.0l * __extension__ 1i + 3.0l;
+
+ /* Convert complex to decimal floating. */
+ d32 = cf;
+ d64 = cd;
+ d128 = cld;
+
+ if (d32 != 3.0DF)
+ FAILURE
+ if (d64 != 3.0dd)
+ FAILURE
+ if (d128 != 3.0dl)
+ FAILURE
+
+ /* Convert decimal floating to complex. */
+ d32 = 2.5DF;
+ d64 = 1.5DD;
+ d128 = 2.5DL;
+
+ cf = d32;
+ cd = d64;
+ cld = d128;
+
+ /* N1107 5.3 Conversions between decimal floating and complex.
+ When a value of decimal floating type converted to a complex
+ type, the real part of the complex result value is undermined
+ by the rules of conversions in N1107 5.2 and the imaginary part
+ of the complex result value is zero. */
+
+ if (__real__ cf != 2.5f)
+ FAILURE
+ if (__real__ cd !=1.5)
+ FAILURE
+ if (__real__ cld != 2.5)
+ FAILURE
+ if (__imag__ cf != 0.0f)
+ FAILURE
+ if (__imag__ cd != 0.0)
+ FAILURE
+ if (__imag__ cld != 0.0l)
+ FAILURE
+
+ /* Verify that the conversions from DFP types to complex is
+ determined by the rules of conversion to the real part. */
+
+ /* Convert _Decimal64 to _Complex float. */
+ d64 = 0.125dl;
+ cf = d64;
+ if (__real__ cf != 0.125f)
+ FAILURE
+ /* Convert _Decimal128 to _Complex double. */
+ d128 = 1.25E-7dl;
+ cd = d128;
+ if (__real__ cd != 1.25E-7)
+ FAILURE
+
+ /* Verify that conversion from complex to decimal floating types
+ results in the value of the real part converted to the result
+ type according to the rules of conversion between those types. */
+
+ /* Convert _Complex float to decimal float types. */
+ cf = 2.0f * __extension__ 1i + 2.25f;
+ d32 = cf;
+ d64 = cf;
+ d128 = cf;
+ if (d32 != 2.25DF)
+ FAILURE
+ if (d64 != 2.25DD)
+ FAILURE
+ if (d128 != 2.25DL)
+ FAILURE
+
+ /* Convert _Complex double to decimal float types. */
+ cd = 2.0 * __extension__ 1i + 1.25;
+ d32 = cd;
+ d64 = cd;
+ d128 = cd;
+ if (d32 != 1.25DF)
+ FAILURE
+ if (d64 != 1.25DD)
+ FAILURE
+ if (d128 != 1.25DL)
+ FAILURE
+
+ /* Convert _Complex long double to decimal float types. */
+ cld = 2.0l * __extension__ 1i + 0.0625l;
+ d32 = cld;
+ d64 = cld;
+ d128 = cld;
+ if (d32 != 0.0625DF)
+ FAILURE
+ if (d64 != 0.0625DD)
+ FAILURE
+ if (d128 != 0.0625DL)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c
new file mode 100644
index 000000000..6727e800c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c
@@ -0,0 +1,494 @@
+/* { dg-options "-std=gnu99 -D_GNU_SOURCE -pthread" } */
+/* { dg-do run { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */
+
+/* N1150 5.2: Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New.
+
+ Perform conversions between DFP types in which the assigned value
+ cannot be represented exactly in the result and must be rounded
+ correctly according to the current rounding mode.
+
+ Normally this would not be part of compiler testing, but conversions
+ are currently handled in libgcc via decNumber. */
+
+#include <pthread.h>
+#include <error.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+#include "dfp-round.h"
+
+extern void abort (void);
+static __thread int failcnt = 0;
+
+/* Support compiling the test to report individual failures; default is
+ to abort as soon as a check fails. */
+#ifdef DBG
+#include <stdio.h>
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
+#else
+#define FAILURE abort ();
+#endif
+
+pthread_mutex_t mut1 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mut3 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mut4 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mut5 = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond1 = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond2 = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond4 = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond5 = PTHREAD_COND_INITIALIZER;
+pthread_barrier_t bar1;
+pthread_barrier_t bar2;
+pthread_barrier_t bar3;
+pthread_barrier_t bar4;
+pthread_barrier_t bar5;
+
+__thread _Decimal32 d32;
+__thread _Decimal64 d64;
+__thread _Decimal128 d128;
+
+_Decimal32 d64_to_d32 (_Decimal64 d) { return d; }
+_Decimal64 d128_to_d64 (_Decimal128 d) { return d; }
+_Decimal32 d128_to_d32 (_Decimal128 d) { return d; }
+
+int
+do_d64_to_d32 (_Decimal64 orig, _Decimal32 exp)
+{
+ d64 = orig;
+ d32 = d64_to_d32 (d64);
+ return (d32 == exp);
+}
+
+int
+do_d128_to_d32 (_Decimal128 orig, _Decimal32 exp)
+{
+ d128 = orig;
+ d32 = d128_to_d32 (d128);
+ return (d32 == exp);
+}
+
+int
+do_d128_to_d64 (_Decimal128 orig, _Decimal64 exp)
+{
+ d128 = orig;
+ d64 = d128_to_d64 (d128);
+ return (d64 == exp);
+}
+
+void *
+downward (void *arg)
+{
+ int err;
+
+ DFP_SETROUND (FE_DEC_DOWNWARD);
+
+ err = pthread_mutex_lock (&mut1);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "downward: failed to lock");
+
+ err = pthread_barrier_wait (&bar1);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("downward: barrier_wait failed");
+ exit (1);
+ }
+
+ err = pthread_cond_wait (&cond1, &mut1);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "downward: failed to wait");
+
+ err = pthread_mutex_unlock (&mut1);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "downward: failed to unlock");
+
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+#ifdef DBG
+ if (failcnt)
+ printf ("downward: %d fails\n", failcnt);
+#endif
+ return (void *) (ptrdiff_t) failcnt;
+}
+
+void *
+tonearest (void *arg)
+{
+ int err;
+ DFP_SETROUND (FE_DEC_TONEAREST);
+
+ err = pthread_mutex_lock (&mut2);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "tonearest: failed to lock");
+
+ err = pthread_barrier_wait (&bar2);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("tonearest: barrier_wait failed");
+ exit (1);
+ }
+
+ err = pthread_cond_wait (&cond2, &mut2);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "tonearest: failed to wait");
+
+ err = pthread_mutex_unlock (&mut2);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "tonearest: failed to unlock");
+
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+#ifdef DBG
+ if (failcnt)
+ printf ("tonearest: %d fails\n", failcnt);
+#endif
+ return (void *) (ptrdiff_t) failcnt;
+}
+
+void *
+toneareastfromzero (void *arg)
+{
+ int err;
+ DFP_SETROUND (FE_DEC_TONEARESTFROMZERO);
+
+ err = pthread_mutex_lock (&mut3);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "toneareastfromzero: failed to lock");
+
+ err = pthread_barrier_wait (&bar3);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("toneareastfromzero: barrier_wait failed");
+ exit (1);
+ }
+
+ err = pthread_cond_wait (&cond3, &mut3);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "toneareastfromzero: failed to wait");
+
+ err = pthread_mutex_unlock (&mut3);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "toneareastfromzero: failed to unlock");
+
+ if (!do_d64_to_d32 (1.1111125dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+#ifdef DBG
+ if (failcnt)
+ printf ("toneareastfromzero: %d fails\n", failcnt);
+#endif
+ return (void *) (ptrdiff_t) failcnt;
+}
+
+void *
+towardzero (void *arg)
+{
+ int err;
+ DFP_SETROUND (FE_DEC_TOWARDZERO);
+
+ err = pthread_mutex_lock (&mut4);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "towardzero: failed to lock");
+
+ err = pthread_barrier_wait (&bar4);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("towardzero: barrier_wait failed");
+ exit (1);
+ }
+
+ err = pthread_cond_wait (&cond4, &mut4);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "towardzero: failed to wait");
+
+ err = pthread_mutex_unlock (&mut4);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "towardzero: failed to unlock");
+
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
+
+#ifdef DBG
+ if (failcnt)
+ printf ("towardzero: %d fails\n", failcnt);
+#endif
+ return (void *) (ptrdiff_t) failcnt;
+}
+
+void *
+upward (void *arg)
+{
+ int err;
+ DFP_SETROUND (FE_DEC_UPWARD);
+
+ err = pthread_mutex_lock (&mut5);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "upward: failed to lock");
+
+ err = pthread_barrier_wait (&bar5);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("upward: barrier_wait failed");
+ exit (1);
+ }
+
+ err = pthread_cond_wait (&cond5, &mut5);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "upward: failed to wait");
+
+ err = pthread_mutex_unlock (&mut5);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "upward: failed to unlock");
+
+ if (!do_d64_to_d32 (1.1111125dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
+
+#ifdef DBG
+ if (failcnt)
+ printf ("upward: %d fails\n", failcnt);
+#endif
+ return (void *) (ptrdiff_t) failcnt;
+}
+
+int
+main (void)
+{
+ int err;
+ int count = 0;
+ void *ret;
+ pthread_t down, up, tozero, fromzero, nearest;
+
+ if (pthread_barrier_init (&bar1, NULL, 2) != 0
+ || pthread_barrier_init (&bar2, NULL, 2) != 0
+ || pthread_barrier_init (&bar3, NULL, 2) != 0
+ || pthread_barrier_init (&bar4, NULL, 2) != 0
+ || pthread_barrier_init (&bar5, NULL, 2) != 0)
+ {
+ puts ("parent: failed to init barrier");
+ return 1;
+ }
+
+ if (pthread_create (&down, NULL, downward, NULL) != 0)
+ {
+ puts ("parent: failed to create");
+ return 1;
+ }
+
+ if (pthread_create (&nearest, NULL, tonearest, NULL) != 0)
+ {
+ puts ("create failed");
+ return 1;
+ }
+
+ if (pthread_create (&fromzero, NULL, toneareastfromzero, NULL) != 0)
+ {
+ puts ("create failed");
+ return 1;
+ }
+
+ if (pthread_create (&up, NULL, upward, NULL) != 0)
+ {
+ puts ("create failed");
+ return 1;
+ }
+
+ if (pthread_create (&tozero, NULL, towardzero, NULL) != 0)
+ {
+ puts ("create failed");
+ return 1;
+ }
+
+ err = pthread_barrier_wait (&bar1);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("parent: failed to wait barrier 1");
+ return 1;
+ }
+ err = pthread_barrier_wait (&bar2);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("parent: failed to wait barrier 2");
+ return 1;
+ }
+ err = pthread_barrier_wait (&bar3);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("parent: failed to wait barrier 3");
+ return 1;
+ }
+ err = pthread_barrier_wait (&bar4);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("parent: failed to wait barrier 4");
+ return 1;
+ }
+ err = pthread_barrier_wait (&bar5);
+ if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("parent: failed to wait barrier 5");
+ return 1;
+ }
+
+ err = pthread_mutex_lock (&mut1);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: lock failed");
+ err = pthread_mutex_lock (&mut2);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: lock failed");
+ err = pthread_mutex_lock (&mut3);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: lock failed");
+ err = pthread_mutex_lock (&mut4);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: lock failed");
+ err = pthread_mutex_lock (&mut5);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: lock failed");
+
+ err = pthread_cond_signal(&cond1);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: broadcast failed");
+ err = pthread_cond_signal(&cond2);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: broadcast failed");
+ err = pthread_cond_signal(&cond3);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: broadcast failed");
+ err = pthread_cond_signal(&cond4);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: broadcast failed");
+ err = pthread_cond_signal(&cond5);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "parent: broadcast failed");
+
+ err = pthread_mutex_unlock (&mut1);
+ if (err != 0)
+ {
+ puts ("parent: failed to unlock");
+ return 1;
+ }
+ err = pthread_mutex_unlock (&mut2);
+ if (err != 0)
+ {
+ puts ("parent: failed to unlock");
+ return 1;
+ }
+ err = pthread_mutex_unlock (&mut3);
+ if (err != 0)
+ {
+ puts ("parent: failed to unlock");
+ return 1;
+ }
+ err = pthread_mutex_unlock (&mut4);
+ if (err != 0)
+ {
+ puts ("parent: failed to unlock");
+ return 1;
+ }
+ err = pthread_mutex_unlock (&mut5);
+ if (err != 0)
+ {
+ puts ("parent: failed to unlock");
+ return 1;
+ }
+
+ if (pthread_join (down, &ret) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+ count += (int) (ptrdiff_t) ret;
+
+ if (pthread_join (up, &ret) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+ count += (int) (ptrdiff_t) ret;
+
+ if (pthread_join (tozero, &ret) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+ count += (int) (ptrdiff_t) ret;
+
+ if (pthread_join (fromzero, &ret) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+ count += (int) (ptrdiff_t) ret;
+
+ if (pthread_join (nearest, &ret) != 0)
+ {
+ puts ("pthread_join failed");
+ return 1;
+ }
+ count += (int) (ptrdiff_t) ret;
+
+ if (count)
+ {
+#ifdef DBG
+ printf ("Total: %d fails\n", count);
+#endif
+ abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round.c
new file mode 100644
index 000000000..e3781bfc9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/convert-dfp-round.c
@@ -0,0 +1,124 @@
+/* { dg-options "-O0" } */
+/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
+
+/* N1150 5.2: Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New.
+
+ Perform conversions between DFP types in which the assigned value
+ cannot be represented exactly in the result and must be rounded
+ correctly according to the current rounding mode.
+
+ Normally this would not be part of compiler testing, but conversions
+ are currently handled in libgcc via decNumber. */
+
+#include "dfp-dbg.h"
+#include "dfp-round.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+_Decimal32 d64_to_d32 (_Decimal64 d) { return d; }
+_Decimal64 d128_to_d64 (_Decimal128 d) { return d; }
+_Decimal32 d128_to_d32 (_Decimal128 d) { return d; }
+
+int
+do_d64_to_d32 (_Decimal64 orig, _Decimal32 exp)
+{
+ d64 = orig;
+ d32 = d64_to_d32 (d64);
+ return (d32 == exp);
+}
+
+int
+do_d128_to_d32 (_Decimal128 orig, _Decimal32 exp)
+{
+ d128 = orig;
+ d32 = d128_to_d32 (d128);
+ return (d32 == exp);
+}
+
+int
+do_d128_to_d64 (_Decimal128 orig, _Decimal64 exp)
+{
+ d128 = orig;
+ d64 = d128_to_d64 (d128);
+ return (d64 == exp);
+}
+
+int
+main ()
+{
+ DFP_SETROUND (FE_DEC_DOWNWARD);
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+ DFP_SETROUND (FE_DEC_TONEAREST);
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+ DFP_SETROUND (FE_DEC_TONEARESTFROMZERO);
+ if (!do_d64_to_d32 (1.1111125dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111114df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111114df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111114dd)) FAILURE
+
+ DFP_SETROUND (FE_DEC_TOWARDZERO);
+ if (!do_d64_to_d32 (1.1111125dd, 1.111112df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111112df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
+
+ DFP_SETROUND (FE_DEC_UPWARD);
+ if (!do_d64_to_d32 (1.1111125dd, 1.111113df)) FAILURE
+ if (!do_d64_to_d32 (1.1111135dd, 1.111114df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111125dd, -1.111112df)) FAILURE
+ if (!do_d64_to_d32 (-1.1111135dd, -1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111125dl, 1.111113df)) FAILURE
+ if (!do_d128_to_d32 (1.1111135dl, 1.111114df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111125dl, -1.111112df)) FAILURE
+ if (!do_d128_to_d32 (-1.1111135dl, -1.111113df)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111125dl, 1.111111111111113dd)) FAILURE
+ if (!do_d128_to_d64 (1.1111111111111135dl, 1.111111111111114dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
+ if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ctypes.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ctypes.c
new file mode 100644
index 000000000..ca8fe954e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ctypes.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+
+/* N1150 3: Decimal floating types.
+ C99 6.7.2: Type specifiers */
+
+/* Test for the existence of the types. */
+_Decimal32 sd1;
+_Decimal64 dd2;
+_Decimal128 td3;
+
+#define ARRAY_SIZE 7
+
+static _Decimal32 d32[ARRAY_SIZE];
+static _Decimal64 d64[ARRAY_SIZE];
+static _Decimal128 d128[ARRAY_SIZE];
+
+extern _Decimal32 ext_d32[ARRAY_SIZE];
+extern _Decimal64 ext_d64[ARRAY_SIZE];
+extern _Decimal128 ext_d128[ARRAY_SIZE];
+
+/* Test sizes for these types. */
+int ssize[sizeof (_Decimal32) == 4 ? 1 : -1];
+int dsize[sizeof (_Decimal64) == 8 ? 1 : -1];
+int tsize[sizeof (_Decimal128) == 16 ? 1 : -1];
+
+int salign = __alignof (_Decimal32);
+int dalign = __alignof (_Decimal64);
+int talign = __alignof (_Decimal128);
+
+/* sizeof operator applied on an array of DFP types is n times the
+ size of a single variable of this type. */
+
+int d32_array_size [sizeof(d32) == ARRAY_SIZE * sizeof(sd1) ? 1 : -1];
+int d64_array_size [sizeof(d64) == ARRAY_SIZE * sizeof(dd2) ? 1 : -1];
+int d128_array_size [sizeof(d128) == ARRAY_SIZE * sizeof(td3)? 1 : -1];
+
+/* Likewise for extern qualified arrays. */
+
+int ext_d32_array_size [sizeof(ext_d32) == ARRAY_SIZE * sizeof(sd1) ? 1 : -1];
+int ext_d64_array_size [sizeof(ext_d64) == ARRAY_SIZE * sizeof(dd2) ? 1 : -1];
+int ext_d128_array_size [sizeof(ext_d128) == ARRAY_SIZE * sizeof(td3)? 1 : -1];
+
+void f()
+{
+ _Decimal32 d32[ARRAY_SIZE];
+ _Decimal64 d64[ARRAY_SIZE];
+ _Decimal128 d128[ARRAY_SIZE];
+
+ int d32_array_size [sizeof(d32) == ARRAY_SIZE * sizeof(_Decimal32) ? 1 : -1];
+ int d64_array_size [sizeof(d64) == ARRAY_SIZE * sizeof(_Decimal64) ? 1 : -1];
+ int d128_array_size [sizeof(d128) == ARRAY_SIZE * sizeof(_Decimal128)? 1 : -1];
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ddmode-ice.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ddmode-ice.c
new file mode 100644
index 000000000..19f303801
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/ddmode-ice.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* This used to result in an ICE. */
+
+_Decimal64 y[258][258];
+_Decimal64 dd[258][258];
+_Decimal64 ry[258][258];
+_Decimal64
+foo (void)
+{
+ int i;
+ int j;
+ int m;
+ int im;
+ int jm;
+ int ip;
+ int jp;
+ int i2m;
+ int i1p;
+ _Decimal64 a;
+ _Decimal64 b;
+ _Decimal64 c;
+ _Decimal64 qi;
+ _Decimal64 qj;
+ _Decimal64 xx;
+ _Decimal64 yx;
+ _Decimal64 xy;
+ _Decimal64 yy;
+ _Decimal64 rel;
+ _Decimal64 qxx;
+ _Decimal64 qyy;
+ _Decimal64 qxy;
+ do
+ {
+ jp = j + 1;
+ for (i = i1p; i <= i2m; i++)
+ {
+ ip = i + 1;
+ yx = y[ip][j] - y[im][j];
+ yy = y[i][jp] - y[i][jm];
+ a = 0.25dd * (xy * xy + yy * yy);
+ b = 0.25dd * (xx * xx + yx * yx);
+ c = 0.125dd * (xx * xy + yx * yy);
+ qj = 0.0dd;
+ dd[i][m] = b + a * rel + b;
+ qxx = y[ip][j] - 2.0dd * y[i][j] + y[im][j];
+ qyy = y[i][jp] - 2.0dd * y[i][j] + y[i][jm];
+ qxy = y[ip][jp] - y[ip][jm] - y[im][jp] + y[im][jm];
+ ry[i][m] = a * qxx + b * qyy - c * qxy + yx * qi + yy * qj;
+ }
+ }
+ while (1);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method-2.c
new file mode 100644
index 000000000..b87f159bf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-D__STDC_WANT_DEC_FP__" } */
+
+/* N1107 4: Characteristics of decimal floating types <float.h>.
+ C99 5.2.4.2.2a[2] (New).
+
+ Verify that DEC_EVAL_METHOD is defined by float.h.
+ DEC_EVAL_METHOD in <float.h>. */
+
+#ifdef DEC_EVAL_METHOD
+#error DEC_EVAL_METHOD is defined before float.h is included
+#endif
+
+#include <float.h>
+
+#ifndef DEC_EVAL_METHOD
+#error DEC_EVAL_METHOD is not defined after float.h is included
+#endif
+
+int i;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method.c
new file mode 100644
index 000000000..070a4033e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dec-eval-method.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1107 4: Characteristics of decimal floating types <float.h>.
+ C99 5.2.4.2.2a[2] (New).
+
+ Verify that __DEC_EVAL_METHOD__ is defined; it will be used to define
+ DEC_EVAL_METHOD in <float.h>. */
+
+int i;
+#ifndef __DEC_EVAL_METHOD__
+#error __DEC_EVAL_METHOD__ is not defined
+#endif
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
new file mode 100644
index 000000000..c72933f42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
@@ -0,0 +1,47 @@
+/* N1150 4: Characteristics of decimal floating types <float.h>.
+ C99 5.2.4.2.2a[3]: New.
+
+ Verify constants about range of decimal float and three components of
+ decimal float defined in float.h. */
+
+/* Make sure we are exporting the right values to float.h. */
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__ 1
+#endif
+
+#include "dfp-dbg.h"
+#include <float.h>
+
+int main ()
+{
+ if (DEC32_MANT_DIG != 7) FAILURE
+ if (DEC64_MANT_DIG != 16) FAILURE
+ if (DEC128_MANT_DIG != 34) FAILURE
+
+ if (DEC32_MIN_EXP != -94) FAILURE
+ if (DEC64_MIN_EXP != -382) FAILURE
+ if (DEC128_MIN_EXP != -6142) FAILURE
+
+ if (DEC32_MAX_EXP != 97) FAILURE
+ if (DEC64_MAX_EXP != 385) FAILURE
+ if (DEC128_MAX_EXP != 6145) FAILURE
+
+ if (DEC32_MAX != 9.999999E96DF) FAILURE
+ if (DEC64_MAX != 9.999999999999999E384DD) FAILURE
+ if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) FAILURE
+
+ if (DEC32_EPSILON != 1E-6DF) FAILURE
+ if (DEC64_EPSILON != 1E-15DD) FAILURE
+ if (DEC128_EPSILON != 1E-33DL) FAILURE
+
+ if (DEC32_MIN != 1E-95DF) FAILURE
+ if (DEC64_MIN != 1E-383DD) FAILURE
+ if (DEC128_MIN != 1E-6143DL) FAILURE
+
+ if (DEC32_SUBNORMAL_MIN != 0.000001E-95DF) FAILURE
+ if (DEC64_SUBNORMAL_MIN != 0.000000000000001E-383DD) FAILURE
+ if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-dbg.h b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-dbg.h
new file mode 100644
index 000000000..253a9d05f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-dbg.h
@@ -0,0 +1,12 @@
+#define EXTERN extern
+
+int failures;
+
+#ifdef DBG
+extern int printf (const char *, ...);
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; }
+#define FINISH if (failures != 0) __builtin_abort (); return 0;
+#else
+#define FAILURE __builtin_abort ();
+#define FINISH return 0;
+#endif
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-except.h b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-except.h
new file mode 100644
index 000000000..3ef97ff6b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-except.h
@@ -0,0 +1,13 @@
+/* Use undocumented functions in libgcc to clear and test dummy floating
+ point exception flags. That functionality is in libgcc just for
+ testing purposes.
+
+ If fesetexcept and feclearexcept are available, use those instead. */
+
+/* Get names of exception flags. */
+#include <fenv.h>
+
+extern void __dfp_clear_except (int);
+#define DFP_CLEAR_EXCEPT(M) __dfp_clear_except(M)
+extern int __dfp_test_except (int);
+#define DFP_TEST_EXCEPT(M) __dfp_test_except(M)
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-round.h b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-round.h
new file mode 100644
index 000000000..fc7fd5c23
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp-round.h
@@ -0,0 +1,22 @@
+/* This is very temporary; right now it gets functions in libgcc that
+ pass on the rounding mode to decNumber, but later it can be replaced
+ with Official Stuff. */
+
+#ifdef __DECIMAL_BID_FORMAT__
+#define FE_DEC_TONEAREST 0
+#define FE_DEC_DOWNWARD 1
+#define FE_DEC_UPWARD 2
+#define FE_DEC_TOWARDZERO 3
+#define FE_DEC_TONEARESTFROMZERO 4
+#else
+#define FE_DEC_DOWNWARD 0
+#define FE_DEC_TONEAREST 1
+#define FE_DEC_TONEARESTFROMZERO 2
+#define FE_DEC_TOWARDZERO 3
+#define FE_DEC_UPWARD 4
+#endif
+
+extern void __dfp_set_round (int);
+#define DFP_SETROUND(M) __dfp_set_round(M)
+extern int __dfp_get_round (void);
+#define DFP_GETROUND __dfp_get_round()
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp.exp b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp.exp
new file mode 100644
index 000000000..f96f1debd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/dfp.exp
@@ -0,0 +1,65 @@
+# Copyright (C) 2005-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Skip these tests for targets that don't support this extension.
+if { ![check_effective_target_dfp] } {
+ return;
+}
+
+# If the decimal float is supported in the compiler but not yet in the
+# runtime, treat all tests as compile-only.
+global dg-do-what-default
+set save-dg-do-what-default ${dg-do-what-default}
+if { ![check_effective_target_dfprt] } {
+ verbose "dfp.exp: runtime support for decimal float does not exist" 2
+ set dg-do-what-default compile
+} else {
+ verbose "dfp.exp: runtime support for decimal float exists, use it" 2
+ set dg-do-what-default run
+}
+verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
+
+global DEFAULT_CFLAGS
+if [info exists DEFAULT_CFLAGS] then {
+ set save_default_cflags $DEFAULT_CFLAGS
+}
+
+# If a testcase doesn't have special options, use these.
+set DEFAULT_CFLAGS "-std=gnu99"
+
+# Initialize `dg'.
+dg-init
+
+# Main loop; run the C-only tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+# Run the tests that are shared with C++ testing.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/dfp/*c]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
+
+set dg-do-what-default ${save-dg-do-what-default}
+verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
+if [info exists save_default_cflags] {
+ set DEFAULT_CFLAGS $save_default_cflags
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-binop.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-binop.c
new file mode 100644
index 000000000..eb0da1b2c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-binop.c
@@ -0,0 +1,105 @@
+/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
+
+/* Touch tests that check for raising appropriate exceptions for binary
+ arithmetic operations on decimal float values. */
+
+#include "fe-check.h"
+
+volatile _Decimal32 a32, b32, c32;
+volatile _Decimal64 a64, b64, c64;
+volatile _Decimal128 a128, b128, c128;
+_Decimal32 inf32;
+_Decimal64 inf64;
+_Decimal128 inf128;
+
+BINOP (100, /, a32, 2.0df, b32, 0.df, c32, FE_DIVBYZERO)
+BINOP (101, /, a64, 2.0dd, b64, 0.dd, c64, FE_DIVBYZERO)
+BINOP (102, /, a128, 2.0dl, b128, 0.dl, c128, FE_DIVBYZERO)
+
+BINOP (200, /, a32, 0.df, b32, 0.df, c32, FE_INVALID)
+BINOP (201, /, a64, 0.dd, b64, 0.dd, c64, FE_INVALID)
+BINOP (202, /, a128, 0.dl, b128, 0.dl, c128, FE_INVALID)
+BINOP (203, /, a32, inf32, b32, inf32, c32, FE_INVALID)
+BINOP (204, /, a64, inf64, b64, inf64, c64, FE_INVALID)
+BINOP (205, /, a128, inf128, b128, inf128, c128, FE_INVALID)
+BINOP (206, *, a32, 0.df, b32, __builtin_infd32(), c32, FE_INVALID)
+BINOP (207, *, a32, __builtin_infd32(), b32, 0.df, c32, FE_INVALID)
+BINOP (208, *, a64, 0.df, b64, __builtin_infd64(), c64, FE_INVALID)
+BINOP (209, *, a64, __builtin_infd64(), b64, 0.df, c64, FE_INVALID)
+BINOP (210, *, a128, 0.df, b128, __builtin_infd128(), c128, FE_INVALID)
+BINOP (211, *, a128, __builtin_infd128(), b128, 0.df, c128, FE_INVALID)
+BINOP (212, +, a32, inf32, b32, -inf32, c32, FE_INVALID)
+BINOP (213, +, a64, inf64, b64, -inf64, c64, FE_INVALID)
+BINOP (214, +, a128, inf128, b128, -inf128, c128, FE_INVALID)
+BINOP (215, -, a32, inf32, b32, inf32, c32, FE_INVALID)
+BINOP (216, -, a64, inf64, b64, inf64, c64, FE_INVALID)
+BINOP (217, -, a128, inf128, b128, inf128, c128, FE_INVALID)
+
+BINOP (300, /, a32, 9.9e94df, b32, 1.e-3df, c32, FE_OVERFLOW|FE_INEXACT)
+BINOP (301, /, a64, 9.9e382dd, b64, 1.e-3dd, c64, FE_OVERFLOW|FE_INEXACT)
+BINOP (302, /, a128, 9.9e6142dl, b128, 1.e-3dl, c128, FE_OVERFLOW|FE_INEXACT)
+BINOP (303, +, a32, 9.9e96df, b32, 1.e96df, c32, FE_OVERFLOW|FE_INEXACT)
+BINOP (304, +, a64, 9.9e384dd, b64, 1.e384dd, c64, FE_OVERFLOW|FE_INEXACT)
+BINOP (305, +, a128, 9.9e6144dl, b128, 1.e6144dl, c128, FE_OVERFLOW|FE_INEXACT)
+
+BINOP (400, /, a32, 1.e-3df, b32, 9.9e94df, c32, FE_UNDERFLOW|FE_INEXACT)
+BINOP (401, /, a64, 1.e-3dd, b64, 9.9e382dd, c64, FE_UNDERFLOW|FE_INEXACT)
+BINOP (402, /, a128, 1.e-3dl, b128, 9.9e6142dl, c128, FE_UNDERFLOW|FE_INEXACT)
+BINOP (403, *, a32, 1.e-95df, b32, 1.e-7df, c32, FE_UNDERFLOW|FE_INEXACT)
+BINOP (404, *, a64, 1.e-383dd, b64, 1.e-16dd, c64, FE_UNDERFLOW|FE_INEXACT)
+BINOP (405, *, a128, 1.e-6143dl, b128, 1.e-34dl, c128, FE_UNDERFLOW|FE_INEXACT)
+
+BINOP (500, /, a32, 1.df, b32, 3.df, c32, FE_INEXACT)
+BINOP (501, /, a64, 1.dd, b64, 3.dd, c64, FE_INEXACT)
+BINOP (502, /, a128, 1.dl, b128, 3.dl, c128, FE_INEXACT)
+
+int
+main ()
+{
+ inf32 = __builtin_infd32();
+ inf64 = __builtin_infd64();
+ inf128 = __builtin_infd128();
+
+ binop_100 ();
+ binop_101 ();
+ binop_102 ();
+
+ binop_200 ();
+ binop_201 ();
+ binop_202 ();
+ binop_203 ();
+ binop_204 ();
+ binop_205 ();
+ binop_206 ();
+ binop_207 ();
+ binop_208 ();
+ binop_209 ();
+ binop_210 ();
+ binop_211 ();
+ binop_212 ();
+ binop_213 ();
+ binop_214 ();
+ binop_215 ();
+ binop_216 ();
+ binop_217 ();
+
+ binop_300 ();
+ binop_301 ();
+ binop_302 ();
+ binop_303 ();
+ binop_304 ();
+ binop_305 ();
+
+ binop_400 ();
+ binop_401 ();
+ binop_402 ();
+ binop_403 ();
+ binop_404 ();
+ binop_405 ();
+
+ binop_500 ();
+ binop_501 ();
+ binop_502 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-check.h b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-check.h
new file mode 100644
index 000000000..9c5f0ff8c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-check.h
@@ -0,0 +1,68 @@
+/* Common support for checking that appropriate floating point exceptions
+ are raised for decimal float operations. These tests are here to test
+ the software decimal float support in libgcc. */
+
+#include "dfp-dbg.h"
+#include "dfp-except.h"
+
+#if defined(DBG) || defined(DBG2)
+#include <stdio.h>
+#undef FAILURE
+#define FAILURE(NUM,KIND,EXCEPT) \
+ { printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failures++; }
+#else
+#undef FAILURE
+#define FAILURE(N,K,E) __builtin_abort ();
+#endif
+
+/* This is useful when modifying the test to make sure that tests are
+ actually run. */
+#if defined(DBG2)
+#define SUCCESS(NUM,EXCEPT) \
+ { printf ("passed for test %d: %s\n", NUM, EXCEPT); }
+#else
+#define SUCCESS(N,E) ;
+#endif
+
+#define CHECKFLAG(NUM,EXCEPT,GOT,WANT) \
+ if ((WANT & EXCEPT) != (GOT & EXCEPT)) \
+ { \
+ if ((WANT & EXCEPT) != 0) \
+ FAILURE (NUM, "missing", #EXCEPT) \
+ else \
+ FAILURE (NUM, "unexpected", #EXCEPT) \
+ } \
+ else \
+ SUCCESS (NUM, #EXCEPT)
+
+void
+checkflags (int num, int want)
+{
+ int got = DFP_TEST_EXCEPT (FE_ALL_EXCEPT);
+ CHECKFLAG (num, FE_INVALID, got, want)
+ CHECKFLAG (num, FE_OVERFLOW, got, want)
+ CHECKFLAG (num, FE_UNDERFLOW, got, want)
+ CHECKFLAG (num, FE_DIVBYZERO, got, want)
+ CHECKFLAG (num, FE_INEXACT, got, want)
+}
+
+#define BINOP(NUM,OP,VAR1,VAL1,VAR2,VAL2,VAR3,EXCEPT) \
+void \
+binop_##NUM (void) \
+{ \
+ VAR1 = VAL1; \
+ VAR2 = VAL2; \
+ DFP_CLEAR_EXCEPT (FE_ALL_EXCEPT); \
+ VAR3 = VAR1 OP VAR2; \
+ checkflags (NUM, EXCEPT); \
+}
+
+#define CONVERT(NUM,FROM,TO,VALUE,EXCEPT) \
+void \
+convert_##NUM (void) \
+{ \
+ FROM = VALUE; \
+ DFP_CLEAR_EXCEPT (FE_ALL_EXCEPT); \
+ TO = FROM; \
+ checkflags (NUM, EXCEPT); \
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-1.c
new file mode 100644
index 000000000..b6528029b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-1.c
@@ -0,0 +1,40 @@
+/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
+
+/* Check that appropriate exceptions are raised for conversions involving
+ decimal float values. */
+
+#include "fe-check.h"
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+
+/* Conversions between decimal float types should raise an invalid
+ exception if the value doesn't fit, either because the value
+ is too large or the result can't hold the full precision. */
+
+CONVERT (100, d64, d32, 9.999999e96DD, 0)
+CONVERT (101, d64, d32, 10.000000e96DD, FE_INEXACT|FE_OVERFLOW)
+CONVERT (102, d64, d32, 1.1111111DD, FE_INEXACT)
+CONVERT (110, d128, d32, 9.999999e96DL, 0)
+CONVERT (111, d128, d32, 10.000000e96DL, FE_INEXACT|FE_OVERFLOW)
+CONVERT (112, d128, d32, 1.1111111DL, FE_INEXACT)
+CONVERT (120, d128, d64, 9.999999999999999E384DL, 0)
+CONVERT (121, d128, d64, 10.00000000000000E384DL, FE_INEXACT|FE_OVERFLOW)
+CONVERT (122, d128, d64, 1.1111111111111111DL, FE_INEXACT)
+
+int
+main ()
+{
+ convert_100 ();
+ convert_101 ();
+ convert_102 ();
+ convert_110 ();
+ convert_111 ();
+ convert_112 ();
+ convert_120 ();
+ convert_121 ();
+ convert_122 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-2.c
new file mode 100644
index 000000000..63df1cbb6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-2.c
@@ -0,0 +1,33 @@
+/* { dg-options "-mno-hard-dfp" { target { s390*-*-* } } } */
+
+/* Check that appropriate exceptions are raised for BFP to DFP conversions.
+ The test only uses double and _Decimal32; tests for conversions to
+ _Decimal64 would need 128-bit long double. */
+
+#include "fe-check.h"
+
+volatile _Decimal32 d32;
+volatile double d;
+
+CONVERT (100, d, d32, 1.0e96, FE_INEXACT)
+CONVERT (101, d, d32, 1.0e97, FE_OVERFLOW|FE_INEXACT)
+CONVERT (102, d, d32, -1.0e96, FE_INEXACT)
+CONVERT (103, d, d32, -1.0e97, FE_OVERFLOW|FE_INEXACT)
+
+/* FIXME: These only result in fp exceptions when libbid is used.
+ libdecnumber doesn't work correctly. */
+CONVERT (104, d, d32, 1.0e-96, FE_UNDERFLOW|FE_INEXACT)
+CONVERT (105, d, d32, 0.00048828125, FE_INEXACT) /* exact power of 2 */
+
+int
+main ()
+{
+ convert_100 ();
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_104 ();
+ convert_105 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-3.c
new file mode 100644
index 000000000..5938edb94
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/fe-convert-3.c
@@ -0,0 +1,45 @@
+/* Check that appropriate exceptions are raised for int to DFP conversions. */
+
+#include "fe-check.h"
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile signed int si;
+volatile unsigned int ui;
+volatile signed long long sll;
+volatile unsigned long long ull;
+
+CONVERT (100, si, d32, 9999999, 0)
+CONVERT (101, si, d32, 11111111, FE_INEXACT)
+CONVERT (102, si, d32, -9999999, 0)
+CONVERT (103, si, d32, -10000001, FE_INEXACT)
+CONVERT (110, ui, d32, 9999999, 0)
+CONVERT (111, ui, d32, 10000001, FE_INEXACT)
+CONVERT (200, sll, d64, 9999999999999999, 0)
+CONVERT (201, sll, d64, 10000000000000001, FE_INEXACT)
+CONVERT (202, sll, d64, -9999999999999999, 0)
+CONVERT (203, sll, d64, -10000000000000001, FE_INEXACT)
+CONVERT (210, ull, d64, 9999999999999999, 0)
+CONVERT (211, ull, d64, 10000000000000001, FE_INEXACT)
+
+int
+main ()
+{
+ if (sizeof (long long) != 16)
+ return 0;
+
+ convert_100 ();
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_110 ();
+ convert_111 ();
+ convert_200 ();
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_210 ();
+ convert_211 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/float-constant-double.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/float-constant-double.c
new file mode 100644
index 000000000..52c5d7126
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/float-constant-double.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+/* Constant float values of type double in <float.h> are suffixed with L
+ and cast to double so they can be used within code that uses pragma
+ FLOAT_CONST_DECIMAL64. If they were not suffixed then use of the macro
+ would have them interpreted as _Decimal64, leading to errors when used
+ in expressions with other operands of type double. */
+
+#include <float.h>
+
+extern double a, b, c, d;
+
+void
+foo ()
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ a = 0.1d * DBL_MAX;
+ b = DBL_EPSILON * 10.0d;
+ c = DBL_MIN * 200.0d;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c89.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c89.c
new file mode 100644
index 000000000..8c96d60c7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c89.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c89" } */
+
+/* Decimal float keywords are not recognized in C89 mode. */
+
+_Decimal32 x; /* { dg-error "" } */
+_Decimal64 y; /* { dg-error "" } */
+_Decimal128 z; /* { dg-error "" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c99.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c99.c
new file mode 100644
index 000000000..8a62fb93e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-c99.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+/* Decimal float keywords are not recognized in C99 mode. */
+
+_Decimal32 x; /* { dg-error "" } */
+_Decimal64 y; /* { dg-error "" } */
+_Decimal128 z; /* { dg-error "" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-ignored-c99.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-ignored-c99.c
new file mode 100644
index 000000000..a4258aaa8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-ignored-c99.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+/* Decimal float keywords are not reserved for c99. */
+
+int _Decimal32 (void)
+{
+ return 0;
+}
+
+int foo (int i)
+{
+ int _Decimal64 = i * 2;
+ return _Decimal64;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-pedantic.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-pedantic.c
new file mode 100644
index 000000000..bca51066b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-pedantic.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+
+/* Decimal float is a GCC extension. */
+
+_Decimal32 x; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal64 y; /* { dg-warning "GCC extension|ISO C" } */
+_Decimal128 z; /* { dg-warning "GCC extension|ISO C" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-reserved.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-reserved.c
new file mode 100644
index 000000000..1117ae8d9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/keywords-reserved.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+/* N1150 3: Decimal floating types.
+ C99 6.4.1(2): Keywords.
+ Decimal float keywords cannot be used in other contexts. */
+
+int _Decimal32 (void) /* { dg-error "" } */
+{
+ return 0;
+}
+
+int foo (int i)
+{
+ int _Decimal64 = i * 2; /* { dg-error "" } */
+ return _Decimal64; /* { dg-error "" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/operator-bitwise.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/operator-bitwise.c
new file mode 100644
index 000000000..f895a9705
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/operator-bitwise.c
@@ -0,0 +1,63 @@
+/* { dg-do compile } */
+
+/* C99 6.5.10: Bitwise AND operator.
+ C99 6.5.11: Bitwise exclusive OR operator.
+ C99 6.5.12: Bitwise inclusive OR operator.
+
+ Test that these operators do not accept decimal float operands. */
+
+#define OPERATE(OPRD1,OPRT,OPRD2) \
+do \
+{ \
+ OPRD1 OPRT OPRD2; \
+} while (0)
+
+
+
+#define DECIMAL_BITWISE_OPERATOR(OPRT,OPRD) \
+do \
+{ \
+OPERATE(OPRD,OPRT,1); \
+OPERATE(OPRD,OPRT,0); \
+OPERATE(OPRD,OPRT,0x15); \
+OPERATE(0,OPRT,OPRD); \
+OPERATE(1,OPRT,OPRD); \
+OPERATE(0x15,OPRT,OPRD); \
+} while (0)
+
+void operator_notfor_decimal()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* C99 Section 6.5.7 Bitwise shift operators. Operands must have
+ integer type (which the decimal float types are not). */
+
+ d32 << 1; /* { dg-error "invalid operands to binary" } */
+ d32 >> 1; /* { dg-error "invalid operands to binary" } */
+ d64 << 1; /* { dg-error "invalid operands to binary" } */
+ d64 >> 1; /* { dg-error "invalid operands to binary" } */
+ d128 << 1; /* { dg-error "invalid operands to binary" } */
+ d128 >> 1; /* { dg-error "invalid operands to binary" } */
+
+ DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
+
+ /* C99 Section 6.5.{10,11,12} Bitwise operator. Constraints: Each of
+ the operands shall have integer type. DFP type is reject by compiler
+ when bitwise operation is performed. */
+
+ DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
+
+ DECIMAL_BITWISE_OPERATOR(|,d32); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(|,d64); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(|,d128); /* { dg-error "invalid operands to binary" } */
+
+ DECIMAL_BITWISE_OPERATOR(^,d32); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(^,d64); /* { dg-error "invalid operands to binary" } */
+ DECIMAL_BITWISE_OPERATOR(^,d128); /* { dg-error "invalid operands to binary" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr31344.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr31344.c
new file mode 100644
index 000000000..506eef450
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr31344.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-options "-O" } */
+
+typedef struct
+{
+ unsigned char bits;
+} decNumber;
+
+typedef struct
+{
+ unsigned char bytes[1];
+} decimal32;
+
+extern decNumber *__decimal32ToNumber (const decimal32 *, decNumber *);
+extern void __host_to_ieee_32 (_Decimal32, decimal32 *);
+
+void
+foo (_Decimal32 arg)
+{
+ decNumber dn;
+ decimal32 d32;
+ __host_to_ieee_32 (arg, &d32);
+ __decimal32ToNumber (&d32, &dn);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr37435.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr37435.c
new file mode 100644
index 000000000..867fdd26b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr37435.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fPIC" } */
+
+volatile _Decimal32 d;
+volatile int i;
+
+void foo()
+{
+ d += i;
+ d += i;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr41049.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr41049.c
new file mode 100644
index 000000000..6187481ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr41049.c
@@ -0,0 +1,562 @@
+/* { dg-options "-std=gnu99" } */
+
+/* The preferred exponent of the result of a conversion from an
+ integral type to a decimal float type is zero. A conversion at
+ either compile time or runtime should not change the number of
+ trailing zeroes. */
+
+#include "dfp-dbg.h"
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#define TESTVAL_NEG(VAL,SUF,SIZE) \
+ x = PASTE(PASTE(VAL,.),SUF); \
+ si = VAL; \
+ sll = PASTE(VAL,LL); \
+ a = si; \
+ b = sll; \
+ c = VAL; \
+ d = PASTE(VAL,LL); \
+ if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&c,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&d,SIZE) != 0)) \
+ FAILURE
+
+#define TESTVAL_NEG_BIG(VAL,SUF,SIZE) \
+ x = PASTE(PASTE(VAL,.),SUF); \
+ sll = PASTE(VAL,LL); \
+ a = sll; \
+ b = PASTE(VAL,LL); \
+ if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0)) \
+ FAILURE
+
+#define TESTVAL_NONNEG(VAL,SUF,SIZE) \
+ x = PASTE(PASTE(VAL,.),SUF); \
+ si = VAL; \
+ ui = VAL; \
+ sll = PASTE(VAL,LL); \
+ ull = PASTE(VAL,ULL); \
+ a = si; \
+ b = sll; \
+ c = ui; \
+ d = ull; \
+ e = VAL; \
+ f = VAL; \
+ g = PASTE(VAL,LL); \
+ h = PASTE(VAL,ULL); \
+ if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&c,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&d,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&e,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&f,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&g,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&x, (void *)&h,SIZE) != 0)) \
+ FAILURE
+
+#define TESTVAL_NONNEG_BIG(VAL,SUF,SIZE) \
+ x = PASTE(PASTE(VAL,.),SUF); \
+ sll = PASTE(VAL,LL); \
+ ull = PASTE(VAL,ULL); \
+ b = sll; \
+ d = ull; \
+ f = PASTE(VAL,LL); \
+ g = PASTE(VAL,ULL); \
+ if ((__builtin_memcmp ((void *)&x, (void *)&b, SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&d, (void *)&d,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&f, (void *)&d,SIZE) != 0) \
+ || (__builtin_memcmp ((void *)&g, (void *)&d,SIZE) != 0)) \
+ FAILURE
+
+#undef SUFFIX
+#define SUFFIX DF
+#undef TYPE
+#define TYPE _Decimal32
+
+void
+zeroes_32 (void)
+{
+ volatile TYPE x, a, b, c, d, e, f, g, h;
+ volatile int si;
+ volatile unsigned int ui;
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE));
+
+ TESTVAL_NEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE));
+}
+
+void
+round_32 (void)
+{
+ volatile TYPE x, a, b, c, d, e, f, g, h;
+ volatile int si;
+ volatile unsigned int ui;
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (10000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000050, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000001, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000002, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000003, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000004, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000006, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000007, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000008, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000009, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000010, SUFFIX, sizeof (TYPE));
+
+ TESTVAL_NEG (-10000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000050, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000001, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000002, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000003, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000004, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000006, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000007, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000008, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000009, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000010, SUFFIX, sizeof (TYPE));
+}
+
+#undef SUFFIX
+#define SUFFIX DD
+#undef TYPE
+#define TYPE _Decimal64
+
+void
+zeroes_64 (void)
+{
+ volatile TYPE x, a, b, c, d, e, f, g, h;
+ volatile int si;
+ volatile unsigned int ui;
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE));
+
+ TESTVAL_NEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE));
+}
+
+void
+round_64 (void)
+{
+ volatile TYPE x, a, b, c, d, e, f, g, h;
+ volatile int si;
+ volatile unsigned int ui;
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000001, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000002, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000003, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000004, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000006, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000007, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000008, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000009, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000010, SUFFIX, sizeof (TYPE));
+
+ TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000001, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000002, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000003, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000004, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000049, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000051, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000006, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000007, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000008, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000009, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000010, SUFFIX, sizeof (TYPE));
+}
+
+#undef SUFFIX
+#define SUFFIX DL
+#undef TYPE
+#define TYPE _Decimal128
+
+void
+zeroes_128 (void)
+{
+ volatile TYPE x, a, b, c, d, e, f, g, h;
+ volatile int si;
+ volatile unsigned int ui;
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE));
+
+ TESTVAL_NEG (0, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE));
+ TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE));
+}
+
+
+int
+main ()
+{
+ zeroes_32 ();
+ zeroes_64 ();
+ zeroes_128 ();
+ round_32 ();
+ round_64 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48204.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48204.c
new file mode 100644
index 000000000..7b421581e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48204.c
@@ -0,0 +1,10 @@
+/* PR debug/48204 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g" } */
+
+void
+foo (void)
+{
+ float cf = 3.0f;
+ _Decimal64 d64 = cf;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48928.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48928.c
new file mode 100644
index 000000000..1fd363565
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr48928.c
@@ -0,0 +1,10 @@
+/* PR debug/48928 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+_Decimal32
+foo (_Decimal32 x)
+{
+ _Decimal32 y = (x + x) / (9.DF * x);
+ return y;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr52140.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr52140.c
new file mode 100644
index 000000000..ca878f2d8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pr52140.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* This used to result in an ICE. */
+
+int
+foo (_Decimal64 x, _Decimal64 y)
+{
+ return (x < y) || (x > y);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c
new file mode 100644
index 000000000..62d85b6d3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c
@@ -0,0 +1,85 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Verify that the pragma has the expected result by using unsuffixed
+ float constants as operands in expressions that would mix binary and
+ decimal operands if the pragma had no effect, or the wrong effect. */
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+double a = 1.0 * 2.0dd;
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double b = 2.0 * 3.0d;
+
+ {
+ double c = 3.0 * 4.0d;
+ b = b + c;
+ }
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double d = 4.0 * 5.0dd;
+
+ b = b + d;
+ }
+
+ {
+ /* Default is OFF. */
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ double e = 5.0 * 6.0d;
+ b = b + e;
+ }
+
+ return b;
+}
+
+double
+f2 (void)
+{
+ /* Use value from outer scope, which is ON. */
+ double b = 2.0 * 3.0dd;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double c = 3.0 * 4.0d;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double d = 4.0 * 5.0dd;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ double e = 5.0 * 6.0d;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double f = 6.0 * 7.0dd;
+
+ b = a + b + c + d + e + f;
+ }
+ }
+ }
+ }
+ return b;
+}
+
+/* Use previous value from this scope, which is ON. */
+double f = 6.0 * 7.0dd;
+
+double
+f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double b = 2.0 * 3.0d;
+
+ return b + f;
+}
+
+/* Return to the state from this scope, which is ON. */
+double g = 7.0 + 8.0dd;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c
new file mode 100644
index 000000000..8bc49f771
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c
@@ -0,0 +1,86 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Verify that the pragma has the expected result by using unsuffixed
+ float constants as operands in expressions that would mix binary and
+ decimal operands if the pragma had no effect, or the wrong effect.
+ Use _Pragma rather than #pragma. */
+
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+double a = 1.0 * 2.0dd;
+
+double
+f1 (void)
+{
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double b = 2.0 * 3.0d;
+
+ {
+ double c = 3.0 * 4.0d;
+ b = b + c;
+ }
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double d = 4.0 * 5.0dd;
+
+ b = b + d;
+ }
+
+ {
+ /* Default is OFF. */
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT")
+ double e = 5.0 * 6.0d;
+ b = b + e;
+ }
+
+ return b;
+}
+
+double
+f2 (void)
+{
+ /* Use value from outer scope, which is ON. */
+ double b = 2.0 * 3.0dd;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double c = 3.0 * 4.0d;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double d = 4.0 * 5.0dd;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT")
+ double e = 5.0 * 6.0d;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double f = 6.0 * 7.0dd;
+
+ b = a + b + c + d + e + f;
+ }
+ }
+ }
+ }
+ return b;
+}
+
+/* Use previous value from this scope, which is ON. */
+double f = 6.0 * 7.0dd;
+
+double
+f3 (void)
+{
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double b = 2.0 * 3.0d;
+
+ return b + f;
+}
+
+/* Return to the state from this scope, which is ON. */
+double g = 7.0 + 8.0dd;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c
new file mode 100644
index 000000000..195998670
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New). */
+
+/* Check that defining macros whose names are the same as the tokens used
+ in the pragma doesn't affect use of the pragma. */
+
+#define ON YES
+#define OFF NO
+#define DEFAULT NOPE
+#define STDC OFFICIAL
+#define FLOAT_CONST_DECIMAL64 NEW_PRAGMA
+
+double a;
+
+void
+f1a (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ a = 1.0dd + 2.0;
+}
+
+void
+f1b (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ a = 2.0d + 3.0;
+}
+
+void
+f1c (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ a = 3.0d + 4.0;
+}
+
+/* Check that a macro can be used for the entire pragma. */
+
+#define PRAGMA(x) _Pragma (#x)
+#define DEFAULT_FLOAT_IS_DECIMAL PRAGMA(STDC FLOAT_CONST_DECIMAL64 ON)
+#define DEFAULT_FLOAT_IS_BINARY PRAGMA(STDC FLOAT_CONST_DECIMAL64 OFF)
+
+void
+f2a (void)
+{
+ DEFAULT_FLOAT_IS_DECIMAL
+ a = 5.0 * 6.0dd;
+}
+
+void
+f2b (void)
+{
+ DEFAULT_FLOAT_IS_BINARY
+ a = 6.0 * 7.0d;
+}
+
+/* _Pragma can be used with macros, including the use of a macro for the
+ switch. */
+
+#undef ON
+#undef OFF
+#undef DEFAULT
+#undef STDC
+#undef FLOAT_CONST_DECIMAL64
+
+#define SWITCH ON
+#define FLOAT_CONST_DECIMAL64(x) PRAGMA(STDC FLOAT_CONST_DECIMAL64 x)
+
+void
+f3a (void)
+{
+ FLOAT_CONST_DECIMAL64(SWITCH)
+ a = 1.0 * 7.0dd;
+}
+
+void
+f3b (void)
+{
+ FLOAT_CONST_DECIMAL64(OFF)
+ a = 1.0 + 2.0d;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c
new file mode 100644
index 000000000..af0398daf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that malformed versions of pragma STDC FLOAT_CONST_DECIMAL64
+ are detected. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 /* { dg-warning "malformed" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DFP /* { dg-warning "malformed" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON DFP /* { dg-warning "junk at end" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64" ) /* { dg-warning "malformed" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64 DFP" ) /* { dg-warning "malformed" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64 ON DFP" ) /* { dg-warning "junk at end" } */
+ a = 3.0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c
new file mode 100644
index 000000000..75e9525dd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that there is a pedantic warning for the use of pragma
+ STD FLOAT_CONST_DECIMAL64. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "ISO C" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "ISO C" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT /* { dg-warning "ISO C" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON") /* { dg-warning "ISO C" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF") /* { dg-warning "ISO C" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT") /* { dg-warning "ISO C" } */
+ a = 3.0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c
new file mode 100644
index 000000000..03c1715be
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that there is a pedantic error for the use of pragma
+ STD FLOAT_CONST_DECIMAL64. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "ISO C" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-error "ISO C" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT /* { dg-error "ISO C" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON") /* { dg-error "ISO C" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF") /* { dg-error "ISO C" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT") /* { dg-error "ISO C" } */
+ a = 3.0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c
new file mode 100644
index 000000000..55e0d661c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that when pragma FLOAT_CONST_DECIMAL64 is in effect so that
+ unsuffixed constants are _Decimal64, invalid types are still reported
+ as invalid. */
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double a = 0x1.0p1;
+ double b = 1.0i;
+
+ return a + b;
+}
+
+double
+f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double a = 0x1.0p1dd; /* { dg-error "with hex" } */
+ double b = 1.0idd; /* { dg-error "invalid suffix" } */
+
+ return a + b;
+}
+
+double
+f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double a = 0x1.0p1; /* Hex constant is not affected by pragma. */
+ double b = 1.0i; /* Imaginary constant is not affected by pragma. */
+
+ return a + b;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c
new file mode 100644
index 000000000..39d38c1d8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c
@@ -0,0 +1,174 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Pragma STDC FLOAT_CONST_DECIMAL64 "shall occur either outside external
+ declarations or preceding all explicit declarations and statements
+ inside a compound statement." */
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+#define MAX 200
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+
+double a;
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+struct S1 {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ int i;
+ int j;
+};
+
+struct S2 {
+ int i;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ int j;
+};
+
+struct S3 {
+ int i;
+ int j;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+};
+
+enum E1 {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+ one,
+ two
+};
+
+enum E2 {
+ red,
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+ blue
+};
+
+enum E3 {
+ cat,
+ dog
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+};
+
+double
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-error "#pragma" } */
+b;
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ return a;
+}
+
+double
+f2 (void)
+{
+ double b;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ b = 0.5;
+ return a + b;
+}
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+double
+f3 (void)
+{
+ typedef double b32;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ b32 b = 0.5;
+ return b;
+}
+
+double
+f4 (int i)
+{
+top:
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "invalid location" } */
+ if (i == 0)
+ return a;
+ a *= 2.;
+ i = 0;
+ goto top;
+}
+
+double
+f5 (int i)
+{
+ a = a * i;
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "invalid location" } */
+ return a * 2.;
+}
+
+double
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+f6 (void)
+{
+ return a;
+}
+
+double
+f7
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+(void) /* { dg-error "before" } */
+{
+ return a;
+}
+
+double
+f8 (void)
+{
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ }
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+extern void foo9 (void *);
+
+double
+f9 (void)
+{
+ __label__ here;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ foo9 (&&here);
+here:
+ return a;
+}
+
+double
+f10 (void)
+{
+ void foo10 (void)
+ {
+ a = 1.0;
+ }
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+double
+f11 (void)
+{
+ __extension__
+ struct A {
+ struct { char a; };
+ char b;
+ };
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+double
+f12 (void)
+{
+ __extension__ ({ a = 0.5; });
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/struct-union.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/struct-union.c
new file mode 100644
index 000000000..956fdcf21
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/struct-union.c
@@ -0,0 +1,62 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wall" } */
+
+/* C99 6.5.2.3 Structure and union members.
+ If the first expression has qualified type, the result has the so-qualified
+ version of the type of the designated member. */
+
+struct s {_Decimal32 d32; const _Decimal64 d64;};
+struct sv { volatile _Decimal32 d32; volatile _Decimal64 d64; };
+union u
+{
+ const _Decimal64 d64;
+ _Decimal32 d32;
+ const struct s cs;
+};
+
+struct s s;
+struct sv sv;
+const struct s cs;
+
+union u u;
+const union u cu;
+
+struct s g (struct s s)
+{
+ return s;
+}
+
+union u h (union u u)
+{
+ return u;
+}
+
+void f()
+{
+ cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
+ cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
+ s.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
+
+ s.d32 = 1.23dd;
+ u.d32 = 1.23dd;
+
+ u.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
+ u.cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
+ u.cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
+
+ cu.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
+
+ cu.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
+ cu.cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
+ cu.cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
+
+ /* f().x is a valid postfix expression but is not an lvalue if
+ function f() returning a structure or union. */
+ g(s).d32 = 1.23dd; /* { dg-error "lvalue required" } */
+ h(u).d64 = 1.23df; /* { dg-error "lvalue required" } */
+
+ /* Test assignment to volatile structure members. */
+ sv.d32 = 1.1df;
+ sv.d64 = 1.1dd;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/typespec.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/typespec.c
new file mode 100644
index 000000000..a4545d5d9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/typespec.c
@@ -0,0 +1,302 @@
+/* Test for valid and invalid combinations of type specifiers.
+ Based off gcc.dg/test-spec-1.c */
+/* { dg-do compile } */
+
+typedef char type;
+void _Decimal32 *x0; /* { dg-error "" "void _Decimal32" } */
+void _Decimal64 *x1; /* { dg-error "" "void _Decimal64" } */
+void _Decimal128 *x2; /* { dg-error "" "void _Decimal128" } */
+char _Decimal32 *x3; /* { dg-error "" "char _Decimal32" } */
+char _Decimal64 *x4; /* { dg-error "" "char _Decimal64" } */
+char _Decimal128 *x5; /* { dg-error "" "char _Decimal128" } */
+short _Decimal32 *x6; /* { dg-error "" "short _Decimal32" } */
+short _Decimal64 *x7; /* { dg-error "" "short _Decimal64" } */
+short _Decimal128 *x8; /* { dg-error "" "short _Decimal128" } */
+int _Decimal32 *x9; /* { dg-error "" "int _Decimal32" } */
+int _Decimal64 *x10; /* { dg-error "" "int _Decimal64" } */
+int _Decimal128 *x11; /* { dg-error "" "int _Decimal128" } */
+long _Decimal32 *x12; /* { dg-error "" "long _Decimal32" } */
+long _Decimal64 *x13; /* { dg-error "" "long _Decimal64" } */
+long _Decimal128 *x14; /* { dg-error "" "long _Decimal128" } */
+float _Decimal32 *x15; /* { dg-error "" "float _Decimal32" } */
+float _Decimal64 *x16; /* { dg-error "" "float _Decimal64" } */
+float _Decimal128 *x17; /* { dg-error "" "float _Decimal128" } */
+double _Decimal32 *x18; /* { dg-error "" "double _Decimal32" } */
+double _Decimal64 *x19; /* { dg-error "" "double _Decimal64" } */
+double _Decimal128 *x20; /* { dg-error "" "double _Decimal128" } */
+signed _Decimal32 *x21; /* { dg-error "" "signed _Decimal32" } */
+signed _Decimal64 *x22; /* { dg-error "" "signed _Decimal64" } */
+signed _Decimal128 *x23; /* { dg-error "" "signed _Decimal128" } */
+_Bool _Decimal32 *x24; /* { dg-error "" "_Bool _Decimal32" } */
+_Bool _Decimal64 *x25; /* { dg-error "" "_Bool _Decimal64" } */
+_Bool _Decimal128 *x26; /* { dg-error "" "_Bool _Decimal128" } */
+int _Decimal32 *x27; /* { dg-error "" "int _Decimal32" } */
+int _Decimal64 *x28; /* { dg-error "" "int _Decimal64" } */
+int _Decimal128 *x29; /* { dg-error "" "int _Decimal128" } */
+type _Decimal32 *x30; /* { dg-error "" "type _Decimal32" } */
+type _Decimal64 *x31; /* { dg-error "" "type _Decimal64" } */
+type _Decimal128 *x32; /* { dg-error "" "type _Decimal128" } */
+char signed _Decimal32 *x33; /* { dg-error "" "char signed _Decimal32" } */
+char signed _Decimal64 *x34; /* { dg-error "" "char signed _Decimal64" } */
+char signed _Decimal128 *x35; /* { dg-error "" "char signed _Decimal128" } */
+char unsigned _Decimal32 *x36; /* { dg-error "" "char unsigned _Decimal32" } */
+char unsigned _Decimal64 *x37; /* { dg-error "" "char unsigned _Decimal64" } */
+char unsigned _Decimal128 *x38; /* { dg-error "" "char unsigned _Decimal128" } */
+short _Decimal32 *x39; /* { dg-error "" "short _Decimal32" } */
+short _Decimal64 *x40; /* { dg-error "" "short _Decimal64" } */
+short _Decimal128 *x41; /* { dg-error "" "short _Decimal128" } */
+short signed _Decimal32 *x42; /* { dg-error "" "short signed _Decimal32" } */
+short signed _Decimal64 *x43; /* { dg-error "" "short signed _Decimal64" } */
+short signed _Decimal128 *x44; /* { dg-error "" "short signed _Decimal128" } */
+short unsigned _Decimal32 *x45; /* { dg-error "" "short unsigned _Decimal32" } */
+short unsigned _Decimal64 *x46; /* { dg-error "" "short unsigned _Decimal64" } */
+short unsigned _Decimal128 *x47; /* { dg-error "" "short unsigned _Decimal128" } */
+_Decimal32 short*x48; /* { dg-error "" "_Decimal32 short" } */
+_Decimal64 short*x49; /* { dg-error "" "_Decimal64 short" } */
+_Decimal128 short*x50; /* { dg-error "" "_Decimal128 short" } */
+_Decimal32 short signed*x51; /* { dg-error "" "_Decimal32 short signed" } */
+_Decimal64 short signed*x52; /* { dg-error "" "_Decimal64 short signed" } */
+_Decimal128 short signed*x53; /* { dg-error "" "_Decimal128 short signed" } */
+_Decimal32 short unsigned*x54; /* { dg-error "" "_Decimal32 short unsigned" } */
+_Decimal64 short unsigned*x55; /* { dg-error "" "_Decimal64 short unsigned" } */
+_Decimal128 short unsigned*x56; /* { dg-error "" "_Decimal128 short unsigned" } */
+_Decimal32 long*x57; /* { dg-error "" "_Decimal32 long" } */
+_Decimal64 long*x58; /* { dg-error "" "_Decimal64 long" } */
+_Decimal128 long*x59; /* { dg-error "" "_Decimal128 long" } */
+_Decimal32 long signed*x60; /* { dg-error "" "_Decimal32 long signed" } */
+_Decimal64 long signed*x61; /* { dg-error "" "_Decimal64 long signed" } */
+_Decimal128 long signed*x62; /* { dg-error "" "_Decimal128 long signed" } */
+_Decimal32 long unsigned*x63; /* { dg-error "" "_Decimal32 long unsigned" } */
+_Decimal64 long unsigned*x64; /* { dg-error "" "_Decimal64 long unsigned" } */
+_Decimal128 long unsigned*x65; /* { dg-error "" "_Decimal128 long unsigned" } */
+_Decimal32 signed long*x66; /* { dg-error "" "_Decimal32 signed long" } */
+_Decimal64 signed long*x67; /* { dg-error "" "_Decimal64 signed long" } */
+_Decimal128 signed long*x68; /* { dg-error "" "_Decimal128 signed long" } */
+_Decimal32 signed short*x69; /* { dg-error "" "_Decimal32 signed short" } */
+_Decimal64 signed short*x70; /* { dg-error "" "_Decimal64 signed short" } */
+_Decimal128 signed short*x71; /* { dg-error "" "_Decimal128 signed short" } */
+int signed _Decimal32 *x72; /* { dg-error "" "int signed _Decimal32" } */
+int signed _Decimal64 *x73; /* { dg-error "" "int signed _Decimal64" } */
+int signed _Decimal128 *x74; /* { dg-error "" "int signed _Decimal128" } */
+int unsigned _Decimal32 *x75; /* { dg-error "" "int unsigned _Decimal32" } */
+int unsigned _Decimal64 *x76; /* { dg-error "" "int unsigned _Decimal64" } */
+int unsigned _Decimal128 *x77; /* { dg-error "" "int unsigned _Decimal128" } */
+long int _Decimal32 *x78; /* { dg-error "" "long int _Decimal32" } */
+long int _Decimal64 *x79; /* { dg-error "" "long int _Decimal64" } */
+long int _Decimal128 *x80; /* { dg-error "" "long int _Decimal128" } */
+long long _Decimal32 *x81; /* { dg-error "" "long long _Decimal32" } */
+long long _Decimal64 *x82; /* { dg-error "" "long long _Decimal64" } */
+long long _Decimal128 *x83; /* { dg-error "" "long long _Decimal128" } */
+long double _Decimal32 *x84; /* { dg-error "" "long double _Decimal32" } */
+long double _Decimal64 *x85; /* { dg-error "" "long double _Decimal64" } */
+long double _Decimal128 *x86; /* { dg-error "" "long double _Decimal128" } */
+long signed _Decimal32 *x87; /* { dg-error "" "long signed _Decimal32" } */
+long signed _Decimal64 *x88; /* { dg-error "" "long signed _Decimal64" } */
+long signed _Decimal128 *x89; /* { dg-error "" "long signed _Decimal128" } */
+long unsigned _Decimal32 *x90; /* { dg-error "" "long unsigned _Decimal32" } */
+long unsigned _Decimal64 *x91; /* { dg-error "" "long unsigned _Decimal64" } */
+long unsigned _Decimal128 *x92; /* { dg-error "" "long unsigned _Decimal128" } */
+double long _Decimal32 *x93; /* { dg-error "" "double long _Decimal32" } */
+double long _Decimal64 *x94; /* { dg-error "" "double long _Decimal64" } */
+double long _Decimal128 *x95; /* { dg-error "" "double long _Decimal128" } */
+signed char _Decimal32 *x96; /* { dg-error "" "signed char _Decimal32" } */
+signed char _Decimal64 *x97; /* { dg-error "" "signed char _Decimal64" } */
+signed char _Decimal128 *x98; /* { dg-error "" "signed char _Decimal128" } */
+signed short _Decimal32 *x99; /* { dg-error "" "signed short _Decimal32" } */
+signed short _Decimal64 *x100; /* { dg-error "" "signed short _Decimal64" } */
+signed short _Decimal128 *x101; /* { dg-error "" "signed short _Decimal128" } */
+signed int _Decimal32 *x102; /* { dg-error "" "signed int _Decimal32" } */
+signed int _Decimal64 *x103; /* { dg-error "" "signed int _Decimal64" } */
+signed int _Decimal128 *x104; /* { dg-error "" "signed int _Decimal128" } */
+signed long _Decimal32 *105x; /* { dg-error "" "signed long _Decimal32" } */
+signed long _Decimal64 *x107; /* { dg-error "" "signed long _Decimal64" } \*/
+signed long _Decimal128 *x107; /* { dg-error "" "signed long _Decimal128" } \*/
+unsigned char _Decimal32 *x108; /* { dg-error "" "unsigned char _Decimal32" } */
+unsigned char _Decimal64 *x109; /* { dg-error "" "unsigned char _Decimal64" } */
+unsigned char _Decimal128 *x110; /* { dg-error "" "unsigned char _Decimal128" } */
+unsigned short _Decimal32 *x111; /* { dg-error "" "unsigned short _Decimal32" } */
+unsigned short _Decimal64 *x112; /* { dg-error "" "unsigned short _Decimal64" } */
+unsigned short _Decimal128 *x113; /* { dg-error "" "unsigned short _Decimal128" } */
+unsigned int _Decimal32 *x114; /* { dg-error "" "unsigned int _Decimal32" } */
+unsigned int _Decimal64 *x115; /* { dg-error "" "unsigned int _Decimal64" } */
+unsigned int _Decimal128 *x116; /* { dg-error "" "unsigned int _Decimal128" } */
+unsigned long _Decimal32 *x117; /* { dg-error "" "unsigned long _Decimal32" } */
+unsigned long _Decimal64 *x118; /* { dg-error "" "unsigned long _Decimal64" } */
+unsigned long _Decimal128 *x119; /* { dg-error "" "unsigned long _Decimal128" } */
+short int signed _Decimal32 *x120; /* { dg-error "" "short int signed _Decimal32" } */
+short int signed _Decimal64 *x121; /* { dg-error "" "short int signed _Decimal64" } */
+short int signed _Decimal128 *x122; /* { dg-error "" "short int signed _Decimal128" } */
+short int unsigned _Decimal32 *x123; /* { dg-error "" "short int unsigned _Decimal32" } */
+short int unsigned _Decimal64 *x124; /* { dg-error "" "short int unsigned _Decimal64" } */
+short int unsigned _Decimal128 *x125; /* { dg-error "" "short int unsigned _Decimal128" } */
+short signed int _Decimal32 *x126; /* { dg-error "" "short signed int _Decimal32" } */
+short signed int _Decimal64 *x127; /* { dg-error "" "short signed int _Decimal64" } */
+short signed int _Decimal128 *x128; /* { dg-error "" "short signed int _Decimal128" } */
+short unsigned int _Decimal32 *x129; /* { dg-error "" "short unsigned int _Decimal32" } */
+short unsigned int _Decimal64 *x130; /* { dg-error "" "short unsigned int _Decimal64" } */
+short unsigned int _Decimal128 *x131; /* { dg-error "" "short unsigned int _Decimal128" } */
+int short signed _Decimal32 *x132; /* { dg-error "" "int short signed _Decimal32" } */
+int short signed _Decimal64 *x133; /* { dg-error "" "int short signed _Decimal64" } */
+int short signed _Decimal128 *x134; /* { dg-error "" "int short signed _Decimal128" } */
+int short unsigned _Decimal32 *x135; /* { dg-error "" "int short unsigned _Decimal32" } */
+int short unsigned _Decimal64 *x136; /* { dg-error "" "int short unsigned _Decimal64" } */
+int short unsigned _Decimal128 *x137; /* { dg-error "" "int short unsigned _Decimal128" } */
+int long long _Decimal32 *x138; /* { dg-error "" "int long long _Decimal32" } */
+int long long _Decimal64 *x139; /* { dg-error "" "int long long _Decimal64" } */
+int long long _Decimal128 *x140; /* { dg-error "" "int long long _Decimal128" } */
+int long signed _Decimal32 *x141; /* { dg-error "" "int long signed _Decimal32" } */
+int long signed _Decimal64 *x142; /* { dg-error "" "int long signed _Decimal64" } */
+int long signed _Decimal128 *x143; /* { dg-error "" "int long signed _Decimal128" } */
+int long unsigned _Decimal32 *x144; /* { dg-error "" "int long unsigned _Decimal32" } */
+int long unsigned _Decimal64 *x145; /* { dg-error "" "int long unsigned _Decimal64" } */
+int long unsigned _Decimal128 *x146; /* { dg-error "" "int long unsigned _Decimal128" } */
+int signed short _Decimal32 *x147; /* { dg-error "" "int signed short _Decimal32" } */
+int signed short _Decimal64 *x148; /* { dg-error "" "int signed short _Decimal64" } */
+int signed short _Decimal128 *x149; /* { dg-error "" "int signed short _Decimal128" } */
+int signed long _Decimal32 *x150; /* { dg-error "" "int signed long _Decimal32" } */
+int signed long _Decimal64 *x151; /* { dg-error "" "int signed long _Decimal64" } */
+int signed long _Decimal128 *x152; /* { dg-error "" "int signed long _Decimal128" } */
+int unsigned short _Decimal32 *x153; /* { dg-error "" "int unsigned short _Decimal32" } */
+int unsigned short _Decimal64 *x154; /* { dg-error "" "int unsigned short _Decimal64" } */
+int unsigned short _Decimal128 *x155; /* { dg-error "" "int unsigned short _Decimal128" } */
+int unsigned long _Decimal32 *x156; /* { dg-error "" "int unsigned long _Decimal32" } */
+int unsigned long _Decimal64 *x157; /* { dg-error "" "int unsigned long _Decimal64" } */
+int unsigned long _Decimal128 *x158; /* { dg-error "" "int unsigned long _Decimal128" } */
+long int long _Decimal32 *x159; /* { dg-error "" "long int long _Decimal32" } */
+long int long _Decimal64 *x160; /* { dg-error "" "long int long _Decimal64" } */
+long int long _Decimal128 *x161; /* { dg-error "" "long int long _Decimal128" } */
+long int signed _Decimal32 *x162; /* { dg-error "" "long int signed _Decimal32" } */
+long int signed _Decimal64 *x163; /* { dg-error "" "long int signed _Decimal64" } */
+long int signed _Decimal128 *x164; /* { dg-error "" "long int signed _Decimal128" } */
+long int unsigned _Decimal32 *x165; /* { dg-error "" "long int unsigned _Decimal32" } */
+long int unsigned _Decimal64 *x166; /* { dg-error "" "long int unsigned _Decimal64" } */
+long int unsigned _Decimal128 *x167; /* { dg-error "" "long int unsigned _Decimal128" } */
+long long int _Decimal32 *x168; /* { dg-error "" "long long int _Decimal32" } */
+long long int _Decimal64 *x169; /* { dg-error "" "long long int _Decimal64" } */
+long long int _Decimal128 *x170; /* { dg-error "" "long long int _Decimal128" } */
+long long signed _Decimal32 *x171; /* { dg-error "" "long long signed _Decimal32" } */
+long long signed _Decimal64 *x172; /* { dg-error "" "long long signed _Decimal64" } */
+long long signed _Decimal128 *x172; /* { dg-error "" "long long signed _Decimal128" } */
+long long unsigned _Decimal32 *x175; /* { dg-error "" "long long unsigned _Decimal32" } */
+long long unsigned _Decimal64 *x176; /* { dg-error "" "long long unsigned _Decimal64" } */
+long long unsigned _Decimal128 *x177; /* { dg-error "" "long long unsigned _Decimal128" } */
+long signed int _Decimal32 *x178; /* { dg-error "" "long signed int _Decimal32" } */
+long signed int _Decimal64 *x179; /* { dg-error "" "long signed int _Decimal64" } */
+long signed int _Decimal128 *x180; /* { dg-error "" "long signed int _Decimal128" } */
+long unsigned int _Decimal32 *x181; /* { dg-error "" "long unsigned int _Decimal32" } */
+long unsigned int _Decimal64 *x182; /* { dg-error "" "long unsigned int _Decimal64" } */
+long unsigned int _Decimal128 *x183; /* { dg-error "" "long unsigned int _Decimal128" } */
+long unsigned long _Decimal32 *x184; /* { dg-error "" "long unsigned long _Decimal32" } */
+long unsigned long _Decimal64 *x185; /* { dg-error "" "long unsigned long _Decimal64" } */
+long unsigned long _Decimal128 *x186; /* { dg-error "" "long unsigned long _Decimal128" } */
+signed short int _Decimal32 *x187; /* { dg-error "" "signed short int _Decimal32" } */
+signed short int _Decimal64 *x188; /* { dg-error "" "signed short int _Decimal64" } */
+signed short int _Decimal128 *x189; /* { dg-error "" "signed short int _Decimal128" } */
+signed int short _Decimal32 *x190; /* { dg-error "" "signed int short _Decimal32" } */
+signed int short _Decimal64 *x191; /* { dg-error "" "signed int short _Decimal64" } */
+signed int short _Decimal128 *x191; /* { dg-error "" "signed int short _Decimal128" } */
+signed int long _Decimal32 *x192; /* { dg-error "" "signed int long _Decimal32" } */
+signed int long _Decimal64 *x193; /* { dg-error "" "signed int long _Decimal64" } */
+signed int long _Decimal128 *x194; /* { dg-error "" "signed int long _Decimal128" } */
+signed long int _Decimal32 *x195; /* { dg-error "" "signed long int _Decimal32" } */
+signed long int _Decimal64 *x196; /* { dg-error "" "signed long int _Decimal64" } */
+signed long int _Decimal128 *x197; /* { dg-error "" "signed long int _Decimal128" } */
+signed long long _Decimal32 *x198; /* { dg-error "" "signed long long _Decimal32" } */
+signed long long _Decimal64 *x199; /* { dg-error "" "signed long long _Decimal64" } */
+signed long long _Decimal128 *x200; /* { dg-error "" "signed long long _Decimal128" } */
+unsigned short int _Decimal32 *x201; /* { dg-error "" "unsigned short int _Decimal32" } */
+unsigned short int _Decimal64 *x202; /* { dg-error "" "unsigned short int _Decimal64" } */
+unsigned short int _Decimal128 *x203; /* { dg-error "" "unsigned short int _Decimal128" } */
+unsigned int short _Decimal32 *x204; /* { dg-error "" "unsigned int short _Decimal32" } */
+unsigned int short _Decimal64 *x205; /* { dg-error "" "unsigned int short _Decimal64" } */
+unsigned int short _Decimal128 *x206; /* { dg-error "" "unsigned int short _Decimal128" } */
+unsigned int long _Decimal32 *x207; /* { dg-error "" "unsigned int long _Decimal32" } */
+unsigned int long _Decimal64 *x208; /* { dg-error "" "unsigned int long _Decimal64" } */
+unsigned int long _Decimal128 *x209; /* { dg-error "" "unsigned int long _Decimal128" } */
+unsigned long int _Decimal32 *x210; /* { dg-error "" "unsigned long int _Decimal32" } */
+unsigned long int _Decimal64 *x211; /* { dg-error "" "unsigned long int _Decimal64" } */
+unsigned long int _Decimal128 *x212; /* { dg-error "" "unsigned long int _Decimal128" } */
+unsigned long long _Decimal32 *x213; /* { dg-error "" "unsigned long long _Decimal32" } */
+unsigned long long _Decimal64 *x214; /* { dg-error "" "unsigned long long _Decimal64" } */
+unsigned long long _Decimal128 *x215; /* { dg-error "" "unsigned long long _Decimal128" } */
+int long long signed _Decimal32 *x216; /* { dg-error "" "int long long signed _Decimal32" } */
+int long long signed _Decimal64 *x217; /* { dg-error "" "int long long signed _Decimal64" } */
+int long long signed _Decimal128 *x218; /* { dg-error "" "int long long signed _Decimal128" } */
+int long long unsigned _Decimal32 *x219; /* { dg-error "" "int long long unsigned _Decimal32" } */
+int long long unsigned _Decimal64 *x220; /* { dg-error "" "int long long unsigned _Decimal64" } */
+int long long unsigned _Decimal128 *x221; /* { dg-error "" "int long long unsigned _Decimal128" } */
+int long signed long _Decimal32 *x222; /* { dg-error "" "int long signed long _Decimal32" } */
+int long signed long _Decimal64 *x223; /* { dg-error "" "int long signed long _Decimal64" } */
+int long signed long _Decimal128 *x224; /* { dg-error "" "int long signed long _Decimal128" } */
+int long unsigned long _Decimal32 *x226; /* { dg-error "" "int long unsigned long _Decimal32" } */
+int long unsigned long _Decimal64 *x227; /* { dg-error "" "int long unsigned long _Decimal64" } */
+int long unsigned long _Decimal128 *x228; /* { dg-error "" "int long unsigned long _Decimal128" } */
+int signed long long _Decimal32 *x229; /* { dg-error "" "int signed long long _Decimal32" } */
+int signed long long _Decimal64 *x230; /* { dg-error "" "int signed long long _Decimal64" } */
+int signed long long _Decimal128 *x231; /* { dg-error "" "int signed long long _Decimal128" } */
+int unsigned long long _Decimal32 *x232; /* { dg-error "" "int unsigned long long _Decimal32" } */
+int unsigned long long _Decimal64 *x233; /* { dg-error "" "int unsigned long long _Decimal64" } */
+int unsigned long long _Decimal128 *x234; /* { dg-error "" "int unsigned long long _Decimal128" } */
+long int long signed _Decimal32 *x235; /* { dg-error "" "long int long signed _Decimal32" } */
+long int long signed _Decimal64 *x236; /* { dg-error "" "long int long signed _Decimal64" } */
+long int long signed _Decimal128 *x237; /* { dg-error "" "long int long signed _Decimal128" } */
+long int long unsigned _Decimal32 *x238; /* { dg-error "" "long int long unsigned _Decimal32" } */
+long int long unsigned _Decimal64 *x239; /* { dg-error "" "long int long unsigned _Decimal64" } */
+long int long unsigned _Decimal128 *x240; /* { dg-error "" "long int long unsigned _Decimal128" } */
+long int signed long _Decimal32 *x241; /* { dg-error "" "long int signed long _Decimal32" } */
+long int signed long _Decimal64 *x242; /* { dg-error "" "long int signed long _Decimal64" } */
+long int signed long _Decimal128 *x243; /* { dg-error "" "long int signed long _Decimal128" } */
+long int unsigned long _Decimal32 *x244; /* { dg-error "" "long int unsigned long _Decimal32" } */
+long int unsigned long _Decimal64 *x245; /* { dg-error "" "long int unsigned long _Decimal64" } */
+long int unsigned long _Decimal128 *x246; /* { dg-error "" "long int unsigned long _Decimal128" } */
+long long int signed _Decimal32 *x247; /* { dg-error "" "long long int signed _Decimal32" } */
+long long int signed _Decimal64 *x248; /* { dg-error "" "long long int signed _Decimal64" } */
+long long int signed _Decimal128 *x249; /* { dg-error "" "long long int signed _Decimal128" } */
+long long int unsigned _Decimal32 *x250; /* { dg-error "" "long long int unsigned _Decimal32" } */
+long long int unsigned _Decimal64 *x251; /* { dg-error "" "long long int unsigned _Decimal64" } */
+long long int unsigned _Decimal128 *x252; /* { dg-error "" "long long int unsigned _Decimal128" } */
+long long signed int _Decimal32 *x253; /* { dg-error "" "long long signed int _Decimal32" } */
+long long signed int _Decimal64 *x254; /* { dg-error "" "long long signed int _Decimal64" } */
+long long signed int _Decimal128 *x255; /* { dg-error "" "long long signed int _Decimal128" } */
+long long unsigned int _Decimal32 *x256; /* { dg-error "" "long long unsigned int _Decimal32" } */
+long long unsigned int _Decimal64 *x257; /* { dg-error "" "long long unsigned int _Decimal64" } */
+long long unsigned int _Decimal128 *x258; /* { dg-error "" "long long unsigned int _Decimal128" } */
+long signed int long _Decimal32 *x259; /* { dg-error "" "long signed int long _Decimal32" } */
+long signed int long _Decimal64 *x260; /* { dg-error "" "long signed int long _Decimal64" } */
+long signed int long _Decimal128 *x261; /* { dg-error "" "long signed int long _Decimal128" } */
+long signed long int _Decimal32 *x262; /* { dg-error "" "long signed long int _Decimal32" } */
+long signed long int _Decimal64 *x263; /* { dg-error "" "long signed long int _Decimal64" } */
+long signed long int _Decimal128 *x264; /* { dg-error "" "long signed long int _Decimal128" } */
+long unsigned int long _Decimal32 *x265; /* { dg-error "" "long unsigned int long _Decimal32" } */
+long unsigned int long _Decimal64 *x266; /* { dg-error "" "long unsigned int long _Decimal64" } */
+long unsigned int long _Decimal128 *x267; /* { dg-error "" "long unsigned int long _Decimal128" } */
+long unsigned long int _Decimal32 *x268; /* { dg-error "" "long unsigned long int _Decimal32" } */
+long unsigned long int _Decimal64 *x269; /* { dg-error "" "long unsigned long int _Decimal64" } */
+long unsigned long int _Decimal128 *x270; /* { dg-error "" "long unsigned long int _Decimal128" } */
+signed long long int _Decimal32 *x271; /* { dg-error "" "signed long long int _Decimal32" } */
+signed long long int _Decimal64 *x272; /* { dg-error "" "signed long long int _Decimal64" } */
+signed long long int _Decimal128 *x273; /* { dg-error "" "signed long long int _Decimal128" } */
+unsigned int long long _Decimal32 *x274; /* { dg-error "" "unsigned int long long _Decimal32" } */
+unsigned int long long _Decimal64 *x275; /* { dg-error "" "unsigned int long long _Decimal64" } */
+unsigned int long long _Decimal128 *x276; /* { dg-error "" "unsigned int long long _Decimal128" } */
+unsigned long int long _Decimal32 *x277; /* { dg-error "" "unsigned long int long _Decimal32" } */
+unsigned long int long _Decimal64 *x278; /* { dg-error "" "unsigned long int long _Decimal64" } */
+unsigned long int long _Decimal128 *x279; /* { dg-error "" "unsigned long int long _Decimal128" } */
+unsigned long long int _Decimal32 *x280; /* { dg-error "" "unsigned long long int _Decimal32" } */
+unsigned long long int _Decimal64 *x281; /* { dg-error "" "unsigned long long int _Decimal64" } */
+unsigned long long int _Decimal128 *x282; /* { dg-error "" "unsigned long long int _Decimal128" } */
+
+_Complex _Decimal32 *x283; /* { dg-error "" "_Complex _Decimal32" } */
+_Complex _Decimal64 *x284; /* { dg-error "" "_Complex _Decimal64" } */
+_Complex _Decimal128 *x285; /* { dg-error "" "_Complex _Decimal128" } */
+
+_Decimal32 _Complex *x286; /* { dg-error "" "_Decimal32 _Complex" } */
+_Decimal64 _Complex *x287; /* { dg-error "" "_Decimal64 _Complex" } */
+_Decimal128 _Complex *x288; /* { dg-error "" "_Decimal128 _Complex" } */
+
+unsigned _Decimal32 *x289; /* { dg-error "" "unsigned _Decimal32" } */
+unsigned _Decimal64 *x290; /* { dg-error "" "unsigned _Decimal64" } */
+unsigned _Decimal128 *x291; /* { dg-error "" "unsigned _Decimal128" } */
+signed _Decimal32 *x292; /* { dg-error "" "signed _Decimal32" } */
+signed _Decimal64 *x293; /* { dg-error "" "signed _Decimal64" } */
+signed _Decimal128 *x294; /* { dg-error "" "signed _Decimal128" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/union-init.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/union-init.c
new file mode 100644
index 000000000..6896ece99
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/union-init.c
@@ -0,0 +1,58 @@
+/* Cast to union is a GNU C extension. */
+
+#include "dfp-dbg.h"
+
+union u
+{
+ _Decimal128 d128;
+ double d;
+};
+
+union n
+{
+ double d;
+ _Decimal64 d64;
+};
+
+int main ()
+{
+ static union u u1 = { 0.0dl };
+ static union u u2 = { 4.2dl };
+ static union u u4 = { 0.0 };
+
+ static union n n1 = { 2.2dd };
+ static union n n2 = { 3.25 };
+
+ _Decimal128 d128;
+ _Decimal64 d64;
+ double d;
+
+ if (u1.d128 != 0.0dl)
+ FAILURE
+
+ if (u2.d128 != 4.2dl)
+ FAILURE
+
+ /* cast decimal floating point to union type. */
+ d128 = 1.23dl;
+ d64 = 4.56dd;
+ d = 3.25;
+
+ u4 = (union u) d128;
+ if (u4.d128 != 1.23dl)
+ FAILURE
+
+ u4 = (union u) d;
+ if (u4.d != 3.25)
+ FAILURE
+
+ n1 = (union n) d64;
+ if (n1.d64 != 4.56dd)
+ FAILURE
+
+ n1 = (union n)d;
+ if (n1.d != 3.25)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c
new file mode 100644
index 000000000..7bd0f64f1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+/* This used to result in an ICE. */
+
+extern _Decimal64 x;
+extern int i;
+
+void
+foo (void)
+{
+ if (x <= 2.0) /* { dg-error "mix operands" } */
+ i++;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
new file mode 100644
index 000000000..e14c7b20a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+
+/* N1150 5.4: Usual arithmetic conversions.
+ C99 6.3.1.8[1] (New).
+
+ Test arithmetic operators between decimal float types and generic
+ float types, which are not allowed. */
+
+extern _Decimal32 d32a, d32b;
+extern _Decimal64 d64a, d64b;
+extern _Decimal128 d128a, d128b;
+extern float f;
+extern double d;
+extern long double ld;
+
+extern signed int __attribute__ ((vector_size (16))) vi;
+
+extern _Complex float cf;
+extern _Complex double cd;
+extern _Complex long double cld;
+extern _Complex int ci;
+
+void
+foo (void)
+{
+ /* Mixed operations with decimal and generic float operands. */
+ d32a = d32b + f; /* { dg-error "" "error.*mix operands of decimal float" } */
+ d32a = f * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
+ f += d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = d32a + d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = d * d128a; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a -= d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = ld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = d64b + d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
+
+ /* Mixed operations with decimal float and a vector type. */
+ d64a = d64b + vi; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a *= vi; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = vi - d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+
+ /* Mixed operations with decimal float and Complex types. */
+ d32a += ci; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = ci * d32a; /* { dg-error "" "error.* mix operands of decimal float" } */
+ cd = d64a * cd; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128b = cld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a = cf * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/dfp/wtr-conversion-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/wtr-conversion-1.c
new file mode 100644
index 000000000..4eff00725
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/dfp/wtr-conversion-1.c
@@ -0,0 +1,75 @@
+/* Test for -Wtraditional warnings on conversions by prototypes.
+ Note, gcc should omit these warnings in system header files.
+ Based on gcc.dg/wtr-conversion-1.c */
+
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+extern void foo_i (int);
+extern void foo_f (float);
+extern void foo_ld (long double);
+extern void foo_d32 (_Decimal32);
+extern void foo_d64 (_Decimal64);
+extern void foo_d128 (_Decimal128);
+
+extern int i;
+extern float f;
+extern long double ld;
+extern _Decimal32 d32;
+extern _Decimal64 d64;
+extern _Decimal128 d128;
+
+void
+testfunc1 ()
+{
+ foo_i (i);
+ foo_i (d32); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
+ foo_i (d64); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
+ foo_i (d128); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
+ foo_d32 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
+ foo_d32 (f); /* { dg-warning "as '_Decimal32' rather than 'float'" "prototype conversion warning" } */
+ foo_d32 (ld); /* { dg-warning "as '_Decimal32' rather than 'long double'" "prototype conversion warning" } */
+ foo_d32 (d64); /* { dg-warning "as '_Decimal32' rather than '_Decimal64'" "prototype conversion warning" } */
+ foo_d32 (d128); /* { dg-warning "as '_Decimal32' rather than '_Decimal128'" "prototype conversion warning" } */
+ foo_d64 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
+ foo_d64 (f); /* { dg-warning "as '_Decimal64' rather than 'float'" "prototype conversion warning" } */
+ foo_d64 (ld); /* { dg-warning "as '_Decimal64' rather than 'long double'" "prototype conversion warning" } */
+ foo_d64 (d32); /* { dg-bogus "as '_Decimal64' rather than '_Decimal32'" "prototype conversion warning" } */
+ foo_d64 (d128); /* { dg-warning "as '_Decimal64' rather than '_Decimal128'" "prototype conversion warning" } */
+ foo_d128 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
+ foo_d128 (f); /* { dg-warning "as '_Decimal128' rather than 'float'" "prototype conversion warning" } */
+ foo_d128 (ld); /* { dg-warning "as '_Decimal128' rather than 'long double'" "prototype conversion warning" } */
+ foo_d128 (d32); /* { dg-bogus "as '_Decimal128' rather than '_Decimal32'" "prototype conversion warning" } */
+ foo_d128 (d64); /* { dg-bogus "as '_Decimal128' rather than '_Decimal64'" "prototype conversion warning" } */
+ foo_d128 (d128); /* { dg-bogus "as '_Decimal128' rather than '_Decimal'" "prototype conversion warning" } */
+}
+
+# 54 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue. */
+
+void
+testfunc2 ()
+{
+ foo_i (i);
+ foo_i (d32);
+ foo_i (d64);
+ foo_i (d128);
+ foo_d32 (i);
+ foo_d32 (f);
+ foo_d32 (ld);
+ foo_d32 (d32);
+ foo_d32 (d64);
+ foo_d32 (d128);
+ foo_d64 (i);
+ foo_d64 (f);
+ foo_d64 (ld);
+ foo_d64 (d32);
+ foo_d64 (d64);
+ foo_d64 (d128);
+ foo_d128 (i);
+ foo_d128 (f);
+ foo_d128 (ld);
+ foo_d128 (d32);
+ foo_d128 (d64);
+ foo_d128 (d128);
+}