target-supports.exp (check_effective_target_fixed_point): New to check if targets...
authorChao-ying Fu <fu@mips.com>
Sat, 22 Sep 2007 00:27:56 +0000 (00:27 +0000)
committerChao-ying Fu <chaoyingfu@gcc.gnu.org>
Sat, 22 Sep 2007 00:27:56 +0000 (00:27 +0000)
* lib/target-supports.exp (check_effective_target_fixed_point): New to
check if targets have fixed-point supports.
* gcc.dg/fixed-point/fixed-point.exp: New file.
* gcc.dg/fixed-point/addsub.c, gcc.dg/fixed-point/allconv.c,
* gcc.dg/fixed-point/allop.c, gcc.dg/fixed-point/call-by-value.c,
* gcc.dg/fixed-point/cast-bad.c, gcc.dg/fixed-point/composite-type.c,
* gcc.dg/fixed-point/const-1.c, gcc.dg/fixed-point/constant.c,
* gcc.dg/fixed-point/constants-pedantic.c,
* gcc.dg/fixed-point/convert.c, gcc.dg/fixed-point/define.c,
* gcc.dg/fixed-point/keywords-c89.c, gcc.dg/fixed-point/keywords-c99.c,
* gcc.dg/fixed-point/keywords-ignored-c99.c,
* gcc.dg/fixed-point/keywords-pedantic.c,
* gcc.dg/fixed-point/keywords-reserved.c, gcc.dg/fixed-point/binary.c,
* gcc.dg/fixed-point/modes.c, gcc.dg/fixed-point/noassoc.c,
* gcc.dg/fixed-point/types.c, gcc.dg/fixed-point/typespec.c,
* gcc.dg/fixed-point/unary.c, gcc.dg/fixed-point/func-array.c,
* gcc.dg/fixed-point/func-scalar.c, gcc.dg/fixed-point/func-struct.c,
* gcc.dg/fixed-point/func-vararg-mixed.c,
* gcc.dg/fixed-point/operator-logical.c,
* gcc.dg/fixed-point/struct-union.c,
* gcc.dg/fixed-point/bit-complement.c,
* gcc.dg/fixed-point/operator-bitwise.c,
* gcc.dg/fixed-point/operator-comma.c,
* gcc.dg/fixed-point/struct-layout-1.c,
* gcc.dg/fixed-point/union-init.c,
* gcc.dg/fixed-point/Wbad-function-cast-1.c,
* gcc.dg/fixed-point/func-mixed.c,
* gcc.dg/fixed-point/func-vararg-size0.c,
* gcc.dg/fixed-point/func-vararg.c, gcc.dg/fixed-point/int-warning.c,
* gcc.dg/fixed-point/loop-index.c, gcc.dg/fixed-point/operator-cond.c,
* gcc.dg/fixed-point/operator-unary.c,
* gcc.dg/fixed-point/allop-const.c,
* gcc.dg/fixed-point/muldiv-warning.c,
* gcc.dg/nofixed-point-1.c,
* gcc.target/mips/dpaq_sa_l_w.c, gcc.target/mips/dpsq_sa_l_w.c,
* gcc.target/mips/fixed-vector-type.c,
* gcc.target/mips/fixed-scalar-type.c: New tests.

From-SVN: r128661

51 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fixed-point/Wbad-function-cast-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/addsub.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/allconv.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/allop-const.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/allop.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/binary.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/bit-complement.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/call-by-value.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/cast-bad.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/composite-type.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/const-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/constant.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/constants-pedantic.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/convert.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/define.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/fixed-point.exp [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-array.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-mixed.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-scalar.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-struct.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-vararg-mixed.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-vararg-size0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/func-vararg.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/int-warning.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/keywords-c89.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/keywords-c99.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/keywords-ignored-c99.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/keywords-pedantic.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/keywords-reserved.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/loop-index.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/modes.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/muldiv-warning.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/noassoc.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/operator-bitwise.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/operator-comma.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/operator-cond.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/operator-logical.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/operator-unary.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/struct-layout-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/struct-union.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/types.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/typespec.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/unary.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fixed-point/union-init.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/nofixed-point-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/dpaq_sa_l_w.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/dpsq_sa_l_w.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/fixed-scalar-type.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/fixed-vector-type.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index 3b95f1d8833b53c376bdc808bb9464f9479d57bb..7558f8f36715cb16bc74473dd68650c5c6d9649a 100644 (file)
@@ -1,3 +1,43 @@
+2007-09-21  Chao-ying Fu  <fu@mips.com>
+
+       * lib/target-supports.exp (check_effective_target_fixed_point): New to
+       check if targets have fixed-point supports.
+       * gcc.dg/fixed-point/fixed-point.exp: New file.
+       * gcc.dg/fixed-point/addsub.c, gcc.dg/fixed-point/allconv.c,
+       * gcc.dg/fixed-point/allop.c, gcc.dg/fixed-point/call-by-value.c,
+       * gcc.dg/fixed-point/cast-bad.c, gcc.dg/fixed-point/composite-type.c,
+       * gcc.dg/fixed-point/const-1.c, gcc.dg/fixed-point/constant.c,
+       * gcc.dg/fixed-point/constants-pedantic.c,
+       * gcc.dg/fixed-point/convert.c, gcc.dg/fixed-point/define.c,
+       * gcc.dg/fixed-point/keywords-c89.c, gcc.dg/fixed-point/keywords-c99.c,
+       * gcc.dg/fixed-point/keywords-ignored-c99.c,
+       * gcc.dg/fixed-point/keywords-pedantic.c,
+       * gcc.dg/fixed-point/keywords-reserved.c, gcc.dg/fixed-point/binary.c,
+       * gcc.dg/fixed-point/modes.c, gcc.dg/fixed-point/noassoc.c,
+       * gcc.dg/fixed-point/types.c, gcc.dg/fixed-point/typespec.c,
+       * gcc.dg/fixed-point/unary.c, gcc.dg/fixed-point/func-array.c,
+       * gcc.dg/fixed-point/func-scalar.c, gcc.dg/fixed-point/func-struct.c,
+       * gcc.dg/fixed-point/func-vararg-mixed.c,
+       * gcc.dg/fixed-point/operator-logical.c,
+       * gcc.dg/fixed-point/struct-union.c,
+       * gcc.dg/fixed-point/bit-complement.c,
+       * gcc.dg/fixed-point/operator-bitwise.c,
+       * gcc.dg/fixed-point/operator-comma.c,
+       * gcc.dg/fixed-point/struct-layout-1.c,
+       * gcc.dg/fixed-point/union-init.c,
+       * gcc.dg/fixed-point/Wbad-function-cast-1.c,
+       * gcc.dg/fixed-point/func-mixed.c,
+       * gcc.dg/fixed-point/func-vararg-size0.c,
+       * gcc.dg/fixed-point/func-vararg.c, gcc.dg/fixed-point/int-warning.c,
+       * gcc.dg/fixed-point/loop-index.c, gcc.dg/fixed-point/operator-cond.c,
+       * gcc.dg/fixed-point/operator-unary.c,
+       * gcc.dg/fixed-point/allop-const.c,
+       * gcc.dg/fixed-point/muldiv-warning.c,
+       * gcc.dg/nofixed-point-1.c,
+       * gcc.target/mips/dpaq_sa_l_w.c, gcc.target/mips/dpsq_sa_l_w.c,
+       * gcc.target/mips/fixed-vector-type.c,
+       * gcc.target/mips/fixed-scalar-type.c: New tests.
+
 2007-09-21  Olivier Hainque  <hainque@adacore.com>
 
        * gnat.dg/nested_subtype_byref.ad[bs]: Part of new test.
diff --git a/gcc/testsuite/gcc.dg/fixed-point/Wbad-function-cast-1.c b/gcc/testsuite/gcc.dg/fixed-point/Wbad-function-cast-1.c
new file mode 100644 (file)
index 0000000..e239833
--- /dev/null
@@ -0,0 +1,357 @@
+/* Test operation of -Wbad-function-cast.  */
+/* Based on gcc.dg/Wbad-function-cast-1.c.  */
+
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wbad-function-cast" } */
+
+int if1(void);
+char if2(void);
+long if3(void);
+_Complex double cf(void);
+
+
+#define FUNC(TYPE,NAME) \
+TYPE f ## NAME (void);
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+void
+foo(void)
+{
+#define TEST(NAME) \
+  /* Casts to void types are always OK.  */ \
+  (void) f ## NAME (); \
+  (const void) f ## NAME (); \
+  /* Casts to the same type or similar types are OK.  */ \
+  (short _Fract) f ## NAME (); \
+  (_Fract) f ## NAME (); \
+  (long _Fract) f ## NAME (); \
+  (long long _Fract) f ## NAME (); \
+  (unsigned short _Fract) f ## NAME (); \
+  (unsigned _Fract) f ## NAME (); \
+  (unsigned long _Fract) f ## NAME (); \
+  (unsigned long long _Fract) f ## NAME (); \
+  (_Sat short _Fract) f ## NAME (); \
+  (_Sat _Fract) f ## NAME (); \
+  (_Sat long _Fract) f ## NAME (); \
+  (_Sat long long _Fract) f ## NAME (); \
+  (_Sat unsigned short _Fract) f ## NAME (); \
+  (_Sat unsigned _Fract) f ## NAME (); \
+  (_Sat unsigned long _Fract) f ## NAME (); \
+  (_Sat unsigned long long _Fract) f ## NAME (); \
+  (short _Accum) f ## NAME (); \
+  (_Accum) f ## NAME (); \
+  (long _Accum) f ## NAME (); \
+  (long long _Accum) f ## NAME (); \
+  (unsigned short _Accum) f ## NAME (); \
+  (unsigned _Accum) f ## NAME (); \
+  (unsigned long _Accum) f ## NAME (); \
+  (unsigned long long _Accum) f ## NAME (); \
+  (_Sat short _Accum) f ## NAME (); \
+  (_Sat _Accum) f ## NAME (); \
+  (_Sat long _Accum) f ## NAME (); \
+  (_Sat long long _Accum) f ## NAME (); \
+  (_Sat unsigned short _Accum) f ## NAME (); \
+  (_Sat unsigned _Accum) f ## NAME (); \
+  (_Sat unsigned long _Accum) f ## NAME (); \
+  (_Sat unsigned long long _Accum) f ## NAME (); \
+
+  TEST (sf);
+  TEST (f);
+  TEST (lf);
+  TEST (llf);
+  TEST (usf);
+  TEST (uf);
+  TEST (ulf);
+  TEST (ullf);
+  TEST (Ssf);
+  TEST (Sf);
+  TEST (Slf);
+  TEST (Sllf);
+  TEST (Susf);
+  TEST (Suf);
+  TEST (Sulf);
+  TEST (Sullf);
+  TEST (sa);
+  TEST (a);
+  TEST (la);
+  TEST (lla);
+  TEST (usa);
+  TEST (ua);
+  TEST (ula);
+  TEST (ulla);
+  TEST (Ssa);
+  TEST (Sa);
+  TEST (Sla);
+  TEST (Slla);
+  TEST (Susa);
+  TEST (Sua);
+  TEST (Sula);
+  TEST (Sulla);
+
+   /* Casts to types with different TREE_CODE (which is how this
+     warning has been defined) are not OK, except for casts to void
+     types.  */
+  (short _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'short _Fract'" } */
+  (_Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Fract'" } */
+  (long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'long _Fract'" } */
+  (long long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'long long _Fract'" } */
+  (unsigned short _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned short _Fract'" } */
+  (unsigned _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned _Fract'" } */
+  (unsigned long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned long _Fract'" } */
+  (unsigned long long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned long long _Fract'" } */
+  (_Sat short _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat short _Fract'" } */
+  (_Sat _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat _Fract'" } */
+  (_Sat long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat long _Fract'" } */
+  (_Sat long long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat long long _Fract'" } */
+  (_Sat unsigned short _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned short _Fract'" } */
+  (_Sat unsigned _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned _Fract'" } */
+  (_Sat unsigned long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned long _Fract'" } */
+  (_Sat unsigned long long _Fract)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned long long _Fract'" } */
+  (short _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'short _Accum'" } */
+  (_Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Accum'" } */
+  (long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'long _Accum'" } */
+  (long long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'long long _Accum'" } */
+  (unsigned short _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned short _Accum'" } */
+  (unsigned _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned _Accum'" } */
+  (unsigned long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned long _Accum'" } */
+  (unsigned long long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type 'unsigned long long _Accum'" } */
+  (_Sat short _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat short _Accum'" } */
+  (_Sat _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat _Accum'" } */
+  (_Sat long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat long _Accum'" } */
+  (_Sat long long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat long long _Accum'" } */
+  (_Sat unsigned short _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned short _Accum'" } */
+  (_Sat unsigned _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned _Accum'" } */
+  (_Sat unsigned long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned long _Accum'" } */
+  (_Sat unsigned long long _Accum)if1(); /* { dg-warning "cast from function call of type 'int' to non-matching type '_Sat unsigned long long _Accum'" } */
+
+  (short _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'short _Fract'" } */
+  (_Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Fract'" } */
+  (long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'long _Fract'" } */
+  (long long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'long long _Fract'" } */
+  (unsigned short _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned short _Fract'" } */
+  (unsigned _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned _Fract'" } */
+  (unsigned long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned long _Fract'" } */
+  (unsigned long long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned long long _Fract'" } */
+  (_Sat short _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat short _Fract'" } */
+  (_Sat _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat _Fract'" } */
+  (_Sat long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat long _Fract'" } */
+  (_Sat long long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat long long _Fract'" } */
+  (_Sat unsigned short _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned short _Fract'" } */
+  (_Sat unsigned _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned _Fract'" } */
+  (_Sat unsigned long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned long _Fract'" } */
+  (_Sat unsigned long long _Fract)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned long long _Fract'" } */
+  (short _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'short _Accum'" } */
+  (_Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Accum'" } */
+  (long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'long _Accum'" } */
+  (long long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'long long _Accum'" } */
+  (unsigned short _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned short _Accum'" } */
+  (unsigned _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned _Accum'" } */
+  (unsigned long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned long _Accum'" } */
+  (unsigned long long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type 'unsigned long long _Accum'" } */
+  (_Sat short _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat short _Accum'" } */
+  (_Sat _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat _Accum'" } */
+  (_Sat long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat long _Accum'" } */
+  (_Sat long long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat long long _Accum'" } */
+  (_Sat unsigned short _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned short _Accum'" } */
+  (_Sat unsigned _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned _Accum'" } */
+  (_Sat unsigned long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned long _Accum'" } */
+  (_Sat unsigned long long _Accum)if2(); /* { dg-warning "cast from function call of type 'char' to non-matching type '_Sat unsigned long long _Accum'" } */
+
+  (short _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'short _Fract'" } */
+  (_Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Fract'" } */
+  (long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'long _Fract'" } */
+  (long long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'long long _Fract'" } */
+  (unsigned short _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned short _Fract'" } */
+  (unsigned _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned _Fract'" } */
+  (unsigned long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned long _Fract'" } */
+  (unsigned long long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned long long _Fract'" } */
+  (_Sat short _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat short _Fract'" } */
+  (_Sat _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat _Fract'" } */
+  (_Sat long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat long _Fract'" } */
+  (_Sat long long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat long long _Fract'" } */
+  (_Sat unsigned short _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned short _Fract'" } */
+  (_Sat unsigned _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned _Fract'" } */
+  (_Sat unsigned long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned long _Fract'" } */
+  (_Sat unsigned long long _Fract)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned long long _Fract'" } */
+  (short _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'short _Accum'" } */
+  (_Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Accum'" } */
+  (long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'long _Accum'" } */
+  (long long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'long long _Accum'" } */
+  (unsigned short _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned short _Accum'" } */
+  (unsigned _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned _Accum'" } */
+  (unsigned long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned long _Accum'" } */
+  (unsigned long long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type 'unsigned long long _Accum'" } */
+  (_Sat short _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat short _Accum'" } */
+  (_Sat _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat _Accum'" } */
+  (_Sat long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat long _Accum'" } */
+  (_Sat long long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat long long _Accum'" } */
+  (_Sat unsigned short _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned short _Accum'" } */
+  (_Sat unsigned _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned _Accum'" } */
+  (_Sat unsigned long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned long _Accum'" } */
+  (_Sat unsigned long long _Accum)if3(); /* { dg-warning "cast from function call of type 'long int' to non-matching type '_Sat unsigned long long _Accum'" } */
+
+  (short _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'short _Fract'" } */
+  (_Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Fract'" } */
+  (long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'long _Fract'" } */
+  (long long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'long long _Fract'" } */
+  (unsigned short _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned short _Fract'" } */
+  (unsigned _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned _Fract'" } */
+  (unsigned long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned long _Fract'" } */
+  (unsigned long long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned long long _Fract'" } */
+  (_Sat short _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat short _Fract'" } */
+  (_Sat _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat _Fract'" } */
+  (_Sat long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat long _Fract'" } */
+  (_Sat long long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat long long _Fract'" } */
+  (_Sat unsigned short _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned short _Fract'" } */
+  (_Sat unsigned _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned _Fract'" } */
+  (_Sat unsigned long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned long _Fract'" } */
+  (_Sat unsigned long long _Fract)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned long long _Fract'" } */
+  (short _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'short _Accum'" } */
+  (_Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Accum'" } */
+  (long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'long _Accum'" } */
+  (long long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'long long _Accum'" } */
+  (unsigned short _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned short _Accum'" } */
+  (unsigned _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned _Accum'" } */
+  (unsigned long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned long _Accum'" } */
+  (unsigned long long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type 'unsigned long long _Accum'" } */
+  (_Sat short _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat short _Accum'" } */
+  (_Sat _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat _Accum'" } */
+  (_Sat long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat long _Accum'" } */
+  (_Sat long long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat long long _Accum'" } */
+  (_Sat unsigned short _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned short _Accum'" } */
+  (_Sat unsigned _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned _Accum'" } */
+  (_Sat unsigned long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned long _Accum'" } */
+  (_Sat unsigned long long _Accum)cf(); /* { dg-warning "cast from function call of type 'complex double' to non-matching type '_Sat unsigned long long _Accum'" } */
+
+  (int)fsf(); /* { dg-warning "cast from function call of type 'short _Fract' to non-matching type 'int'" } */
+  (int)ff(); /* { dg-warning "cast from function call of type '_Fract' to non-matching type 'int'" } */
+  (int)flf(); /* { dg-warning "cast from function call of type 'long _Fract' to non-matching type 'int'" } */
+  (int)fllf(); /* { dg-warning "cast from function call of type 'long long _Fract' to non-matching type 'int'" } */
+  (int)fusf(); /* { dg-warning "cast from function call of type 'unsigned short _Fract' to non-matching type 'int'" } */
+  (int)fuf(); /* { dg-warning "cast from function call of type 'unsigned _Fract' to non-matching type 'int'" } */
+  (int)fulf(); /* { dg-warning "cast from function call of type 'unsigned long _Fract' to non-matching type 'int'" } */
+  (int)fullf(); /* { dg-warning "cast from function call of type 'unsigned long long _Fract' to non-matching type 'int'" } */
+  (int)fSsf(); /* { dg-warning "cast from function call of type '_Sat short _Fract' to non-matching type 'int'" } */
+  (int)fSf(); /* { dg-warning "cast from function call of type '_Sat _Fract' to non-matching type 'int'" } */
+  (int)fSlf(); /* { dg-warning "cast from function call of type '_Sat long _Fract' to non-matching type 'int'" } */
+  (int)fSllf(); /* { dg-warning "cast from function call of type '_Sat long long _Fract' to non-matching type 'int'" } */
+  (int)fSusf(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Fract' to non-matching type 'int'" } */
+  (int)fSuf(); /* { dg-warning "cast from function call of type '_Sat unsigned _Fract' to non-matching type 'int'" } */
+  (int)fSulf(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Fract' to non-matching type 'int'" } */
+  (int)fSullf(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Fract' to non-matching type 'int'" } */
+  (int)fsa(); /* { dg-warning "cast from function call of type 'short _Accum' to non-matching type 'int'" } */
+  (int)fa(); /* { dg-warning "cast from function call of type '_Accum' to non-matching type 'int'" } */
+  (int)fla(); /* { dg-warning "cast from function call of type 'long _Accum' to non-matching type 'int'" } */
+  (int)flla(); /* { dg-warning "cast from function call of type 'long long _Accum' to non-matching type 'int'" } */
+  (int)fusa(); /* { dg-warning "cast from function call of type 'unsigned short _Accum' to non-matching type 'int'" } */
+  (int)fua(); /* { dg-warning "cast from function call of type 'unsigned _Accum' to non-matching type 'int'" } */
+  (int)fula(); /* { dg-warning "cast from function call of type 'unsigned long _Accum' to non-matching type 'int'" } */
+  (int)fulla(); /* { dg-warning "cast from function call of type 'unsigned long long _Accum' to non-matching type 'int'" } */
+  (int)fSsa(); /* { dg-warning "cast from function call of type '_Sat short _Accum' to non-matching type 'int'" } */
+  (int)fSa(); /* { dg-warning "cast from function call of type '_Sat _Accum' to non-matching type 'int'" } */
+  (int)fSla(); /* { dg-warning "cast from function call of type '_Sat long _Accum' to non-matching type 'int'" } */
+  (int)fSlla(); /* { dg-warning "cast from function call of type '_Sat long long _Accum' to non-matching type 'int'" } */
+  (int)fSusa(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Accum' to non-matching type 'int'" } */
+  (int)fSua(); /* { dg-warning "cast from function call of type '_Sat unsigned _Accum' to non-matching type 'int'" } */
+  (int)fSula(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Accum' to non-matching type 'int'" } */
+  (int)fSulla(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Accum' to non-matching type 'int'" } */
+
+  (long)fsf(); /* { dg-warning "cast from function call of type 'short _Fract' to non-matching type 'long int'" } */
+  (long)ff(); /* { dg-warning "cast from function call of type '_Fract' to non-matching type 'long int'" } */
+  (long)flf(); /* { dg-warning "cast from function call of type 'long _Fract' to non-matching type 'long int'" } */
+  (long)fllf(); /* { dg-warning "cast from function call of type 'long long _Fract' to non-matching type 'long int'" } */
+  (long)fusf(); /* { dg-warning "cast from function call of type 'unsigned short _Fract' to non-matching type 'long int'" } */
+  (long)fuf(); /* { dg-warning "cast from function call of type 'unsigned _Fract' to non-matching type 'long int'" } */
+  (long)fulf(); /* { dg-warning "cast from function call of type 'unsigned long _Fract' to non-matching type 'long int'" } */
+  (long)fullf(); /* { dg-warning "cast from function call of type 'unsigned long long _Fract' to non-matching type 'long int'" } */
+  (long)fSsf(); /* { dg-warning "cast from function call of type '_Sat short _Fract' to non-matching type 'long int'" } */
+  (long)fSf(); /* { dg-warning "cast from function call of type '_Sat _Fract' to non-matching type 'long int'" } */
+  (long)fSlf(); /* { dg-warning "cast from function call of type '_Sat long _Fract' to non-matching type 'long int'" } */
+  (long)fSllf(); /* { dg-warning "cast from function call of type '_Sat long long _Fract' to non-matching type 'long int'" } */
+  (long)fSusf(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Fract' to non-matching type 'long int'" } */
+  (long)fSuf(); /* { dg-warning "cast from function call of type '_Sat unsigned _Fract' to non-matching type 'long int'" } */
+  (long)fSulf(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Fract' to non-matching type 'long int'" } */
+  (long)fSullf(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Fract' to non-matching type 'long int'" } */
+  (long)fsa(); /* { dg-warning "cast from function call of type 'short _Accum' to non-matching type 'long int'" } */
+  (long)fa(); /* { dg-warning "cast from function call of type '_Accum' to non-matching type 'long int'" } */
+  (long)fla(); /* { dg-warning "cast from function call of type 'long _Accum' to non-matching type 'long int'" } */
+  (long)flla(); /* { dg-warning "cast from function call of type 'long long _Accum' to non-matching type 'long int'" } */
+  (long)fusa(); /* { dg-warning "cast from function call of type 'unsigned short _Accum' to non-matching type 'long int'" } */
+  (long)fua(); /* { dg-warning "cast from function call of type 'unsigned _Accum' to non-matching type 'long int'" } */
+  (long)fula(); /* { dg-warning "cast from function call of type 'unsigned long _Accum' to non-matching type 'long int'" } */
+  (long)fulla(); /* { dg-warning "cast from function call of type 'unsigned long long _Accum' to non-matching type 'long int'" } */
+  (long)fSsa(); /* { dg-warning "cast from function call of type '_Sat short _Accum' to non-matching type 'long int'" } */
+  (long)fSa(); /* { dg-warning "cast from function call of type '_Sat _Accum' to non-matching type 'long int'" } */
+  (long)fSla(); /* { dg-warning "cast from function call of type '_Sat long _Accum' to non-matching type 'long int'" } */
+  (long)fSlla(); /* { dg-warning "cast from function call of type '_Sat long long _Accum' to non-matching type 'long int'" } */
+  (long)fSusa(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Accum' to non-matching type 'long int'" } */
+  (long)fSua(); /* { dg-warning "cast from function call of type '_Sat unsigned _Accum' to non-matching type 'long int'" } */
+  (long)fSula(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Accum' to non-matching type 'long int'" } */
+  (long)fSulla(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Accum' to non-matching type 'long int'" } */
+
+  (long int)fsf(); /* { dg-warning "cast from function call of type 'short _Fract' to non-matching type 'long int'" } */
+  (long int)ff(); /* { dg-warning "cast from function call of type '_Fract' to non-matching type 'long int'" } */
+  (long int)flf(); /* { dg-warning "cast from function call of type 'long _Fract' to non-matching type 'long int'" } */
+  (long int)fllf(); /* { dg-warning "cast from function call of type 'long long _Fract' to non-matching type 'long int'" } */
+  (long int)fusf(); /* { dg-warning "cast from function call of type 'unsigned short _Fract' to non-matching type 'long int'" } */
+  (long int)fuf(); /* { dg-warning "cast from function call of type 'unsigned _Fract' to non-matching type 'long int'" } */
+  (long int)fulf(); /* { dg-warning "cast from function call of type 'unsigned long _Fract' to non-matching type 'long int'" } */
+  (long int)fullf(); /* { dg-warning "cast from function call of type 'unsigned long long _Fract' to non-matching type 'long int'" } */
+  (long int)fSsf(); /* { dg-warning "cast from function call of type '_Sat short _Fract' to non-matching type 'long int'" } */
+  (long int)fSf(); /* { dg-warning "cast from function call of type '_Sat _Fract' to non-matching type 'long int'" } */
+  (long int)fSlf(); /* { dg-warning "cast from function call of type '_Sat long _Fract' to non-matching type 'long int'" } */
+  (long int)fSllf(); /* { dg-warning "cast from function call of type '_Sat long long _Fract' to non-matching type 'long int'" } */
+  (long int)fSusf(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Fract' to non-matching type 'long int'" } */
+  (long int)fSuf(); /* { dg-warning "cast from function call of type '_Sat unsigned _Fract' to non-matching type 'long int'" } */
+  (long int)fSulf(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Fract' to non-matching type 'long int'" } */
+  (long int)fSullf(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Fract' to non-matching type 'long int'" } */
+  (long int)fsa(); /* { dg-warning "cast from function call of type 'short _Accum' to non-matching type 'long int'" } */
+  (long int)fa(); /* { dg-warning "cast from function call of type '_Accum' to non-matching type 'long int'" } */
+  (long int)fla(); /* { dg-warning "cast from function call of type 'long _Accum' to non-matching type 'long int'" } */
+  (long int)flla(); /* { dg-warning "cast from function call of type 'long long _Accum' to non-matching type 'long int'" } */
+  (long int)fusa(); /* { dg-warning "cast from function call of type 'unsigned short _Accum' to non-matching type 'long int'" } */
+  (long int)fua(); /* { dg-warning "cast from function call of type 'unsigned _Accum' to non-matching type 'long int'" } */
+  (long int)fula(); /* { dg-warning "cast from function call of type 'unsigned long _Accum' to non-matching type 'long int'" } */
+  (long int)fulla(); /* { dg-warning "cast from function call of type 'unsigned long long _Accum' to non-matching type 'long int'" } */
+  (long int)fSsa(); /* { dg-warning "cast from function call of type '_Sat short _Accum' to non-matching type 'long int'" } */
+  (long int)fSa(); /* { dg-warning "cast from function call of type '_Sat _Accum' to non-matching type 'long int'" } */
+  (long int)fSla(); /* { dg-warning "cast from function call of type '_Sat long _Accum' to non-matching type 'long int'" } */
+  (long int)fSlla(); /* { dg-warning "cast from function call of type '_Sat long long _Accum' to non-matching type 'long int'" } */
+  (long int)fSusa(); /* { dg-warning "cast from function call of type '_Sat unsigned short _Accum' to non-matching type 'long int'" } */
+  (long int)fSua(); /* { dg-warning "cast from function call of type '_Sat unsigned _Accum' to non-matching type 'long int'" } */
+  (long int)fSula(); /* { dg-warning "cast from function call of type '_Sat unsigned long _Accum' to non-matching type 'long int'" } */
+  (long int)fSulla(); /* { dg-warning "cast from function call of type '_Sat unsigned long long _Accum' to non-matching type 'long int'" } */
+
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/addsub.c b/gcc/testsuite/gcc.dg/fixed-point/addsub.c
new file mode 100644 (file)
index 0000000..c2ab38f
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* Check if GCC generates warnings when overflows.  */
+
+_Fract a0 = 0.5r + 0.5r; /* { dg-warning "overflow" } */
+_Fract a1 = 0.5r + 0.6r; /* { dg-warning "overflow" } */
+_Fract a2 = 0.5r + -0.6r;
+_Fract a3 = -0.5r + 0.6r;
+_Fract a4 = -0.5r + -0.5r;
+_Fract a5 = -0.5r + -0.6r; /* { dg-warning "overflow" } */
+_Fract a6 = 0.0r + __FRACT_MIN__;
+_Fract a7 = 0.1r + __FRACT_MIN__;
+_Fract a8 = -0.1r + __FRACT_MIN__; /* { dg-warning "overflow" } */
+_Fract a9 = 0.0r + __FRACT_MAX__;
+_Fract a10 = 0.1r + __FRACT_MAX__; /* { dg-warning "overflow" } */
+_Fract a11 = -0.1r + __FRACT_MAX__;
+
+_Fract b0 = 0.5r - 0.5r;
+_Fract b1 = 0.5r - 0.6r;
+_Fract b2 = 0.5r - -0.6r; /* { dg-warning "overflow" } */
+_Fract b3 = -0.5r - 0.6r; /* { dg-warning "overflow" } */
+_Fract b4 = -0.5r - -0.5r;
+_Fract b5 = -0.5r - -0.6r;
+_Fract b6 = 0.0r - __FRACT_MIN__; /* { dg-warning "overflow" } */
+_Fract b7 = 0.1r - __FRACT_MIN__; /* { dg-warning "overflow" } */
+_Fract b8 = -0.1r - __FRACT_MIN__;
+_Fract b9 = 0.0r - __FRACT_MAX__;
+_Fract b10 = 0.1r - __FRACT_MAX__;
+_Fract b11 = -0.1r - __FRACT_MAX__; /* { dg-warning "overflow" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/allconv.c b/gcc/testsuite/gcc.dg/fixed-point/allconv.c
new file mode 100644 (file)
index 0000000..e0440da
--- /dev/null
@@ -0,0 +1,150 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.3 Conversions.
+
+   Check if all conversions are ok.  */
+
+#define CONV(TYPE, NAME) \
+        float NAME ## _to_SF (TYPE a) { return a; } \
+        float Sat ## NAME ## _to_SF (_Sat TYPE a) { return a; } \
+        double NAME ## _to_DF (TYPE a) { return a; } \
+        double Sat ## NAME ## _to_DF (_Sat TYPE a) { return a; } \
+        TYPE SF_to_ ## NAME (float a) { return a; } \
+        _Sat TYPE SF_to_Sat ## NAME (float a) { return a; } \
+        TYPE DF_to_ ## NAME (double a) { return a; } \
+        _Sat TYPE DF_to_Sat ## NAME (double a) { return a; } \
+        signed char NAME ## _to_schar (TYPE a) { return a; } \
+        signed char Sat ## NAME ## _to_schar (_Sat TYPE a) { return a; } \
+        unsigned char NAME ## _to_uchar (TYPE a) { return a; } \
+        unsigned char Sat ## NAME ## _to_uchar (_Sat TYPE a) { return a; } \
+        short NAME ## _to_short (TYPE a) { return a; } \
+        short _Sat ## NAME ## _to_short (_Sat TYPE a) { return a; } \
+        unsigned short NAME ## _to_ushort (TYPE a) { return a; } \
+        unsigned short _Sat ## NAME ## _to_ushort (_Sat TYPE a) { return a; } \
+        int NAME ## _to_int (TYPE a) { return a; } \
+        int _Sat ## NAME ## _to_int (_Sat TYPE a) { return a; } \
+        unsigned int NAME ## _to_uint (TYPE a) { return a; } \
+        unsigned int _Sat ## NAME ## _to_uint (_Sat TYPE a) { return a; } \
+        long NAME ## _to_long (TYPE a) { return a; } \
+        unsigned long NAME ## _to_ulong (TYPE a) { return a; } \
+        long _Sat ## NAME ## _to_long (TYPE a) { return a; } \
+        unsigned long _Sat ## NAME ## _to_ulong (TYPE a) { return a; } \
+        long long NAME ## _to_longlong (TYPE a) { return a; } \
+        long long _Sat ## NAME ## _to_longlong (TYPE a) { return a; } \
+        unsigned long long NAME ## _to_ulonglong (TYPE a) { return a; } \
+        unsigned long long _Sat ## NAME ## _to_ulonglong (TYPE a) { return a; } \
+        TYPE schar_to_ ## NAME (signed char a) { return a; } \
+        _Sat TYPE schar_to_Sat ## NAME (signed char a) { return a; } \
+        TYPE uchar_to_ ## NAME (unsigned char a) { return a; } \
+        _Sat TYPE uchar_to_Sat ## NAME (unsigned char a) { return a; } \
+        TYPE short_to_ ## NAME (short a) { return a; } \
+        TYPE ushort_to_ ## NAME (unsigned short a) { return a; } \
+        TYPE int_to_ ## NAME (int a) { return a; } \
+        TYPE uint_to_ ## NAME (unsigned int a) { return a; } \
+        TYPE long_to_ ## NAME (long a) { return a; } \
+        TYPE ulong_to_ ## NAME (unsigned long a) { return a; } \
+        TYPE longlong_to_ ## NAME (long long a) { return a; } \
+        TYPE ulonglong_to_ ## NAME (unsigned long long a) { return a; } \
+        _Sat TYPE short_to_Sat ## NAME (short a) { return a; } \
+        _Sat TYPE ushort_to_Sat ## NAME (unsigned short a) { return a; } \
+        _Sat TYPE int_to_Sat ## NAME (int a) { return a; } \
+        _Sat TYPE uint_to_Sat ## NAME (unsigned int a) { return a; } \
+        _Sat TYPE long_to_Sat ## NAME (long a) { return a; } \
+        _Sat TYPE ulong_to_Sat ## NAME (unsigned long a) { return a; } \
+        _Sat TYPE longlong_to_Sat ## NAME (long long a) { return a; } \
+        _Sat TYPE ulonglong_to_Sat ## NAME (unsigned long long a) { return a; } \
+       TYPE SFR_to ## NAME (short _Fract a) { return a; } \
+       TYPE FR_to ## NAME (_Fract a) { return a; } \
+       TYPE LFR_to ## NAME (long _Fract a) { return a; } \
+       TYPE LLFR_to ## NAME (long long _Fract a) { return a; } \
+       TYPE USFR_to ## NAME (unsigned short _Fract a) { return a; } \
+       TYPE UFR_to ## NAME (unsigned _Fract a) { return a; } \
+       TYPE ULFR_to ## NAME (unsigned long _Fract a) { return a; } \
+       TYPE ULLFR_to ## NAME (unsigned long long _Fract a) { return a; } \
+       TYPE SAC_to ## NAME (short _Accum a) { return a; } \
+       TYPE AC_to ## NAME (_Accum a) { return a; } \
+       TYPE LAC_to ## NAME (long _Accum a) { return a; } \
+       TYPE LLAC_to ## NAME (long long _Accum a) { return a; } \
+       TYPE USAC_to ## NAME (unsigned short _Accum a) { return a; } \
+       TYPE UAC_to ## NAME (unsigned _Accum a) { return a; } \
+       TYPE ULAC_to ## NAME (unsigned long _Accum a) { return a; } \
+       TYPE ULLAC_to ## NAME (unsigned long long _Accum a) { return a; } \
+       TYPE SATSFR_to ## NAME (_Sat short _Fract a) { return a; } \
+       TYPE SATFR_to ## NAME (_Sat _Fract a) { return a; } \
+       TYPE SATLFR_to ## NAME (_Sat long _Fract a) { return a; } \
+       TYPE SATLLFR_to ## NAME (_Sat long long _Fract a) { return a; } \
+       TYPE SATUSFR_to ## NAME (_Sat unsigned short _Fract a) { return a; } \
+       TYPE SATUFR_to ## NAME (_Sat unsigned _Fract a) { return a; } \
+       TYPE SATULFR_to ## NAME (_Sat unsigned long _Fract a) { return a; } \
+       TYPE SATULLFR_to ## NAME (_Sat unsigned long long _Fract a) { return a; } \
+       TYPE SATSAC_to ## NAME (_Sat short _Accum a) { return a; } \
+       TYPE SATAC_to ## NAME (_Sat _Accum a) { return a; } \
+       TYPE SATLAC_to ## NAME (_Sat long _Accum a) { return a; } \
+       TYPE SATLLAC_to ## NAME (_Sat long long _Accum a) { return a; } \
+       TYPE SATUSAC_to ## NAME (_Sat unsigned short _Accum a) { return a; } \
+       TYPE SATUAC_to ## NAME (_Sat unsigned _Accum a) { return a; } \
+       TYPE SATULAC_to ## NAME (_Sat unsigned long _Accum a) { return a; } \
+       TYPE SATULLAC_to ## NAME (_Sat unsigned long long _Accum a) { return a; } \
+       _Sat TYPE SFR_to_SAT ## NAME (short _Fract a) { return a; } \
+       _Sat TYPE FR_to_SAT ## NAME (_Fract a) { return a; } \
+       _Sat TYPE LFR_to_SAT ## NAME (long _Fract a) { return a; } \
+       _Sat TYPE LLFR_to_SAT ## NAME (long long _Fract a) { return a; } \
+       _Sat TYPE USFR_to_SAT ## NAME (unsigned short _Fract a) { return a; } \
+       _Sat TYPE UFR_to_SAT ## NAME (unsigned _Fract a) { return a; } \
+       _Sat TYPE ULFR_to_SAT ## NAME (unsigned long _Fract a) { return a; } \
+       _Sat TYPE ULLFR_to_SAT ## NAME (unsigned long long _Fract a) { return a; } \
+       _Sat TYPE SAC_to_SAT ## NAME (short _Accum a) { return a; } \
+       _Sat TYPE AC_to_SAT ## NAME (_Accum a) { return a; } \
+       _Sat TYPE LAC_to_SAT ## NAME (long _Accum a) { return a; } \
+       _Sat TYPE LLAC_to_SAT ## NAME (long long _Accum a) { return a; } \
+       _Sat TYPE USAC_to_SAT ## NAME (unsigned short _Accum a) { return a; } \
+       _Sat TYPE UAC_to_SAT ## NAME (unsigned _Accum a) { return a; } \
+       _Sat TYPE ULAC_to_SAT ## NAME (unsigned long _Accum a) { return a; } \
+       _Sat TYPE ULLAC_to_SAT ## NAME (unsigned long long _Accum a) { return a; } \
+       _Sat TYPE SATSFR_to_SAT ## NAME (_Sat short _Fract a) { return a; } \
+       _Sat TYPE SATFR_to_SAT ## NAME (_Sat _Fract a) { return a; } \
+       _Sat TYPE SATLFR_to_SAT ## NAME (_Sat long _Fract a) { return a; } \
+       _Sat TYPE SATLLFR_to_SAT ## NAME (_Sat long long _Fract a) { return a; } \
+       _Sat TYPE SATUSFR_to_SAT ## NAME (_Sat unsigned short _Fract a) { return a; } \
+       _Sat TYPE SATUFR_to_SAT ## NAME (_Sat unsigned _Fract a) { return a; } \
+       _Sat TYPE SATULFR_to_SAT ## NAME (_Sat unsigned long _Fract a) { return a; } \
+       _Sat TYPE SATULLFR_to_SAT ## NAME (_Sat unsigned long long _Fract a) { return a; } \
+       _Sat TYPE SATSAC_to_SAT ## NAME (_Sat short _Accum a) { return a; } \
+       _Sat TYPE SATAC_to_SAT ## NAME (_Sat _Accum a) { return a; } \
+       _Sat TYPE SATLAC_to_SAT ## NAME (_Sat long _Accum a) { return a; } \
+       _Sat TYPE SATLLAC_to_SAT ## NAME (_Sat long long _Accum a) { return a; } \
+       _Sat TYPE SATUSAC_to_SAT ## NAME (_Sat unsigned short _Accum a) { return a; } \
+       _Sat TYPE SATUAC_to_SAT ## NAME (_Sat unsigned _Accum a) { return a; } \
+       _Sat TYPE SATULAC_to_SAT ## NAME (_Sat unsigned long _Accum a) { return a; } \
+       _Sat TYPE SATULLAC_to_SAT ## NAME (_Sat unsigned long long _Accum a) { return a; } \
+       _Complex int NAME ## _to_CI (TYPE a) { return a; } \
+       _Complex unsigned int NAME ## _to_CUI (TYPE a) { return a; } \
+       _Complex float NAME ## _to_CF (TYPE a) { return a; } \
+       _Complex double NAME ## _to_CD (TYPE a) { return a; } \
+       TYPE CI_to_ ## NAME (_Complex int a) { return a; } \
+       TYPE CUI_to_ ## NAME (_Complex unsigned int a) { return a; } \
+       TYPE CF_to_ ## NAME (_Complex float a) { return a; } \
+       TYPE CD_to_ ## NAME (_Complex double a) { return a; } \
+       _Sat TYPE CI_to_SAT ## NAME (_Complex int a) { return a; } \
+       _Sat TYPE CUI_to_SAT ## NAME (_Complex unsigned int a) { return a; } \
+       _Sat TYPE CF_to_SAT ## NAME (_Complex float a) { return a; } \
+       _Sat TYPE CD_to_SAT ## NAME (_Complex double a) { return a; }
+
+CONV(short _Fract, sf);
+CONV(_Fract, f);
+CONV(long _Fract, lf);
+CONV(long long _Fract, llf);
+CONV(unsigned short _Fract, usf);
+CONV(unsigned _Fract, uf);
+CONV(unsigned long _Fract, ulf);
+CONV(unsigned long long _Fract, ullf);
+
+CONV(short _Accum, sk);
+CONV(_Accum, k);
+CONV(long _Accum, lk);
+CONV(long long _Accum, llk);
+CONV(unsigned short _Accum, usk);
+CONV(unsigned _Accum, uk);
+CONV(unsigned long _Accum, ulk);
+CONV(unsigned long long _Accum, ullk);
diff --git a/gcc/testsuite/gcc.dg/fixed-point/allop-const.c b/gcc/testsuite/gcc.dg/fixed-point/allop-const.c
new file mode 100644 (file)
index 0000000..1cf8598
--- /dev/null
@@ -0,0 +1,147 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.5.7 - Bitwise shift operands.
+   C99 6.5.3 Unary operators.
+   C99 6.5.5 Multiplicative operators.
+   C99 6.5.6 Additive operators.
+   C99 6.5.7 Bitwise shift operators.
+   C99 6.5.8 Relational operators.
+   C99 6.5.9 Equality operators.
+   C99 6.5.16 Assignment operators.
+
+   Check if all operations on constants are ok.  */
+
+#define ALLOPCONST(TYPE,NAME,POSTFIX) \
+       TYPE NAME ## plus = +0.1 ## POSTFIX; \
+       unsigned TYPE NAME ## u_plus = +0.1u ## POSTFIX; \
+       _Sat TYPE NAME ## sat_plus = +(_Sat TYPE)0.1 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_plus = +(_Sat unsigned TYPE)0.1u ## POSTFIX; \
+       TYPE NAME ## neg = -0.1 ## POSTFIX; \
+       _Sat TYPE NAME ## sat_neg = -(_Sat TYPE)0.1 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_neg = -(_Sat unsigned TYPE)0.1u ## POSTFIX; \
+       int NAME ## logneg1 = !0.1 ## POSTFIX; \
+       int NAME ## logneg1u = !0.1u ## POSTFIX; \
+       int NAME ## logneg2 = !0.0 ## POSTFIX; \
+       int NAME ## logneg2u = !0.0u ## POSTFIX; \
+       TYPE NAME ## add = 0.1 ## POSTFIX + 0.2 ## POSTFIX; \
+       unsigned TYPE NAME ## u_add = 0.1u ## POSTFIX + 0.2u ## POSTFIX; \
+       _Sat TYPE NAME ## sat_add = (_Sat TYPE)0.8 ## POSTFIX + 0.3 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_add = (_Sat unsigned TYPE)0.8u ## POSTFIX + 0.3u ## POSTFIX; \
+       TYPE NAME ## sub = 0.1 ## POSTFIX - 0.2 ## POSTFIX; \
+       unsigned TYPE NAME ## u_sub = 0.2u ## POSTFIX - 0.1u ## POSTFIX; \
+       _Sat TYPE NAME ## sat_sub = (_Sat TYPE)0.1 ## POSTFIX - 0.2 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_sub = (_Sat unsigned TYPE)0.1u ## POSTFIX - 0.2u ## POSTFIX; \
+       TYPE NAME ## mul = 0.1 ## POSTFIX * 0.2 ## POSTFIX; \
+       unsigned TYPE NAME ## u_mul = 0.1u ## POSTFIX * 0.2u ## POSTFIX; \
+       _Sat TYPE NAME ## sat_mul = (_Sat TYPE)0.1 ## POSTFIX * 0.2 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_mul = (_Sat unsigned TYPE)0.1u ## POSTFIX * 0.2u ## POSTFIX; \
+       TYPE NAME ## div = 0.1 ## POSTFIX / 0.3 ## POSTFIX; \
+       unsigned TYPE NAME ## u_div = 0.1u ## POSTFIX / 0.3u ## POSTFIX; \
+       _Sat TYPE NAME ## sat_div = (_Sat TYPE)0.3 ## POSTFIX / 0.1 ## POSTFIX; \
+       _Sat unsigned TYPE NAME ## sat_u_div = (_Sat unsigned TYPE)0.3u ## POSTFIX / 0.1u ## POSTFIX; \
+       TYPE NAME ## shl = 0.1 ## POSTFIX << 3; \
+       unsigned TYPE NAME ## u_shl = 0.1u ## POSTFIX << 3; \
+       _Sat TYPE NAME ## sat_shl = (_Sat TYPE)0.8 ## POSTFIX << 3; \
+       _Sat unsigned TYPE NAME ## sat_u_shl = (_Sat unsigned TYPE)0.8u ## POSTFIX << 3; \
+       TYPE NAME ## shr = 0.1 ## POSTFIX >> 5; \
+       unsigned TYPE NAME ## u_shr = 0.1u ## POSTFIX >> 5; \
+       _Sat TYPE NAME ## sat_shr = (_Sat TYPE)0.1 ## POSTFIX >> 5; \
+       _Sat unsigned TYPE NAME ## sat_u_shr = (_Sat unsigned TYPE)0.1 ## POSTFIX >> 5; \
+       int NAME ## ne = 0.1 ## POSTFIX != 0.2 ## POSTFIX; \
+       int NAME ## u_ne = 0.1u ## POSTFIX != 0.2u ## POSTFIX; \
+       int NAME ## eq = 0.1 ## POSTFIX == 0.2 ## POSTFIX; \
+       int NAME ## u_eq = 0.1u ## POSTFIX == 0.2u ## POSTFIX; \
+       int NAME ## gt = 0.1 ## POSTFIX > 0.2 ## POSTFIX; \
+       int NAME ## u_gt = 0.1u ## POSTFIX > 0.2u ## POSTFIX; \
+       int NAME ## ge = 0.1 ## POSTFIX >= 0.2 ## POSTFIX; \
+       int NAME ## u_ge = 0.1u ## POSTFIX >= 0.2 ## POSTFIX; \
+       int NAME ## lt = 0.1 ## POSTFIX < 0.2 ## POSTFIX; \
+       int NAME ## u_lt = 0.1u ## POSTFIX < 0.2 ## POSTFIX; \
+       int NAME ## le = 0.1 ## POSTFIX <= 0.2 ## POSTFIX; \
+       int NAME ## u_le = 0.1u ## POSTFIX <= 0.2 ## POSTFIX; \
+       int NAME ## ne2 = 0.2 ## POSTFIX != 0.2 ## POSTFIX; \
+       int NAME ## u_ne2 = 0.2u ## POSTFIX != 0.2u ## POSTFIX; \
+       int NAME ## eq2 = 0.2 ## POSTFIX == 0.2 ## POSTFIX; \
+       int NAME ## u_eq2 = 0.2u ## POSTFIX == 0.2u ## POSTFIX; \
+       int NAME ## gt2 = 0.2 ## POSTFIX > 0.2 ## POSTFIX; \
+       int NAME ## u_gt2 = 0.2u ## POSTFIX > 0.2u ## POSTFIX; \
+       int NAME ## ge2 = 0.2 ## POSTFIX >= 0.2 ## POSTFIX; \
+       int NAME ## u_ge2 = 0.2u ## POSTFIX >= 0.2 ## POSTFIX; \
+       int NAME ## lt2 = 0.2 ## POSTFIX < 0.2 ## POSTFIX; \
+       int NAME ## u_lt2 = 0.2u ## POSTFIX < 0.2 ## POSTFIX; \
+       int NAME ## le2 = 0.2 ## POSTFIX <= 0.2 ## POSTFIX; \
+       int NAME ## u_le2 = 0.2u ## POSTFIX <= 0.2 ## POSTFIX; \
+       TYPE NAME ## hr_signed = 0.1hr; \
+       unsigned TYPE NAME ## hr_unsigned = 0.1hr; \
+       _Sat TYPE NAME ## hr_sat_signed = 0.1hr; \
+       _Sat unsigned TYPE NAME ## hr_sat_unsigned = 0.1hr; \
+       TYPE NAME ## r_signed = 0.1r; \
+       unsigned TYPE NAME ## r_unsigned = 0.1r; \
+       _Sat TYPE NAME ## r_sat_signed = 0.1r; \
+       _Sat unsigned TYPE NAME ## r_sat_unsigned = 0.1r; \
+       TYPE NAME ## lr_signed = 0.1lr; \
+       unsigned TYPE NAME ## lr_unsigned = 0.1lr; \
+       _Sat TYPE NAME ## lr_sat_signed = 0.1lr; \
+       _Sat unsigned TYPE NAME ## lr_sat_unsigned = 0.1lr; \
+       TYPE NAME ## llr_signed = 0.1llr; \
+       unsigned TYPE NAME ## llr_unsigned = 0.1llr; \
+       _Sat TYPE NAME ## llr_sat_signed = 0.1llr; \
+       _Sat unsigned TYPE NAME ## llr_sat_unsigned = 0.1llr; \
+       TYPE NAME ## uhr_signed = 0.1uhr; \
+       unsigned TYPE NAME ## uhr_unsigned = 0.1uhr; \
+       _Sat TYPE NAME ## uhr_sat_signed = 0.1uhr; \
+       _Sat unsigned TYPE NAME ## uhr_sat_unsigned = 0.1uhr; \
+       TYPE NAME ## ur_signed = 0.1ur; \
+       unsigned TYPE NAME ## ur_unsigned = 0.1ur; \
+       _Sat TYPE NAME ## ur_sat_signed = 0.1ur; \
+       _Sat unsigned TYPE NAME ## ur_sat_unsigned = 0.1ur; \
+       TYPE NAME ## ulr_signed = 0.1ulr; \
+       unsigned TYPE NAME ## ulr_unsigned = 0.1ulr; \
+       _Sat TYPE NAME ## ulr_sat_signed = 0.1ulr; \
+       _Sat unsigned TYPE NAME ## ulr_sat_unsigned = 0.1ulr; \
+       TYPE NAME ## ullr_signed = 0.1ullr; \
+       unsigned TYPE NAME ## ullr_unsigned = 0.1ullr; \
+       _Sat TYPE NAME ## ullr_sat_signed = 0.1ullr; \
+       _Sat unsigned TYPE NAME ## ullr_sat_unsigned = 0.1ullr; \
+       TYPE NAME ## hk_signed = 0.1hk; \
+       unsigned TYPE NAME ## hk_unsigned = 0.1hk; \
+       _Sat TYPE NAME ## hk_sat_signed = 5.1hk; \
+       _Sat unsigned TYPE NAME ## hk_sat_unsigned = 5.1hk; \
+       TYPE NAME ## k_signed = 0.1k; \
+       unsigned TYPE NAME ## k_unsigned = 0.1k; \
+       _Sat TYPE NAME ## k_sat_signed = 5.1k; \
+       _Sat unsigned TYPE NAME ## k_sat_unsigned = 5.1k; \
+       TYPE NAME ## lk_signed = 0.1lk; \
+       unsigned TYPE NAME ## lk_unsigned = 0.1lk; \
+       _Sat TYPE NAME ## lk_sat_signed = 5.1lk; \
+       _Sat unsigned TYPE NAME ## lk_sat_unsigned = 5.1lk; \
+       TYPE NAME ## llk_signed = 0.1llk; \
+       unsigned TYPE NAME ## llk_unsigned = 0.1llk; \
+       _Sat TYPE NAME ## llk_sat_signed = 5.1llk; \
+       _Sat unsigned TYPE NAME ## llk_sat_unsigned = 5.1llk; \
+       TYPE NAME ## uhk_signed = 0.1uhk; \
+       unsigned TYPE NAME ## uhk_unsigned = 0.1uhk; \
+       _Sat TYPE NAME ## uhk_sat_signed = 5.1uhk; \
+       _Sat unsigned TYPE NAME ## uhk_sat_unsigned = 5.1uhk; \
+       TYPE NAME ## uk_signed = 0.1uk; \
+       unsigned TYPE NAME ## uk_unsigned = 0.1uk; \
+       _Sat TYPE NAME ## uk_sat_signed = 5.1uk; \
+       _Sat unsigned TYPE NAME ## uk_sat_unsigned = 5.1uk; \
+       TYPE NAME ## ulk_signed = 0.1ulk; \
+       unsigned TYPE NAME ## ulk_unsigned = 0.1ulk; \
+       _Sat TYPE NAME ## ulk_sat_signed = 5.1ulk; \
+       _Sat unsigned TYPE NAME ## ulk_sat_unsigned = 5.1ulk; \
+       TYPE NAME ## ullk_signed = 0.1ullk; \
+       unsigned TYPE NAME ## ullk_unsigned = 0.1ullk; \
+       _Sat TYPE NAME ## ullk_sat_signed = 5.1ullk; \
+       _Sat unsigned TYPE NAME ## ullk_sat_unsigned = 5.1ullk; \
+
+ALLOPCONST(short _Fract, sf, hr);
+ALLOPCONST(_Fract, f, r);
+ALLOPCONST(long _Fract, lf, lr);
+ALLOPCONST(long long _Fract, llf, llr);
+ALLOPCONST(short _Accum, sa, hk);
+ALLOPCONST(_Accum, a, k);
+ALLOPCONST(long _Accum, la, lk);
+ALLOPCONST(long long _Accum, lla, llk);
diff --git a/gcc/testsuite/gcc.dg/fixed-point/allop.c b/gcc/testsuite/gcc.dg/fixed-point/allop.c
new file mode 100644 (file)
index 0000000..eb36c09
--- /dev/null
@@ -0,0 +1,87 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.5.7 - Bitwise shift operands.
+   C99 6.5.3 Unary operators.
+   C99 6.5.5 Multiplicative operators.
+   C99 6.5.6 Additive operators.
+   C99 6.5.7 Bitwise shift operators.
+   C99 6.5.8 Relational operators.
+   C99 6.5.9 Equality operators.
+   C99 6.5.16 Assignment operators.
+
+   Check if all operations are ok.  */
+
+void true();
+void false();
+
+#define ALLOP(TYPE,NAME) \
+  TYPE test1 ## NAME (TYPE a)  { return +a; } \
+  TYPE test2 ## NAME (TYPE a)  { return -a; } \
+  int test3 ## NAME (TYPE a)  { return !a; } \
+  TYPE test4 ## NAME (TYPE a, TYPE b) { return a + b; } \
+  TYPE test5 ## NAME (TYPE a, TYPE b) { return a - b; } \
+  TYPE test6 ## NAME (TYPE a, TYPE b) { return a * b; } \
+  TYPE test7 ## NAME (TYPE a, TYPE b) { return a / b; } \
+  TYPE test8 ## NAME (TYPE a, TYPE b) { a += b; return a; } \
+  TYPE test9 ## NAME (TYPE a, TYPE b) { a -= b; return a; } \
+  TYPE test10 ## NAME (TYPE a, TYPE b) { a *= b; return a; } \
+  TYPE test11 ## NAME (TYPE a, TYPE b) { a /= b; return a; } \
+  TYPE test12 ## NAME (TYPE a, int b) { return a << b; } \
+  TYPE test13 ## NAME (TYPE a, int b) { return a >> b; } \
+  TYPE test14 ## NAME (TYPE a, int b) { a <<= b; return a; } \
+  TYPE test15 ## NAME (TYPE a, int b) { a >>= b; return a; } \
+  int test16 ## NAME (TYPE a, TYPE b) { return a == b; } \
+  int test17 ## NAME (TYPE a, TYPE b) { return a != b; } \
+  int test18 ## NAME (TYPE a, TYPE b) { return a < b; } \
+  int test19 ## NAME (TYPE a, TYPE b) { return a <= b; } \
+  int test20 ## NAME (TYPE a, TYPE b) { return a >= b; } \
+  int test21 ## NAME (TYPE a, TYPE b) { return a > b; } \
+  void test22 ## NAME (TYPE a, TYPE b) { if(a == b)true(); else false(); } \
+  void test23 ## NAME (TYPE a, TYPE b) { if(a != b)true(); else false(); } \
+  void test24 ## NAME (TYPE a, TYPE b) { if(a < b)true(); else false(); } \
+  void test25 ## NAME (TYPE a, TYPE b) { if(a <= b)true(); else false(); } \
+  void test26 ## NAME (TYPE a, TYPE b) { if(a >= b)true(); else false(); } \
+  void test27 ## NAME (TYPE a, TYPE b) { if(a > b)true(); else false(); } \
+  TYPE test28 ## NAME (TYPE a) { return ++a; } \
+  TYPE test29 ## NAME (TYPE a) { return --a; } \
+  TYPE test30 ## NAME (TYPE *a) { return ++(*a); } \
+  TYPE test31 ## NAME (TYPE *a) { return (*a)++; } \
+  TYPE test32 ## NAME (TYPE *a) { return --(*a); } \
+  TYPE test33 ## NAME (TYPE *a) { return (*a)--; }
+
+ALLOP(short _Fract, sf);
+ALLOP(_Fract, f);
+ALLOP(long _Fract, lf);
+ALLOP(long long _Fract, llf);
+ALLOP(short _Accum, sa);
+ALLOP(_Accum, a);
+ALLOP(long _Accum, la);
+ALLOP(long long _Accum, lla);
+
+ALLOP(unsigned short _Fract, usf);
+ALLOP(unsigned _Fract, uf);
+ALLOP(unsigned long _Fract, ulf);
+ALLOP(unsigned long long _Fract, ullf);
+ALLOP(unsigned short _Accum, usa);
+ALLOP(unsigned _Accum, ua);
+ALLOP(unsigned long _Accum, ula);
+ALLOP(unsigned long long _Accum, ulla);
+
+ALLOP(_Sat short _Fract, Ssf);
+ALLOP(_Sat _Fract, Sf);
+ALLOP(_Sat long _Fract, Slf);
+ALLOP(_Sat long long _Fract, Sllf);
+ALLOP(_Sat short _Accum, Ssa);
+ALLOP(_Sat _Accum, Sa);
+ALLOP(_Sat long _Accum, Sla);
+ALLOP(_Sat long long _Accum, Slla);
+
+ALLOP(_Sat unsigned short _Fract, Susf);
+ALLOP(_Sat unsigned  _Fract, Suf);
+ALLOP(_Sat unsigned long _Fract, Sulf);
+ALLOP(_Sat unsigned long long _Fract, Sullf);
+ALLOP(_Sat unsigned short _Accum, Susa);
+ALLOP(_Sat unsigned  _Accum, Sua);
+ALLOP(_Sat unsigned long _Accum, Sula);
+ALLOP(_Sat unsigned long long _Accum, Sulla);
diff --git a/gcc/testsuite/gcc.dg/fixed-point/binary.c b/gcc/testsuite/gcc.dg/fixed-point/binary.c
new file mode 100644 (file)
index 0000000..e2cb6ea
--- /dev/null
@@ -0,0 +1,158 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.5.7 - Bitwise shift operands.
+   C99 6.5.5 Multiplicative operators.
+   C99 6.5.6 Additive operators.
+   C99 6.5.7 Bitwise shift operators.
+   C99 6.5.8 Relational operators.
+   C99 6.5.9 Equality operators.
+   C99 6.5.16 Assignment operators.
+
+   Check binary operators + - * / << >> < <= >= > == != += -= *= /= <<= >>=.  */
+
+extern void abort (void);
+
+#define BINARY(TYPE,POSTFIX) \
+  { TYPE a = 0.5 ## POSTFIX; \
+    TYPE b = 0.25 ## POSTFIX; \
+    if (a + b != 0.75 ## POSTFIX) \
+      abort(); \
+    if (a - b != 0.25 ## POSTFIX) \
+      abort(); \
+    if (a * b != 0.125 ## POSTFIX) \
+      abort(); \
+    if (b / a != 0.5 ## POSTFIX) \
+      abort(); \
+    if (b << 1 != a) \
+      abort(); \
+    if (a >> 1 != b) \
+      abort(); \
+    if (a < b != 0) \
+      abort(); \
+    if (a <= b != 0) \
+      abort(); \
+    if (a > b != 1) \
+      abort(); \
+    if (a >= b != 1) \
+      abort(); \
+    if (a == b != 0) \
+      abort(); \
+    if (a != b != 1) \
+      abort(); \
+    a += b; \
+    if (a != 0.75 ## POSTFIX) \
+      abort(); \
+    a -= b; \
+    if (a != 0.5 ## POSTFIX) \
+      abort(); \
+    a *= b; \
+    if (a != 0.125 ## POSTFIX) \
+      abort(); \
+    a /= b; \
+    if (a != 0.5 ## POSTFIX) \
+      abort(); \
+    a >>= 2; \
+    if (a != 0.125 ## POSTFIX) \
+      abort(); \
+    a <<= 1; \
+    if (a != 0.25 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_BINARY(TYPE,POSTFIX) \
+  { TYPE a = 0.7 ## POSTFIX; \
+    TYPE b = 0.9 ## POSTFIX; \
+    if (a + b != 1.0 ## POSTFIX) \
+      abort(); \
+    a = -0.7 ## POSTFIX; \
+    b = -0.9 ## POSTFIX; \
+    if (a + b != -0.5 ## POSTFIX - 0.5 ## POSTFIX) \
+      abort(); \
+    a = 0.7 ## POSTFIX; \
+    b = -0.9 ## POSTFIX; \
+    if (a - b != 1.0 ## POSTFIX) \
+      abort(); \
+    a = -0.7 ## POSTFIX; \
+    b = 0.9 ## POSTFIX; \
+    if (a - b != -0.5 ## POSTFIX - 0.5 ## POSTFIX) \
+      abort(); \
+    a = -0.5 ## POSTFIX - 0.5 ## POSTFIX; \
+    if (a * a != 1.0 ## POSTFIX) \
+      abort(); \
+    a = 0.8 ## POSTFIX; \
+    b = 0.5 ## POSTFIX; \
+    if (a / b != 1.0 ## POSTFIX) \
+      abort(); \
+    a = -0.8 ## POSTFIX; \
+    b = 0.5 ## POSTFIX; \
+    if (a / b != -0.5 ## POSTFIX - 0.5 ## POSTFIX) \
+      abort(); \
+    a = 0.1 ## POSTFIX; \
+    if (a << 4 != 1.0 ## POSTFIX) \
+      abort(); \
+    a = -0.8 ## POSTFIX; \
+    if (a << 4 != -0.5 ## POSTFIX - 0.5 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_UNS_BINARY(TYPE,POSTFIX) \
+  { TYPE a = 0.7 ## POSTFIX; \
+    TYPE b = 0.9 ## POSTFIX; \
+    if (a + b != 1.0 ## POSTFIX) \
+      abort(); \
+    if (a - b != 0.0 ## POSTFIX) \
+      abort(); \
+    if (b / a != 1.0 ## POSTFIX) \
+      abort(); \
+    if (a << 1 != 1.0 ## POSTFIX) \
+      abort(); \
+  }
+
+int main ()
+{
+  BINARY(short _Fract, hr);
+  BINARY(_Fract, r);
+  BINARY(long _Fract, lr);
+  BINARY(long long _Fract, llr);
+  BINARY(unsigned short _Fract, uhr);
+  BINARY(unsigned _Fract, ur);
+  BINARY(unsigned long _Fract, ulr);
+  BINARY(unsigned long long _Fract, ullr);
+  BINARY(_Sat short _Fract, hr);
+  BINARY(_Sat _Fract, r);
+  BINARY(_Sat long _Fract, lr);
+  BINARY(_Sat long long _Fract, llr);
+  BINARY(_Sat unsigned short _Fract, uhr);
+  BINARY(_Sat unsigned _Fract, ur);
+  BINARY(_Sat unsigned long _Fract, ulr);
+  BINARY(_Sat unsigned long long _Fract, ullr);
+  BINARY(short _Accum, hk);
+  BINARY(_Accum, k);
+  BINARY(long _Accum, lk);
+  BINARY(long long _Accum, llk);
+  BINARY(unsigned short _Accum, uhk);
+  BINARY(unsigned _Accum, uk);
+  BINARY(unsigned long _Accum, ulk);
+  BINARY(unsigned long long _Accum, ullk);
+  BINARY(_Sat short _Accum, hk);
+  BINARY(_Sat _Accum, k);
+  BINARY(_Sat long _Accum, lk);
+  BINARY(_Sat long long _Accum, llk);
+  BINARY(_Sat unsigned short _Accum, uhk);
+  BINARY(_Sat unsigned _Accum, uk);
+  BINARY(_Sat unsigned long _Accum, ulk);
+  BINARY(_Sat unsigned long long _Accum, ullk);
+
+  FRACT_SAT_BINARY(_Sat short _Fract, hr);
+  FRACT_SAT_BINARY(_Sat _Fract, r);
+  FRACT_SAT_BINARY(_Sat long _Fract, lr);
+  FRACT_SAT_BINARY(_Sat long long _Fract, llr);
+
+  FRACT_SAT_UNS_BINARY(_Sat unsigned short _Fract, uhr);
+  FRACT_SAT_UNS_BINARY(_Sat unsigned _Fract, ur);
+  FRACT_SAT_UNS_BINARY(_Sat unsigned long _Fract, ulr);
+  FRACT_SAT_UNS_BINARY(_Sat unsigned long long _Fract, ullr);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/bit-complement.c b/gcc/testsuite/gcc.dg/fixed-point/bit-complement.c
new file mode 100644 (file)
index 0000000..76c20d0
--- /dev/null
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.3 Unary ~.  */
+
+void test ()
+{
+  short _Fract sf;
+  _Fract f;
+  long _Fract lf;
+  long long _Fract llf;
+  unsigned short _Fract usf;
+  unsigned _Fract uf;
+  unsigned long _Fract ulf;
+  unsigned long long _Fract ullf;
+  _Sat short _Fract Ssf;
+  _Sat _Fract Sf;
+  _Sat long _Fract Slf;
+  _Sat long long _Fract Sllf;
+  _Sat unsigned short _Fract Susf;
+  _Sat unsigned _Fract Suf;
+  _Sat unsigned long _Fract Sulf;
+  _Sat unsigned long long _Fract Sullf;
+  short _Accum sa;
+  _Accum a;
+  long _Accum la;
+  long long _Accum lla;
+  unsigned short _Accum usa;
+  unsigned _Accum ua;
+  unsigned long _Accum ula;
+  unsigned long long _Accum ulla;
+  _Sat short _Accum Ssa;
+  _Sat _Accum Sa;
+  _Sat long _Accum Sla;
+  _Sat long long _Accum Slla;
+  _Sat unsigned short _Accum Susa;
+  _Sat unsigned _Accum Sua;
+  _Sat unsigned long _Accum Sula;
+  _Sat unsigned long long _Accum Sulla;
+
+  /* C99 Section 6.5.3.3 ~ shall have integer types.  */
+
+  ~sf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~f; /* { dg-error "wrong type argument to bit-complement" } */
+  ~lf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~llf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~usf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~uf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~ulf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~ullf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Ssf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Slf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sllf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Susf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Suf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sulf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sullf; /* { dg-error "wrong type argument to bit-complement" } */
+  ~sa; /* { dg-error "wrong type argument to bit-complement" } */
+  ~a; /* { dg-error "wrong type argument to bit-complement" } */
+  ~la; /* { dg-error "wrong type argument to bit-complement" } */
+  ~lla; /* { dg-error "wrong type argument to bit-complement" } */
+  ~usa; /* { dg-error "wrong type argument to bit-complement" } */
+  ~ua; /* { dg-error "wrong type argument to bit-complement" } */
+  ~ula; /* { dg-error "wrong type argument to bit-complement" } */
+  ~ulla; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Ssa; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sa; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sla; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Slla; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Susa; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sua; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sula; /* { dg-error "wrong type argument to bit-complement" } */
+  ~Sulla; /* { dg-error "wrong type argument to bit-complement" } */
+
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/call-by-value.c b/gcc/testsuite/gcc.dg/fixed-point/call-by-value.c
new file mode 100644 (file)
index 0000000..8b9d822
--- /dev/null
@@ -0,0 +1,97 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.9.1(9) Function definitions; parameter has automatic storage.
+
+   Test that actual parameters are passed by value and that modifications
+   made within functions are lost on function return.
+
+   This test is copied from gcc.dg/dfp/ and changed for fixed-point types.  */
+
+extern void abort (void);
+
+#define FOO_FUN(NAME,TYPE,VALUE) \
+int foo ## NAME (TYPE z) \
+{ \
+  z = z + VALUE; \
+}
+
+#define FOO_TEST(NAME,TYPE,VALUE) \
+  { \
+    TYPE NAME = VALUE; \
+    foo ## NAME (NAME); \
+    if (NAME != VALUE) \
+      abort (); \
+  }
+
+FOO_FUN (sf, short _Fract, 0.2hr)
+FOO_FUN (f, _Fract, 0.2r)
+FOO_FUN (lf, long _Fract, 0.2lr)
+FOO_FUN (llf, long long _Fract, 0.2llr)
+FOO_FUN (usf, unsigned short _Fract, 0.2uhr)
+FOO_FUN (uf, unsigned _Fract, 0.2ur)
+FOO_FUN (ulf, unsigned long _Fract, 0.2ulr)
+FOO_FUN (ullf, unsigned long long _Fract, 0.2ullr)
+FOO_FUN (Ssf, _Sat short _Fract, 0.2hr)
+FOO_FUN (Sf, _Sat _Fract, 0.2r)
+FOO_FUN (Slf, _Sat long _Fract, 0.2lr)
+FOO_FUN (Sllf, _Sat long long _Fract, 0.2llr)
+FOO_FUN (Susf, _Sat unsigned short _Fract, 0.2uhr)
+FOO_FUN (Suf, _Sat unsigned _Fract, 0.2ur)
+FOO_FUN (Sulf, _Sat unsigned long _Fract, 0.2ulr)
+FOO_FUN (Sullf, _Sat unsigned long long _Fract, 0.2ullr)
+FOO_FUN (sa, short _Accum, 0.2hk)
+FOO_FUN (a, _Accum, 0.2k)
+FOO_FUN (la, long _Accum, 0.2lk)
+FOO_FUN (lla, long long _Accum, 0.2llk)
+FOO_FUN (usa, unsigned short _Accum, 0.2uhk)
+FOO_FUN (ua, unsigned _Accum, 0.2uk)
+FOO_FUN (ula, unsigned long _Accum, 0.2ulk)
+FOO_FUN (ulla, unsigned long long _Accum, 0.2ullk)
+FOO_FUN (Ssa, _Sat short _Accum, 0.2hk)
+FOO_FUN (Sa, _Sat _Accum, 0.2k)
+FOO_FUN (Sla, _Sat long _Accum, 0.2lk)
+FOO_FUN (Slla, _Sat long long _Accum, 0.2llk)
+FOO_FUN (Susa, _Sat unsigned short _Accum, 0.2uhk)
+FOO_FUN (Sua, _Sat unsigned _Accum, 0.2uk)
+FOO_FUN (Sula, _Sat unsigned long _Accum, 0.2ulk)
+FOO_FUN (Sulla, _Sat unsigned long long _Accum, 0.2ullk)
+
+int
+main ()
+{
+  FOO_TEST (sf, short _Fract, 0.2hr)
+  FOO_TEST (f, _Fract, 0.2r)
+  FOO_TEST (lf, long _Fract, 0.2lr)
+  FOO_TEST (llf, long long _Fract, 0.2llr)
+  FOO_TEST (usf, unsigned short _Fract, 0.2uhr)
+  FOO_TEST (uf, unsigned _Fract, 0.2ur)
+  FOO_TEST (ulf, unsigned long _Fract, 0.2ulr)
+  FOO_TEST (ullf, unsigned long long _Fract, 0.2ullr)
+  FOO_TEST (Ssf, _Sat short _Fract, 0.2hr)
+  FOO_TEST (Sf, _Sat _Fract, 0.2r)
+  FOO_TEST (Slf, _Sat long _Fract, 0.2lr)
+  FOO_TEST (Sllf, _Sat long long _Fract, 0.2llr)
+  FOO_TEST (Susf, _Sat unsigned short _Fract, 0.2uhr)
+  FOO_TEST (Suf, _Sat unsigned _Fract, 0.2ur)
+  FOO_TEST (Sulf, _Sat unsigned long _Fract, 0.2ulr)
+  FOO_TEST (Sullf, _Sat unsigned long long _Fract, 0.2ullr)
+  FOO_TEST (sa, short _Accum, 0.2hk)
+  FOO_TEST (a, _Accum, 0.2k)
+  FOO_TEST (la, long _Accum, 0.2lk)
+  FOO_TEST (lla, long long _Accum, 0.2llk)
+  FOO_TEST (usa, unsigned short _Accum, 0.2uhk)
+  FOO_TEST (ua, unsigned _Accum, 0.2uk)
+  FOO_TEST (ula, unsigned long _Accum, 0.2ulk)
+  FOO_TEST (ulla, unsigned long long _Accum, 0.2ullk)
+  FOO_TEST (Ssa, _Sat short _Accum, 0.2hk)
+  FOO_TEST (Sa, _Sat _Accum, 0.2k)
+  FOO_TEST (Sla, _Sat long _Accum, 0.2lk)
+  FOO_TEST (Slla, _Sat long long _Accum, 0.2llk)
+  FOO_TEST (Susa, _Sat unsigned short _Accum, 0.2uhk)
+  FOO_TEST (Sua, _Sat unsigned _Accum, 0.2uk)
+  FOO_TEST (Sula, _Sat unsigned long _Accum, 0.2ulk)
+  FOO_TEST (Sulla, _Sat unsigned long long _Accum, 0.2ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/cast-bad.c b/gcc/testsuite/gcc.dg/fixed-point/cast-bad.c
new file mode 100644 (file)
index 0000000..ec8ea80
--- /dev/null
@@ -0,0 +1,279 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.4 Cast operators.
+
+   Test invalid casts involving fixed-point.  */
+
+#define CAST(NAME,TYPE) \
+  struct s ## NAME { TYPE NAME; } as ## NAME; \
+  union u ## NAME { TYPE NAME; } au ## NAME; \
+  TYPE NAME; \
+  TYPE * NAME ## p;
+
+CAST (sf, short _Fract)
+CAST (f, _Fract)
+CAST (lf, long _Fract)
+CAST (llf, long long _Fract)
+CAST (usf, unsigned short _Fract)
+CAST (uf, unsigned _Fract)
+CAST (ulf, unsigned long _Fract)
+CAST (ullf, unsigned long long _Fract)
+CAST (Ssf, _Sat short _Fract)
+CAST (Sf, _Sat _Fract)
+CAST (Slf, _Sat long _Fract)
+CAST (Sllf, _Sat long long _Fract)
+CAST (Susf, _Sat unsigned short _Fract)
+CAST (Suf, _Sat unsigned _Fract)
+CAST (Sulf, _Sat unsigned long _Fract)
+CAST (Sullf, _Sat unsigned long long _Fract)
+CAST (sa, short _Accum)
+CAST (a, _Accum)
+CAST (la, long _Accum)
+CAST (lla, long long _Accum)
+CAST (usa, unsigned short _Accum)
+CAST (ua, unsigned _Accum)
+CAST (ula, unsigned long _Accum)
+CAST (ulla, unsigned long long _Accum)
+CAST (Ssa, _Sat short _Accum)
+CAST (Sa, _Sat _Accum)
+CAST (Sla, _Sat long _Accum)
+CAST (Slla, _Sat long long _Accum)
+CAST (Susa, _Sat unsigned short _Accum)
+CAST (Sua, _Sat unsigned _Accum)
+CAST (Sula, _Sat unsigned long _Accum)
+CAST (Sulla, _Sat unsigned long long _Accum)
+
+void
+test (void)
+{
+  (short _Fract []) sfp; /* { dg-error "cast specifies array type" } */
+  (_Fract []) fp; /* { dg-error "cast specifies array type" } */
+  (long _Fract []) lfp; /* { dg-error "cast specifies array type" } */
+  (long long _Fract []) llfp; /* { dg-error "cast specifies array type" } */
+  (unsigned short _Fract []) usfp; /* { dg-error "cast specifies array type" } */
+  (unsigned _Fract []) ufp; /* { dg-error "cast specifies array type" } */
+  (unsigned long _Fract []) ulfp; /* { dg-error "cast specifies array type" } */
+  (unsigned long long _Fract []) ullfp; /* { dg-error "cast specifies array type" } */
+  (_Sat short _Fract []) Ssfp; /* { dg-error "cast specifies array type" } */
+  (_Sat _Fract []) Sfp; /* { dg-error "cast specifies array type" } */
+  (_Sat long _Fract []) Slfp; /* { dg-error "cast specifies array type" } */
+  (_Sat long long _Fract []) Sllfp; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned short _Fract []) Susfp; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned _Fract []) Sufp; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned long _Fract []) Sulfp; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned long long _Fract []) Sullfp; /* { dg-error "cast specifies array type" } */
+  (short _Accum []) sap; /* { dg-error "cast specifies array type" } */
+  (_Accum []) ap; /* { dg-error "cast specifies array type" } */
+  (long _Accum []) lap; /* { dg-error "cast specifies array type" } */
+  (long long _Accum []) llap; /* { dg-error "cast specifies array type" } */
+  (unsigned short _Accum []) usap; /* { dg-error "cast specifies array type" } */
+  (unsigned _Accum []) uap; /* { dg-error "cast specifies array type" } */
+  (unsigned long _Accum []) ulap; /* { dg-error "cast specifies array type" } */
+  (unsigned long long _Accum []) ullap; /* { dg-error "cast specifies array type" } */
+  (_Sat short _Accum []) Ssap; /* { dg-error "cast specifies array type" } */
+  (_Sat _Accum []) Sap; /* { dg-error "cast specifies array type" } */
+  (_Sat long _Accum []) Slap; /* { dg-error "cast specifies array type" } */
+  (_Sat long long _Accum []) Sllap; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned short _Accum []) Susap; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned _Accum []) Suap; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned long _Accum []) Sulap; /* { dg-error "cast specifies array type" } */
+  (_Sat unsigned long long _Accum []) Sullap; /* { dg-error "cast specifies array type" } */
+
+  (short _Fract ()) sfp; /* { dg-error "cast specifies function type" } */
+  (_Fract ()) fp; /* { dg-error "cast specifies function type" } */
+  (long _Fract ()) lfp; /* { dg-error "cast specifies function type" } */
+  (long long _Fract ()) llfp; /* { dg-error "cast specifies function type" } */
+  (unsigned short _Fract ()) usfp; /* { dg-error "cast specifies function type" } */
+  (unsigned _Fract ()) ufp; /* { dg-error "cast specifies function type" } */
+  (unsigned long _Fract ()) ulfp; /* { dg-error "cast specifies function type" } */
+  (unsigned long long _Fract ()) ullfp; /* { dg-error "cast specifies function type" } */
+  (_Sat short _Fract ()) Ssfp; /* { dg-error "cast specifies function type" } */
+  (_Sat _Fract ()) Sfp; /* { dg-error "cast specifies function type" } */
+  (_Sat long _Fract ()) Slfp; /* { dg-error "cast specifies function type" } */
+  (_Sat long long _Fract ()) Sllfp; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned short _Fract ()) Susfp; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned _Fract ()) Sufp; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned long _Fract ()) Sulfp; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned long long _Fract ()) Sullfp; /* { dg-error "cast specifies function type" } */
+  (short _Accum ()) sap; /* { dg-error "cast specifies function type" } */
+  (_Accum ()) ap; /* { dg-error "cast specifies function type" } */
+  (long _Accum ()) lap; /* { dg-error "cast specifies function type" } */
+  (long long _Accum ()) llap; /* { dg-error "cast specifies function type" } */
+  (unsigned short _Accum ()) usap; /* { dg-error "cast specifies function type" } */
+  (unsigned _Accum ()) uap; /* { dg-error "cast specifies function type" } */
+  (unsigned long _Accum ()) ulap; /* { dg-error "cast specifies function type" } */
+  (unsigned long long _Accum ()) ullap; /* { dg-error "cast specifies function type" } */
+  (_Sat short _Accum ()) Ssap; /* { dg-error "cast specifies function type" } */
+  (_Sat _Accum ()) Sap; /* { dg-error "cast specifies function type" } */
+  (_Sat long _Accum ()) Slap; /* { dg-error "cast specifies function type" } */
+  (_Sat long long _Accum ()) Sllap; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned short _Accum ()) Susap; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned _Accum ()) Suap; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned long _Accum ()) Sulap; /* { dg-error "cast specifies function type" } */
+  (_Sat unsigned long long _Accum ()) Sullap; /* { dg-error "cast specifies function type" } */
+
+  (struct ssf) sf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sf) f; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct slf) lf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sllf) llf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct susf) usf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct suf) uf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sulf) ulf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sullf) ullf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSsf) Ssf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSf) Sf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSlf) Slf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSllf) Sllf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSusf) Susf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSuf) Suf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSulf) Sulf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSullf) Sullf; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct ssa) sa; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sa) a; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sla) la; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct slla) lla; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct susa) usa; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sua) ua; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sula) ula; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sulla) ulla; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSsa) Ssa; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSa) Sa; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSla) Sla; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSlla) Slla; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSusa) Susa; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSua) Sua; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSula) Sula; /* { dg-error "conversion to non-scalar type requested" } */
+  (struct sSulla) Sulla; /* { dg-error "conversion to non-scalar type requested" } */
+
+  (union usf) sf;
+  (union uf) f;
+  (union ulf) lf;
+  (union ullf) llf;
+  (union uusf) usf;
+  (union uuf) uf;
+  (union uulf) ulf;
+  (union uullf) ullf;
+  (union uSsf) Ssf;
+  (union uSf) Sf;
+  (union uSlf) Slf;
+  (union uSllf) Sllf;
+  (union uSusf) Susf;
+  (union uSuf) Suf;
+  (union uSulf) Sulf;
+  (union uSullf) Sullf;
+  (union usa) sa;
+  (union ua) a;
+  (union ula) la;
+  (union ulla) lla;
+  (union uusa) usa;
+  (union uua) ua;
+  (union uula) ula;
+  (union uulla) ulla;
+  (union uSsa) Ssa;
+  (union uSa) Sa;
+  (union uSla) Sla;
+  (union uSlla) Slla;
+  (union uSusa) Susa;
+  (union uSua) Sua;
+  (union uSula) Sula;
+  (union uSulla) Sulla;
+
+  (union usf) f; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) lf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) llf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) usf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) uf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) ulf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) ullf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Ssf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Slf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sllf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Susf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Suf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sulf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sullf; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) sa; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) a; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) la; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) lla; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) usa; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) ua; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) ula; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) ulla; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Ssa; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sa; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sla; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Slla; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Susa; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sua; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sula; /* { dg-error "cast to union type from type not present in union" } */
+  (union usf) Sulla; /* { dg-error "cast to union type from type not present in union" } */
+
+  (short _Fract) assf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Fract) asf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long _Fract) aslf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long long _Fract) asllf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned short _Fract) asusf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned _Fract) asuf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long _Fract) asulf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long long _Fract) asullf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat short _Fract) asSsf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat _Fract) asSf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long _Fract) asSlf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long long _Fract) asSllf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned short _Fract) asSusf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned _Fract) asSuf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long _Fract) asSulf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long long _Fract) asSullf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (short _Accum) assa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Accum) asa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long _Accum) asla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long long _Accum) aslla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned short _Accum) asusa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned _Accum) asua; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long _Accum) asula; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long long _Accum) asulla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat short _Accum) asSsa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat _Accum) asSa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long _Accum) asSla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long long _Accum) asSlla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned short _Accum) asSusa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned _Accum) asSua; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long _Accum) asSula; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long long _Accum) asSulla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+
+  (short _Fract) ausf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Fract) auf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long _Fract) aulf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long long _Fract) aullf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned short _Fract) auusf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned _Fract) auuf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long _Fract) auulf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long long _Fract) auullf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat short _Fract) auSsf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat _Fract) auSf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long _Fract) auSlf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long long _Fract) auSllf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned short _Fract) auSusf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned _Fract) auSuf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long _Fract) auSulf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long long _Fract) auSullf; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (short _Accum) ausa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Accum) aua; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long _Accum) aula; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (long long _Accum) aulla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned short _Accum) auusa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned _Accum) auua; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long _Accum) auula; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (unsigned long long _Accum) auulla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat short _Accum) auSsa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat _Accum) auSa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long _Accum) auSla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat long long _Accum) auSlla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned short _Accum) auSusa; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned _Accum) auSua; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long _Accum) auSula; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+  (_Sat unsigned long long _Accum) auSulla; /* { dg-error "aggregate value used where a fixed-point was expected" } */
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/composite-type.c b/gcc/testsuite/gcc.dg/fixed-point/composite-type.c
new file mode 100644 (file)
index 0000000..990d4f0
--- /dev/null
@@ -0,0 +1,106 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -O -Wall" } */
+
+/* C99 6.2.7: Compatible type and composite type.  */
+
+#define FIXED_POINT_COMPOSITE_DECL(TYPE,NAME) \
+  TYPE g1_##NAME(); \
+  TYPE g2_##NAME(); \
+  TYPE (*h1_##NAME)[2]; \
+  TYPE (*h2_##NAME)[3]; \
+  TYPE (*h3_##NAME)[4]; \
+  TYPE f1_##NAME(TYPE(*)()); \
+  TYPE f1_##NAME(TYPE(*)(TYPE*)); \
+  TYPE f1_##NAME (TYPE(*g)(TYPE*)) \
+   { \
+     TYPE NAME; \
+     NAME = ((TYPE (*) (TYPE*)) g)(&NAME); \
+     NAME = ((TYPE (*) ()) g); \
+     return NAME; \
+   } \
+  TYPE f2_##NAME(TYPE(*)[]); \
+  TYPE f2_##NAME(TYPE(*)[3]);
+
+#define FIXED_POINT_COMPOSITE_TEST(TYPE, NAME) \
+do \
+{ \
+ TYPE NAME; \
+ NAME = f1_##NAME(g1_##NAME); \
+ NAME = f1_##NAME(g2_##NAME); \
+ NAME = f2_##NAME(h1_##NAME); \
+ NAME = f2_##NAME(h2_##NAME); \
+ NAME = f2_##NAME(h3_##NAME); \
+} while(0)
+
+FIXED_POINT_COMPOSITE_DECL(short _Fract, sf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Fract, f);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(long _Fract, lf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(long long _Fract, llf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned short _Fract, usf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned _Fract, uf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned long _Fract, ulf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned long long _Fract, ullf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat short _Fract, Ssf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat _Fract, Sf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat long _Fract, Slf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat long long _Fract, Sllf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned short _Fract, Susf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned _Fract, Suf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned long _Fract, Sulf);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned long long _Fract, Sullf);  /* { dg-error "incompatible types in assignment" } */
+
+FIXED_POINT_COMPOSITE_DECL(short _Accum, sk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Accum, k);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(long _Accum, lk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(long long _Accum, llk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned short _Accum, usk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned _Accum, uk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned long _Accum, ulk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(unsigned long long _Accum, ullk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat short _Accum, Ssk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat _Accum, Sk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat long _Accum, Slk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat long long _Accum, Sllk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned short _Accum, Susk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned _Accum, Suk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned long _Accum, Sulk);  /* { dg-error "incompatible types in assignment" } */
+FIXED_POINT_COMPOSITE_DECL(_Sat unsigned long long _Accum, Sullk);  /* { dg-error "incompatible types in assignment" } */
+
+int main()
+{
+  FIXED_POINT_COMPOSITE_TEST(short _Fract, sf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Fract, f);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(long _Fract, lf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(long long _Fract, llf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned short _Fract, usf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned _Fract, uf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned long _Fract, ulf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned long long _Fract, ullf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat short _Fract, Ssf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat _Fract, Sf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat long _Fract, Slf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat long long _Fract, Sllf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned short _Fract, Susf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned _Fract, Suf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned long _Fract, Sulf);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned long long _Fract, Sullf);  /* { dg-warning "incompatible pointer type" } */
+
+  FIXED_POINT_COMPOSITE_TEST(short _Accum, sk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Accum, k);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(long _Accum, lk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(long long _Accum, llk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned short _Accum, usk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned _Accum, uk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned long _Accum, ulk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(unsigned long long _Accum, ullk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat short _Accum, Ssk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat _Accum, Sk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat long _Accum, Slk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat long long _Accum, Sllk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned short _Accum, Susk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned _Accum, Suk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned long _Accum, Sulk);  /* { dg-warning "incompatible pointer type" } */
+  FIXED_POINT_COMPOSITE_TEST(_Sat unsigned long long _Accum, Sullk);  /* { dg-warning "incompatible pointer type" } */
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/const-1.c b/gcc/testsuite/gcc.dg/fixed-point/const-1.c
new file mode 100644 (file)
index 0000000..5df0b4a
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.4.4 - Constants.
+
+   Check if the constant 1 is ok.  */
+
+short _Fract sf = 1.0hr;
+_Fract f = 1.0r;
+long _Fract lf = 1.0lr;
+long long _Fract llf = 1.0llr;
+
+unsigned short _Fract usf = 1.0uhr;
+unsigned _Fract uf = 1.0ur;
+unsigned long _Fract ulf = 1.0ulr;
+unsigned long long _Fract ullf = 1.0ullr;
+
+short _Fract sfF = 1.0;  /* { dg-warning "overflow" } */
+_Fract fF = 1.0;  /* { dg-warning "overflow" } */
+long _Fract lfF = 1.0;  /* { dg-warning "overflow" } */
+long long _Fract llfF = 1.0;  /* { dg-warning "overflow" } */
+
+unsigned short _Fract usfF = 1.0;  /* { dg-warning "overflow" } */
+unsigned _Fract ufF = 1.0;  /* { dg-warning "overflow" } */
+unsigned long _Fract ulfF = 1.0;  /* { dg-warning "overflow" } */
+unsigned long long _Fract ullfF = 1.0;  /* { dg-warning "overflow" } */
+
+short _Fract sfI = 1;  /* { dg-warning "overflow" } */
+_Fract fI = 1;  /* { dg-warning "overflow" } */
+long _Fract lfI = 1;  /* { dg-warning "overflow" } */
+long long _Fract llfI = 1;  /* { dg-warning "overflow" } */
+
+unsigned short _Fract usfI = 1;  /* { dg-warning "overflow" } */
+unsigned _Fract ufI = 1;  /* { dg-warning "overflow" } */
+unsigned long _Fract ulfI = 1;  /* { dg-warning "overflow" } */
+unsigned long long _Fract ullfI = 1;  /* { dg-warning "overflow" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/constant.c b/gcc/testsuite/gcc.dg/fixed-point/constant.c
new file mode 100644 (file)
index 0000000..18abb45
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.4.4.2a - Fixed-point constants (NEW CLAUSE).
+
+   Check if fixed-point constants are ok.  */
+
+_Accum k0 = 0k;
+_Accum k1 = 9999.0e0k;
+_Accum k2 = 9999.0k;
+_Accum k3 = 9999k;
+_Accum k4 = 9999e0k;
+_Accum k5 = 09999k;
+_Accum k6 = 09999e0k;
+_Accum k7 = 09999.0e0k;
+_Accum k8 = 09999.0k;
+_Accum k9 = 0x270fp0k;
+_Accum k10 = 0x270f.0p0k;
+
+_Fract r0 = 0r;
+_Fract r1 = 0e0r;
+_Fract r2 = 0.0e0r;
+_Fract r3 = 0.1e0r;
+_Fract r4 = 0.0r;
+_Fract r5 = 0.1r;
+_Fract r6 = 0x0p0r;
+_Fract r7 = 0x0.0p0r;
+_Fract r8 = 0x0.1p0r;
diff --git a/gcc/testsuite/gcc.dg/fixed-point/constants-pedantic.c b/gcc/testsuite/gcc.dg/fixed-point/constants-pedantic.c
new file mode 100644 (file)
index 0000000..9392381
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -pedantic" } */
+
+/* N1169 6.4.4.2a - Fixed-point constants (NEW CLAUSE).  */
+
+_Accum k0 = 0k;                /* { dg-warning "GCC extension|ISO C" } */
+_Accum k1 = 9999.0e0k; /* { dg-warning "GCC extension|ISO C" } */
+_Accum k2 = 9999.0k;   /* { dg-warning "GCC extension|ISO C" } */
+_Accum k3 = 9999k;     /* { dg-warning "GCC extension|ISO C" } */
+_Accum k4 = 9999e0k;   /* { dg-warning "GCC extension|ISO C" } */
+_Accum k5 = 09999k;    /* { dg-warning "GCC extension|ISO C" } */
+_Accum k6 = 09999e0k;  /* { dg-warning "GCC extension|ISO C" } */
+_Accum k7 = 09999.0e0k;        /* { dg-warning "GCC extension|ISO C" } */
+_Accum k8 = 09999.0k;  /* { dg-warning "GCC extension|ISO C" } */
+_Accum k9 = 0x270fp0k; /* { dg-warning "GCC extension|ISO C" } */
+_Accum k10 = 0x270f.0p0k;      /* { dg-warning "GCC extension|ISO C" } */
+
+_Fract r0 = 0r;                /* { dg-warning "GCC extension|ISO C" } */
+_Fract r1 = 0e0r;      /* { dg-warning "GCC extension|ISO C" } */
+_Fract r2 = 0.0e0r;    /* { dg-warning "GCC extension|ISO C" } */
+_Fract r3 = 0.1e0r;    /* { dg-warning "GCC extension|ISO C" } */
+_Fract r4 = 0.0r;      /* { dg-warning "GCC extension|ISO C" } */
+_Fract r5 = 0.1r;      /* { dg-warning "GCC extension|ISO C" } */
+_Fract r6 = 0x0p0r;    /* { dg-warning "GCC extension|ISO C" } */
+_Fract r7 = 0x0.0p0r;  /* { dg-warning "GCC extension|ISO C" } */
+_Fract r8 = 0x0.1p0r;  /* { dg-warning "GCC extension|ISO C" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/convert.c b/gcc/testsuite/gcc.dg/fixed-point/convert.c
new file mode 100644 (file)
index 0000000..f4e373f
--- /dev/null
@@ -0,0 +1,432 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -O0" } */
+
+/* C99 6.3 Conversions.
+
+   Check conversions involving fixed-point.  */
+
+extern void abort (void);
+
+/* Fixed-point to fixed-point.  */
+#define CONV(TYPE1,POSTFIX1,TYPE2,POSTFIX2) \
+  { \
+    TYPE1 a = 0.5 ## POSTFIX1; \
+    TYPE2 b = a; \
+    if (b != 0.5 ## POSTFIX2) \
+      abort(); \
+  }
+
+/* TYPE1 with VALUE1 to TYPE2 with VALUE2.  */
+#define CONV2(TYPE1,VALUE1,TYPE2,VALUE2) \
+  { \
+    TYPE1 a = VALUE1; \
+    TYPE2 b = a; \
+    if (b != VALUE2) \
+      abort(); \
+  }
+
+/* Fixed-point to integer, and integer to fixed-point.  */
+#define CONV_INT(TYPE1,POSTFIX1,TYPE2) \
+  { \
+    TYPE1 a = 0.5 ## POSTFIX1; \
+    TYPE2 b = a; \
+    TYPE2 c = 0; \
+    TYPE1 d = c; \
+    if (b != 0) \
+      abort(); \
+    if (d != 0.0 ## POSTFIX1) \
+      abort(); \
+  }
+
+/* Signed fixed-point to integer.  */
+#define CONV_INT2(TYPE1,POSTFIX1,TYPE2) \
+  { \
+    TYPE1 a = -0.5 ## POSTFIX1; \
+    TYPE2 b = a; \
+    if (b != 0) \
+      abort(); \
+    a = -0.0 ## POSTFIX1; \
+    b = a; \
+    if (b != 0) \
+      abort(); \
+    a = +0.0 ## POSTFIX1; \
+    b = a; \
+    if (b != 0) \
+      abort(); \
+    a = +0.1 ## POSTFIX1; \
+    b = a; \
+    if (b != 0) \
+      abort(); \
+    a = -0.1 ## POSTFIX1; \
+    b = a; \
+    if (b != 0) \
+      abort(); \
+  }
+
+/* Signed fixed-point to signed integer.  */
+#define CONV_INT3(TYPE1,POSTFIX1,TYPE2) \
+  { \
+    TYPE1 a = -0.5 ## POSTFIX1 - 0.5 ## POSTFIX1; \
+    TYPE2 b = a; \
+    if (b != -1) \
+      abort(); \
+  }
+
+/* Fixed-point to floating-point, and floating-point to fixed-point.  */
+#define CONV_FLOAT(TYPE1,POSTFIX1,TYPE2) \
+  { \
+    TYPE1 a = 0.5 ## POSTFIX1; \
+    TYPE2 b = a; \
+    TYPE2 c = 0.25; \
+    TYPE1 d = c; \
+    if (b != 0.5) \
+      abort(); \
+    if (d != 0.25 ## POSTFIX1) \
+      abort(); \
+  }
+
+/* Accum to integer, and integer to accum.  */
+#define CONV_ACCUM_INT(TYPE1,POSTFIX1,TYPE2) \
+  { \
+    TYPE1 a = 99.12345 ## POSTFIX1; \
+    TYPE2 b = a; \
+    TYPE2 c = 123; \
+    TYPE1 d = c; \
+    if (b != 99) \
+      abort(); \
+    if (d != 123.0 ## POSTFIX1) \
+      abort(); \
+  }
+
+#define ALL_CONV(TYPE,POSTFIX) \
+  CONV(TYPE, POSTFIX, short _Fract, hr) \
+  CONV(TYPE, POSTFIX, _Fract, r) \
+  CONV(TYPE, POSTFIX, long _Fract, lr) \
+  CONV(TYPE, POSTFIX, long long _Fract, llr) \
+  CONV(TYPE, POSTFIX, unsigned short _Fract, uhr) \
+  CONV(TYPE, POSTFIX, unsigned _Fract, ur) \
+  CONV(TYPE, POSTFIX, unsigned long _Fract, ulr) \
+  CONV(TYPE, POSTFIX, unsigned long long _Fract, ullr) \
+  CONV(TYPE, POSTFIX, short _Accum, hk) \
+  CONV(TYPE, POSTFIX, _Accum, k) \
+  CONV(TYPE, POSTFIX, long _Accum, lk) \
+  CONV(TYPE, POSTFIX, long long _Accum, llk) \
+  CONV(TYPE, POSTFIX, unsigned short _Accum, uhk) \
+  CONV(TYPE, POSTFIX, unsigned _Accum, uk) \
+  CONV(TYPE, POSTFIX, unsigned long _Accum, ulk) \
+  CONV(TYPE, POSTFIX, unsigned long long _Accum, ullk) \
+  CONV(_Sat TYPE, POSTFIX, short _Fract, hr) \
+  CONV(_Sat TYPE, POSTFIX, _Fract, r) \
+  CONV(_Sat TYPE, POSTFIX, long _Fract, lr) \
+  CONV(_Sat TYPE, POSTFIX, long long _Fract, llr) \
+  CONV(_Sat TYPE, POSTFIX, unsigned short _Fract, uhr) \
+  CONV(_Sat TYPE, POSTFIX, unsigned _Fract, ur) \
+  CONV(_Sat TYPE, POSTFIX, unsigned long _Fract, ulr) \
+  CONV(_Sat TYPE, POSTFIX, unsigned long long _Fract, ullr) \
+  CONV(_Sat TYPE, POSTFIX, short _Accum, hk) \
+  CONV(_Sat TYPE, POSTFIX, _Accum, k) \
+  CONV(_Sat TYPE, POSTFIX, long _Accum, lk) \
+  CONV(_Sat TYPE, POSTFIX, long long _Accum, llk) \
+  CONV(_Sat TYPE, POSTFIX, unsigned short _Accum, uhk) \
+  CONV(_Sat TYPE, POSTFIX, unsigned _Accum, uk) \
+  CONV(_Sat TYPE, POSTFIX, unsigned long _Accum, ulk) \
+  CONV(_Sat TYPE, POSTFIX, unsigned long long _Accum, ullk) \
+  CONV(TYPE, POSTFIX, _Sat short _Fract, hr) \
+  CONV(TYPE, POSTFIX, _Sat _Fract, r) \
+  CONV(TYPE, POSTFIX, _Sat long _Fract, lr) \
+  CONV(TYPE, POSTFIX, _Sat long long _Fract, llr) \
+  CONV(TYPE, POSTFIX, _Sat unsigned short _Fract, uhr) \
+  CONV(TYPE, POSTFIX, _Sat unsigned _Fract, ur) \
+  CONV(TYPE, POSTFIX, _Sat unsigned long _Fract, ulr) \
+  CONV(TYPE, POSTFIX, _Sat unsigned long long _Fract, ullr) \
+  CONV(TYPE, POSTFIX, _Sat short _Accum, hk) \
+  CONV(TYPE, POSTFIX, _Sat _Accum, k) \
+  CONV(TYPE, POSTFIX, _Sat long _Accum, lk) \
+  CONV(TYPE, POSTFIX, _Sat long long _Accum, llk) \
+  CONV(TYPE, POSTFIX, _Sat unsigned short _Accum, uhk) \
+  CONV(TYPE, POSTFIX, _Sat unsigned _Accum, uk) \
+  CONV(TYPE, POSTFIX, _Sat unsigned long _Accum, ulk) \
+  CONV(TYPE, POSTFIX, _Sat unsigned long long _Accum, ullk) \
+  CONV_INT(TYPE, POSTFIX, signed char) \
+  CONV_INT(TYPE, POSTFIX, short) \
+  CONV_INT(TYPE, POSTFIX, int) \
+  CONV_INT(TYPE, POSTFIX, long) \
+  CONV_INT(TYPE, POSTFIX, long long) \
+  CONV_INT(TYPE, POSTFIX, unsigned char) \
+  CONV_INT(TYPE, POSTFIX, unsigned short) \
+  CONV_INT(TYPE, POSTFIX, unsigned int) \
+  CONV_INT(TYPE, POSTFIX, unsigned long) \
+  CONV_INT(TYPE, POSTFIX, unsigned long long) \
+  CONV_INT(_Sat TYPE, POSTFIX, signed char) \
+  CONV_INT(_Sat TYPE, POSTFIX, short) \
+  CONV_INT(_Sat TYPE, POSTFIX, int) \
+  CONV_INT(_Sat TYPE, POSTFIX, long) \
+  CONV_INT(_Sat TYPE, POSTFIX, long long) \
+  CONV_INT(_Sat TYPE, POSTFIX, unsigned char) \
+  CONV_INT(_Sat TYPE, POSTFIX, unsigned short) \
+  CONV_INT(_Sat TYPE, POSTFIX, unsigned int) \
+  CONV_INT(_Sat TYPE, POSTFIX, unsigned long) \
+  CONV_INT(_Sat TYPE, POSTFIX, unsigned long long) \
+  CONV_FLOAT(TYPE, POSTFIX, float) \
+  CONV_FLOAT(TYPE, POSTFIX, double) \
+  CONV_FLOAT(_Sat TYPE, POSTFIX, float) \
+  CONV_FLOAT(_Sat TYPE, POSTFIX, double)
+
+#define ALL_ACCUM_CONV(TYPE,POSTFIX) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, signed char) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, short) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, int) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, long) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, long long) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned char) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned short) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned int) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned long) \
+  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned long long) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, signed char) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, short) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, int) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, long) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, long long) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned char) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned short) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned int) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned long) \
+  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned long long)
+
+#define NEG_CONV(TYPE,POSTFIX) \
+  CONV_INT2(TYPE, POSTFIX, signed char) \
+  CONV_INT2(TYPE, POSTFIX, short) \
+  CONV_INT2(TYPE, POSTFIX, int) \
+  CONV_INT2(TYPE, POSTFIX, long) \
+  CONV_INT2(TYPE, POSTFIX, long long) \
+  CONV_INT2(TYPE, POSTFIX, unsigned char) \
+  CONV_INT2(TYPE, POSTFIX, unsigned short) \
+  CONV_INT2(TYPE, POSTFIX, unsigned int) \
+  CONV_INT2(TYPE, POSTFIX, unsigned long) \
+  CONV_INT2(TYPE, POSTFIX, unsigned long long) \
+  CONV_INT3(TYPE, POSTFIX, signed char) \
+  CONV_INT3(TYPE, POSTFIX, short) \
+  CONV_INT3(TYPE, POSTFIX, int) \
+  CONV_INT3(TYPE, POSTFIX, long) \
+  CONV_INT3(TYPE, POSTFIX, long long)
+
+/* Signed accum to _Sat unsigned/signed fract.  */
+#define SAT_CONV1(TYPE, POSTFIX) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr)
+
+/* Unsigned accum to _Sat unsigned/signed fract.  */
+#define SAT_CONV2(TYPE, POSTFIX) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr)
+
+/* Signed fract to _Sat unsigned fract.  */
+#define SAT_CONV3(TYPE, POSTFIX) \
+  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned  _Fract, 0.0ur) \
+  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr)
+
+/* Signed integer to _Sat signed/unsigned fract.  */
+#define SAT_CONV4(TYPE) \
+  CONV2(TYPE, 100, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -100, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 100, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -100, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 100, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -100, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 100, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -100, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 100, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -100, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 100, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -100, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 100, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -100, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 100, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -100, _Sat unsigned long long _Fract, 0.0ullr) \
+  CONV2(TYPE, 1, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -1, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 1, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -1, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 1, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -1, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 1, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -1, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 1, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -1, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 1, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -1, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 1, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -1, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 1, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -1, _Sat unsigned long long _Fract, 0.0ullr)
+
+/* Unsigned integer to _Sat signed/unsigned fract.  */
+#define SAT_CONV5(TYPE) \
+  CONV2(TYPE, 100, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, 100, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, 100, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, 100, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, 100, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, 100, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, 100, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, 100, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, 1, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, 1, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, 1, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, 1, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, 1, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, 1, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, 1, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, 1, _Sat unsigned long long _Fract, 1.0ullr)
+
+/* Floating-point to _Sat signed/unsigned fract.  */
+#define SAT_CONV6(TYPE) \
+  CONV2(TYPE, 100.0, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -100.0, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 100.0, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -100.0, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 100.0, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -100.0, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 100.0, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -100.0, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 100.0, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -100.0, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 100.0, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -100.0, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 100.0, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -100.0, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 100.0, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -100.0, _Sat unsigned long long _Fract, 0.0ullr) \
+  CONV2(TYPE, 1.0, _Sat short _Fract, 1.0hr) \
+  CONV2(TYPE, -1.0, _Sat short _Fract, -0.5hr - 0.5hr) \
+  CONV2(TYPE, 1.0, _Sat _Fract, 1.0r) \
+  CONV2(TYPE, -1.0, _Sat _Fract, -0.5r - 0.5r) \
+  CONV2(TYPE, 1.0, _Sat long _Fract, 1.0lr) \
+  CONV2(TYPE, -1.0, _Sat long _Fract, -0.5lr - 0.5lr) \
+  CONV2(TYPE, 1.0, _Sat long long _Fract, 1.0llr) \
+  CONV2(TYPE, -1.0, _Sat long long _Fract, -0.5llr - 0.5llr) \
+  CONV2(TYPE, 1.0, _Sat unsigned short _Fract, 1.0uhr) \
+  CONV2(TYPE, -1.0, _Sat unsigned short _Fract, 0.0uhr) \
+  CONV2(TYPE, 1.0, _Sat unsigned _Fract, 1.0ur) \
+  CONV2(TYPE, -1.0, _Sat unsigned _Fract, 0.0ur) \
+  CONV2(TYPE, 1.0, _Sat unsigned long _Fract, 1.0ulr) \
+  CONV2(TYPE, -1.0, _Sat unsigned long _Fract, 0.0ulr) \
+  CONV2(TYPE, 1.0, _Sat unsigned long long _Fract, 1.0ullr) \
+  CONV2(TYPE, -1.0, _Sat unsigned long long _Fract, 0.0ullr)
+
+int main ()
+{
+  ALL_CONV (short _Fract, hr);
+  ALL_CONV (_Fract, r);
+  ALL_CONV (long _Fract, lr);
+  ALL_CONV (long long _Fract, llr);
+  ALL_CONV (unsigned short _Fract, uhr);
+  ALL_CONV (unsigned _Fract, ur);
+  ALL_CONV (unsigned long _Fract, ulr);
+  ALL_CONV (unsigned long long _Fract, ullr);
+  ALL_CONV (short _Accum, hk);
+  ALL_CONV (_Accum, k);
+  ALL_CONV (long _Accum, lk);
+  ALL_CONV (long long _Accum, llk);
+  ALL_CONV (unsigned short _Accum, uhk);
+  ALL_CONV (unsigned _Accum, uk);
+  ALL_CONV (unsigned long _Accum, ulk);
+  ALL_CONV (unsigned long long _Accum, ullk);
+
+  ALL_ACCUM_CONV (short _Accum, hk);
+  ALL_ACCUM_CONV (_Accum, k);
+  ALL_ACCUM_CONV (long _Accum, lk);
+  ALL_ACCUM_CONV (long long _Accum, llk);
+  ALL_ACCUM_CONV (unsigned short _Accum, uhk);
+  ALL_ACCUM_CONV (unsigned _Accum, uk);
+  ALL_ACCUM_CONV (unsigned long _Accum, ulk);
+  ALL_ACCUM_CONV (unsigned long long _Accum, ullk);
+
+  NEG_CONV (short _Fract, hr);
+  NEG_CONV (_Fract, r);
+  NEG_CONV (long _Fract, lr);
+  NEG_CONV (long long _Fract, llr);
+  NEG_CONV (short _Accum, hk);
+  NEG_CONV (_Accum, k);
+  NEG_CONV (long _Accum, lk);
+  NEG_CONV (long long _Accum, llk);
+
+  SAT_CONV1 (short _Accum, hk);
+  SAT_CONV1 (_Accum, k);
+  SAT_CONV1 (long _Accum, lk);
+  SAT_CONV1 (long long _Accum, llk);
+
+  SAT_CONV2 (unsigned short _Accum, uhk);
+  SAT_CONV2 (unsigned _Accum, uk);
+  SAT_CONV2 (unsigned long _Accum, ulk);
+  SAT_CONV2 (unsigned long long _Accum, ullk);
+
+  SAT_CONV3 (short _Fract, hr);
+  SAT_CONV3 (_Fract, r);
+  SAT_CONV3 (long _Fract, lr);
+  SAT_CONV3 (long long _Fract, llr);
+
+  SAT_CONV4 (signed char);
+  SAT_CONV4 (short);
+  SAT_CONV4 (int);
+  SAT_CONV4 (long);
+  SAT_CONV4 (long long);
+
+  SAT_CONV5 (unsigned char);
+  SAT_CONV5 (unsigned short);
+  SAT_CONV5 (unsigned int);
+  SAT_CONV5 (unsigned long);
+  SAT_CONV5 (unsigned long long);
+
+  SAT_CONV6 (float);
+  SAT_CONV6 (double);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/define.c b/gcc/testsuite/gcc.dg/fixed-point/define.c
new file mode 100644 (file)
index 0000000..b66ade7
--- /dev/null
@@ -0,0 +1,158 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 7.18a.3 - Precision macros.
+
+   Check if defined fixed-point constants are ok.  */
+
+#include <stdfix.h>
+
+short fract sf = SFRACT_MAX;
+fract f = FRACT_MAX;
+long fract lf = LFRACT_MAX;
+long long fract llf = LLFRACT_MAX;
+
+unsigned short fract usf = USFRACT_MAX;
+unsigned fract uf = UFRACT_MAX;
+unsigned long fract ulf = ULFRACT_MAX;
+unsigned long long fract ullf = ULLFRACT_MAX;
+
+sat short fract Ssf = SFRACT_MAX;
+sat fract Sf = FRACT_MAX;
+sat long fract Slf = LFRACT_MAX;
+sat long long fract Sllf = LLFRACT_MAX;
+
+sat unsigned short fract Susf = USFRACT_MAX;
+sat unsigned fract Suf = UFRACT_MAX;
+sat unsigned long fract Sulf = ULFRACT_MAX;
+sat unsigned long long fract Sullf = ULLFRACT_MAX;
+
+short fract sfm = SFRACT_MIN;
+fract fm = FRACT_MIN;
+long fract lfm = LFRACT_MIN;
+long long fract llfm = LLFRACT_MIN;
+
+unsigned short fract usfm = USFRACT_MIN;
+unsigned fract ufm = UFRACT_MIN;
+unsigned long fract ulfm = ULFRACT_MIN;
+unsigned long long fract ullfm = ULLFRACT_MIN;
+
+sat short fract Ssfm = SFRACT_MIN;
+sat fract Sfm = FRACT_MIN;
+sat long fract Slfm = LFRACT_MIN;
+sat long long fract Sllfm = LLFRACT_MIN;
+
+sat unsigned short fract Susfm = USFRACT_MIN;
+sat unsigned fract Sufm = UFRACT_MIN;
+sat unsigned long fract Sulfm = ULFRACT_MIN;
+sat unsigned long long fract Sullfm = ULLFRACT_MIN;
+
+short fract sfE = SFRACT_EPSILON;
+fract fE = FRACT_EPSILON;
+long fract lfE = LFRACT_EPSILON;
+long long fract llfE = LLFRACT_EPSILON;
+
+unsigned short fract usfE = USFRACT_EPSILON;
+unsigned fract ufE = UFRACT_EPSILON;
+unsigned long fract ulfE = ULFRACT_EPSILON;
+unsigned long long fract ullfE = ULLFRACT_EPSILON;
+
+sat short fract SsfE = SFRACT_EPSILON;
+sat fract SfE = FRACT_EPSILON;
+sat long fract SlfE = LFRACT_EPSILON;
+sat long long fract SllfE = LLFRACT_EPSILON;
+
+sat unsigned short fract SusfE = USFRACT_EPSILON;
+sat unsigned fract SufE = UFRACT_EPSILON;
+sat unsigned long fract SulfE = ULFRACT_EPSILON;
+sat unsigned long long fract SullfE = ULLFRACT_EPSILON;
+
+short accum sk = SACCUM_MAX;
+accum k = ACCUM_MAX;
+long accum lk = LACCUM_MAX;
+long long accum llk = LLACCUM_MAX;
+
+unsigned short accum usk = USACCUM_MAX;
+unsigned accum uk = UACCUM_MAX;
+unsigned long accum ulk = ULACCUM_MAX;
+unsigned long long accum ullk = ULLACCUM_MAX;
+
+sat short accum Ssk = SACCUM_MAX;
+sat accum Sk = ACCUM_MAX;
+sat long accum Slk = LACCUM_MAX;
+sat long long accum Sllk = LLACCUM_MAX;
+
+sat unsigned short accum Susk = USACCUM_MAX;
+sat unsigned accum Suk = UACCUM_MAX;
+sat unsigned long accum Sulk = ULACCUM_MAX;
+sat unsigned long long accum Sullk = ULLACCUM_MAX;
+
+short accum skm = SACCUM_MIN;
+accum km = ACCUM_MIN;
+long accum lkm = LACCUM_MIN;
+long long accum llkm = LLACCUM_MIN;
+
+unsigned short accum uskm = USACCUM_MIN;
+unsigned accum ukm = UACCUM_MIN;
+unsigned long accum ulkm = ULACCUM_MIN;
+unsigned long long accum ullkm = ULLACCUM_MIN;
+
+sat short accum Sskm = SACCUM_MIN;
+sat accum Skm = ACCUM_MIN;
+sat long accum Slkm = LACCUM_MIN;
+sat long long accum Sllkm = LLACCUM_MIN;
+
+sat unsigned short accum Suskm = USACCUM_MIN;
+sat unsigned accum Sukm = UACCUM_MIN;
+sat unsigned long accum Sulkm = ULACCUM_MIN;
+sat unsigned long long accum Sullkm = ULLACCUM_MIN;
+
+short accum skE = SACCUM_EPSILON;
+accum kE = ACCUM_EPSILON;
+long accum lkE = LACCUM_EPSILON;
+long long accum llkE = LLACCUM_EPSILON;
+
+unsigned short accum uskE = USACCUM_EPSILON;
+unsigned accum ukE = UACCUM_EPSILON;
+unsigned long accum ulkE = ULACCUM_EPSILON;
+unsigned long long accum ullkE = ULLACCUM_EPSILON;
+
+sat short accum SskE = SACCUM_EPSILON;
+sat accum SkE = ACCUM_EPSILON;
+sat long accum SlkE = LACCUM_EPSILON;
+sat long long accum SllkE = LLACCUM_EPSILON;
+
+sat unsigned short accum SuskE = USACCUM_EPSILON;
+sat unsigned accum SukE = UACCUM_EPSILON;
+sat unsigned long accum SulkE = ULACCUM_EPSILON;
+sat unsigned long long accum SullkE = ULLACCUM_EPSILON;
+
+int fbit_sf = SFRACT_FBIT;
+int fbit_f = FRACT_FBIT;
+int fbit_lf = LFRACT_FBIT;
+int fbit_llf = LLFRACT_FBIT;
+
+int fbit_usf = USFRACT_FBIT;
+int fbit_uf = UFRACT_FBIT;
+int fbit_ulf = ULFRACT_FBIT;
+int fbit_ullf = ULLFRACT_FBIT;
+
+int fbit_sk = SACCUM_FBIT;
+int fbit_k = ACCUM_FBIT;
+int fbit_lk = LACCUM_FBIT;
+int fbit_llk = LLACCUM_FBIT;
+
+int fbit_usk = USACCUM_FBIT;
+int fbit_uk = UACCUM_FBIT;
+int fbit_ulk = ULACCUM_FBIT;
+int fbit_ullk = ULLACCUM_FBIT;
+
+int ibit_sk = SACCUM_IBIT;
+int ibit_k = ACCUM_IBIT;
+int ibit_lk = LACCUM_IBIT;
+int ibit_llk = LLACCUM_IBIT;
+
+int ibit_usk = USACCUM_IBIT;
+int ibit_uk = UACCUM_IBIT;
+int ibit_ulk = ULACCUM_IBIT;
+int ibit_ullk = ULLACCUM_IBIT;
diff --git a/gcc/testsuite/gcc.dg/fixed-point/fixed-point.exp b/gcc/testsuite/gcc.dg/fixed-point/fixed-point.exp
new file mode 100644 (file)
index 0000000..fb7e73d
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright (C) 1997, 2004 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 2 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# 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_fixed_point] } {
+    return;
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-array.c b/gcc/testsuite/gcc.dg/fixed-point/func-array.c
new file mode 100644 (file)
index 0000000..0d0e8c1
--- /dev/null
@@ -0,0 +1,102 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test passing array elements involving fixed-point types.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+/* A handful of functions that return the Nth argument of
+   an incoming array.  */
+
+#define FUNC(TYPE,NAME) \
+TYPE NAME ## 0 (TYPE args[]) { return args[0]; } \
+TYPE NAME ## 1 (TYPE args[]) { return args[1]; } \
+TYPE NAME ## 2 (TYPE args[]) { return args[2]; } \
+TYPE NAME ## 3 (TYPE args[]) { return args[3]; } \
+TYPE NAME ## 4 (TYPE args[]) { return args[4]; } \
+TYPE NAME ## 5 (TYPE args[]) { return args[5]; }
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(TYPE,NAME,PF) \
+  { \
+    TYPE NAME[] = { 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, \
+                   0.5 ## PF }; \
+    if (NAME ## 0 (NAME) != 0.0 ## PF) abort (); \
+    if (NAME ## 1 (NAME) != 0.1 ## PF) abort (); \
+    if (NAME ## 2 (NAME) != 0.2 ## PF) abort (); \
+    if (NAME ## 3 (NAME) != 0.3 ## PF) abort (); \
+    if (NAME ## 4 (NAME) != 0.4 ## PF) abort (); \
+    if (NAME ## 5 (NAME) != 0.5 ## PF) abort (); \
+  }
+
+  TEST (short _Fract, sf, hr)
+  TEST (_Fract, f, r)
+  TEST (long _Fract, lf, lr)
+  TEST (long long _Fract, llf, llr)
+  TEST (unsigned short _Fract, usf, uhr)
+  TEST (unsigned _Fract, uf, ur)
+  TEST (unsigned long _Fract, ulf, ulr)
+  TEST (unsigned long long _Fract, ullf, ullr)
+  TEST (_Sat short _Fract, Ssf, hr)
+  TEST (_Sat _Fract, Sf, r)
+  TEST (_Sat long _Fract, Slf, lr)
+  TEST (_Sat long long _Fract, Sllf, llr)
+  TEST (_Sat unsigned short _Fract, Susf, uhr)
+  TEST (_Sat unsigned _Fract, Suf, ur)
+  TEST (_Sat unsigned long _Fract, Sulf, ulr)
+  TEST (_Sat unsigned long long _Fract, Sullf, ullr)
+  TEST (short _Accum, sa, hk)
+  TEST (_Accum, a, k)
+  TEST (long _Accum, la, lk)
+  TEST (long long _Accum, lla, llk)
+  TEST (unsigned short _Accum, usa, uhk)
+  TEST (unsigned _Accum, ua, uk)
+  TEST (unsigned long _Accum, ula, ulk)
+  TEST (unsigned long long _Accum, ulla, ullk)
+  TEST (_Sat short _Accum, Ssa, hk)
+  TEST (_Sat _Accum, Sa, k)
+  TEST (_Sat long _Accum, Sla, lk)
+  TEST (_Sat long long _Accum, Slla, llk)
+  TEST (_Sat unsigned short _Accum, Susa, uhk)
+  TEST (_Sat unsigned _Accum, Sua, uk)
+  TEST (_Sat unsigned long _Accum, Sula, ulk)
+  TEST (_Sat unsigned long long _Accum, Sulla, ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-mixed.c b/gcc/testsuite/gcc.dg/fixed-point/func-mixed.c
new file mode 100644 (file)
index 0000000..01930e4
--- /dev/null
@@ -0,0 +1,103 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test scalar passing and return values involving fixed-point types.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+/* A handful of functions that return the Nth argument of
+   an incoming array.  */
+
+#define FUNC(TYPE,NAME) \
+TYPE NAME ## 0 (TYPE arg0, int arg1, unsigned arg2, float arg3, double arg4) \
+  { return arg0; } \
+TYPE NAME ## 1 (int arg0, TYPE arg1, unsigned arg2, float arg3, double arg4) \
+  { return arg1; } \
+TYPE NAME ## 2 (int arg0, unsigned arg1, TYPE arg2, float arg3, double arg4) \
+  { return arg2; } \
+TYPE NAME ## 3 (int arg0, unsigned arg1, float arg2, TYPE arg3, double arg4) \
+  { return arg3; } \
+TYPE NAME ## 4 (int arg0, unsigned arg1, float arg2, double arg3, TYPE arg4) \
+  { return arg4; }
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(TYPE,NAME,PF) \
+  { \
+    if (NAME ## 0 (0.1 ## PF, -1, 1, 0.3f, 0.5) != 0.1 ## PF) abort (); \
+    if (NAME ## 1 (-1, 0.1 ## PF, 1, 0.3f, 0.5) != 0.1 ## PF) abort (); \
+    if (NAME ## 2 (-1, 1, 0.1 ## PF, 0.3f, 0.5) != 0.1 ## PF) abort (); \
+    if (NAME ## 3 (-1, 1, 0.3f, 0.1 ## PF, 0.5) != 0.1 ## PF) abort (); \
+    if (NAME ## 4 (-1, 1, 0.3f, 0.5, 0.1 ## PF) != 0.1 ## PF) abort (); \
+  }
+
+  TEST (short _Fract, sf, hr)
+  TEST (_Fract, f, r)
+  TEST (long _Fract, lf, lr)
+  TEST (long long _Fract, llf, llr)
+  TEST (unsigned short _Fract, usf, uhr)
+  TEST (unsigned _Fract, uf, ur)
+  TEST (unsigned long _Fract, ulf, ulr)
+  TEST (unsigned long long _Fract, ullf, ullr)
+  TEST (_Sat short _Fract, Ssf, hr)
+  TEST (_Sat _Fract, Sf, r)
+  TEST (_Sat long _Fract, Slf, lr)
+  TEST (_Sat long long _Fract, Sllf, llr)
+  TEST (_Sat unsigned short _Fract, Susf, uhr)
+  TEST (_Sat unsigned _Fract, Suf, ur)
+  TEST (_Sat unsigned long _Fract, Sulf, ulr)
+  TEST (_Sat unsigned long long _Fract, Sullf, ullr)
+  TEST (short _Accum, sa, hk)
+  TEST (_Accum, a, k)
+  TEST (long _Accum, la, lk)
+  TEST (long long _Accum, lla, llk)
+  TEST (unsigned short _Accum, usa, uhk)
+  TEST (unsigned _Accum, ua, uk)
+  TEST (unsigned long _Accum, ula, ulk)
+  TEST (unsigned long long _Accum, ulla, ullk)
+  TEST (_Sat short _Accum, Ssa, hk)
+  TEST (_Sat _Accum, Sa, k)
+  TEST (_Sat long _Accum, Sla, lk)
+  TEST (_Sat long long _Accum, Slla, llk)
+  TEST (_Sat unsigned short _Accum, Susa, uhk)
+  TEST (_Sat unsigned _Accum, Sua, uk)
+  TEST (_Sat unsigned long _Accum, Sula, ulk)
+  TEST (_Sat unsigned long long _Accum, Sulla, ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-scalar.c b/gcc/testsuite/gcc.dg/fixed-point/func-scalar.c
new file mode 100644 (file)
index 0000000..957b562
--- /dev/null
@@ -0,0 +1,108 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test scalar passing and return values involving fixed-point types.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+/* A handful of functions that return the Nth argument of
+   an incoming array.  */
+
+#define FUNC(TYPE,NAME) \
+TYPE NAME ## 0 (TYPE arg0, TYPE arg1, TYPE arg2, TYPE arg3, TYPE arg4) \
+  { return arg0; } \
+TYPE NAME ## 1 (TYPE arg0, TYPE arg1, TYPE arg2, TYPE arg3, TYPE arg4) \
+  { return arg1; } \
+TYPE NAME ## 2 (TYPE arg0, TYPE arg1, TYPE arg2, TYPE arg3, TYPE arg4) \
+  { return arg2; } \
+TYPE NAME ## 3 (TYPE arg0, TYPE arg1, TYPE arg2, TYPE arg3, TYPE arg4) \
+  { return arg3; } \
+TYPE NAME ## 4 (TYPE arg0, TYPE arg1, TYPE arg2, TYPE arg3, TYPE arg4) \
+  { return arg4; }
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(TYPE,NAME,PF) \
+  { \
+    if (NAME ## 0 (0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, 0.5 ## PF) \
+       != 0.1 ## PF) abort (); \
+    if (NAME ## 1 (0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, 0.5 ## PF) \
+       != 0.2 ## PF) abort (); \
+    if (NAME ## 2 (0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, 0.5 ## PF) \
+       != 0.3 ## PF) abort (); \
+    if (NAME ## 3 (0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, 0.5 ## PF) \
+       != 0.4 ## PF) abort (); \
+    if (NAME ## 4 (0.1 ## PF, 0.2 ## PF, 0.3 ## PF, 0.4 ## PF, 0.5 ## PF) \
+       != 0.5 ## PF) abort (); \
+  }
+
+  TEST (short _Fract, sf, hr)
+  TEST (_Fract, f, r)
+  TEST (long _Fract, lf, lr)
+  TEST (long long _Fract, llf, llr)
+  TEST (unsigned short _Fract, usf, uhr)
+  TEST (unsigned _Fract, uf, ur)
+  TEST (unsigned long _Fract, ulf, ulr)
+  TEST (unsigned long long _Fract, ullf, ullr)
+  TEST (_Sat short _Fract, Ssf, hr)
+  TEST (_Sat _Fract, Sf, r)
+  TEST (_Sat long _Fract, Slf, lr)
+  TEST (_Sat long long _Fract, Sllf, llr)
+  TEST (_Sat unsigned short _Fract, Susf, uhr)
+  TEST (_Sat unsigned _Fract, Suf, ur)
+  TEST (_Sat unsigned long _Fract, Sulf, ulr)
+  TEST (_Sat unsigned long long _Fract, Sullf, ullr)
+  TEST (short _Accum, sa, hk)
+  TEST (_Accum, a, k)
+  TEST (long _Accum, la, lk)
+  TEST (long long _Accum, lla, llk)
+  TEST (unsigned short _Accum, usa, uhk)
+  TEST (unsigned _Accum, ua, uk)
+  TEST (unsigned long _Accum, ula, ulk)
+  TEST (unsigned long long _Accum, ulla, ullk)
+  TEST (_Sat short _Accum, Ssa, hk)
+  TEST (_Sat _Accum, Sa, k)
+  TEST (_Sat long _Accum, Sla, lk)
+  TEST (_Sat long long _Accum, Slla, llk)
+  TEST (_Sat unsigned short _Accum, Susa, uhk)
+  TEST (_Sat unsigned _Accum, Sua, uk)
+  TEST (_Sat unsigned long _Accum, Sula, ulk)
+  TEST (_Sat unsigned long long _Accum, Sulla, ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-struct.c b/gcc/testsuite/gcc.dg/fixed-point/func-struct.c
new file mode 100644 (file)
index 0000000..c753888
--- /dev/null
@@ -0,0 +1,191 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test structure passing and return values involving fixed-point types.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+struct example
+{
+  short _Fract sf;
+  char dummy1;
+  _Fract f;
+  char dummy2;
+  long _Fract lf;
+  char dummy3;
+  long long _Fract llf;
+  char dummy4;
+  unsigned short _Fract usf;
+  char dummy5;
+  unsigned _Fract uf;
+  char dummy6;
+  unsigned long _Fract ulf;
+  char dummy7;
+  unsigned long long _Fract ullf;
+  char dummy8;
+  _Sat short _Fract Ssf;
+  char dummy9;
+  _Sat _Fract Sf;
+  char dummy10;
+  _Sat long _Fract Slf;
+  char dummy11;
+  _Sat long long _Fract Sllf;
+  char dummy12;
+  _Sat unsigned short _Fract Susf;
+  char dummy13;
+  _Sat unsigned _Fract Suf;
+  char dummy14;
+  _Sat unsigned long _Fract Sulf;
+  char dummy15;
+  _Sat unsigned long long _Fract Sullf;
+  char dummy16;
+  short _Accum sa;
+  char dummya1;
+  _Accum a;
+  char dummya2;
+  long _Accum la;
+  char dummya3;
+  long long _Accum lla;
+  char dummya4;
+  unsigned short _Accum usa;
+  char dummya5;
+  unsigned _Accum ua;
+  char dummya6;
+  unsigned long _Accum ula;
+  char dummya7;
+  unsigned long long _Accum ulla;
+  char dummya8;
+  _Sat short _Accum Ssa;
+  char dummya9;
+  _Sat _Accum Sa;
+  char dummya10;
+  _Sat long _Accum Sla;
+  char dummya11;
+  _Sat long long _Accum Slla;
+  char dummya12;
+  _Sat unsigned short _Accum Susa;
+  char dummya13;
+  _Sat unsigned _Accum Sua;
+  char dummya14;
+  _Sat unsigned long _Accum Sula;
+  char dummya15;
+  _Sat unsigned long long _Accum Sulla;
+  char dummya16;
+} nums = { 0.1hr, 'a',
+          0.2r, 'b',
+          0.3lr, 'c',
+          0.4llr, 'd',
+          0.5uhr, 'e',
+          0.6ur, 'f',
+          0.7ulr, 'g',
+          0.8ullr, 'h',
+          0.11r, 'i',
+          0.22r, 'j',
+          0.33lr, 'k',
+          0.44llr, 'l',
+          0.55uhr, 'm',
+          0.66ur, 'n',
+          0.77ulr, 'o',
+          0.88ullr, 'p',
+          0.1hk, 'q',
+          0.2k, 'r',
+          0.3lk, 's',
+          0.4llk, 't',
+          0.5uhk, 'u',
+          0.6uk, 'v',
+          0.7ulk, 'w',
+          0.8ullk, 'x',
+          0.11k, 'y',
+          0.22k, 'z',
+          0.33lk, '0',
+          0.44llk, '1',
+          0.55uhk, '2',
+          0.66uk, '3',
+          0.77ulk, '4',
+          0.88ullk, '5'
+        };
+
+/* A handful of functions that return the Nth argument of
+   an incoming array.  */
+
+#define FUNC(TYPE,NAME) \
+TYPE NAME ## _func (struct example s) \
+  { return s. NAME; }
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(TYPE,NAME,VALUE) \
+  { \
+    if (NAME ## _func (nums) != VALUE) abort (); \
+  }
+
+  TEST (short _Fract, sf, 0.1hr)
+  TEST (_Fract, f, 0.2r)
+  TEST (long _Fract, lf, 0.3lr)
+  TEST (long long _Fract, llf, 0.4llr)
+  TEST (unsigned short _Fract, usf, 0.5uhr)
+  TEST (unsigned _Fract, uf, 0.6ur)
+  TEST (unsigned long _Fract, ulf, 0.7ulr)
+  TEST (unsigned long long _Fract, ullf, 0.8ullr)
+  TEST (_Sat short _Fract, Ssf, 0.11hr)
+  TEST (_Sat _Fract, Sf, 0.22r)
+  TEST (_Sat long _Fract, Slf, 0.33lr)
+  TEST (_Sat long long _Fract, Sllf, 0.44llr)
+  TEST (_Sat unsigned short _Fract, Susf, 0.55uhr)
+  TEST (_Sat unsigned _Fract, Suf, 0.66ur)
+  TEST (_Sat unsigned long _Fract, Sulf, 0.77ulr)
+  TEST (_Sat unsigned long long _Fract, Sullf, 0.88ullr)
+  TEST (short _Accum, sa, 0.1hk)
+  TEST (_Accum, a, 0.2k)
+  TEST (long _Accum, la, 0.3lk)
+  TEST (long long _Accum, lla, 0.4llk)
+  TEST (unsigned short _Accum, usa, 0.5uhk)
+  TEST (unsigned _Accum, ua, 0.6uk)
+  TEST (unsigned long _Accum, ula, 0.7ulk)
+  TEST (unsigned long long _Accum, ulla, 0.8ullk)
+  TEST (_Sat short _Accum, Ssa, 0.11hk)
+  TEST (_Sat _Accum, Sa, 0.22k)
+  TEST (_Sat long _Accum, Sla, 0.33lk)
+  TEST (_Sat long long _Accum, Slla, 0.44llk)
+  TEST (_Sat unsigned short _Accum, Susa, 0.55uhk)
+  TEST (_Sat unsigned _Accum, Sua, 0.66uk)
+  TEST (_Sat unsigned long _Accum, Sula, 0.77ulk)
+  TEST (_Sat unsigned long long _Accum, Sulla, 0.88ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-vararg-mixed.c b/gcc/testsuite/gcc.dg/fixed-point/func-vararg-mixed.c
new file mode 100644 (file)
index 0000000..61a30e7
--- /dev/null
@@ -0,0 +1,145 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test passing varargs of fixed-point types.
+   Based on the test from ../dfp/.  */
+
+#include <stdarg.h>
+
+extern void abort (void);
+
+static int
+vararg_int (unsigned arg, ...)
+{
+  va_list ap;
+  int result_i;
+  va_start (ap, arg);
+  result_i = va_arg (ap, int);
+  return result_i;
+}
+
+static _Fract
+vararg_fract (unsigned arg, ...)
+{
+  va_list ap;
+  int result_i;
+  _Fract result_fr; \
+  va_start (ap, arg);
+  result_i = va_arg (ap, int);
+  result_fr = va_arg (ap, _Fract); \
+  return result_fr;
+}
+
+static int
+vararg_double (unsigned arg, ...)
+{
+  va_list ap;
+  int result_i;
+  _Fract result_fr; \
+  double result_d;
+  va_start (ap, arg);
+  result_i = va_arg (ap, int);
+  result_fr = va_arg (ap, _Fract); \
+  result_d = va_arg (ap, double); \
+  return result_d;
+}
+
+#define FUNC(TYPE, NAME) \
+static TYPE \
+vararg_ ## NAME (unsigned arg, ...) \
+{ \
+  va_list ap; \
+  int result_i; \
+  _Fract result_fr; \
+  double result_d; \
+  TYPE result; \
+  va_start (ap, arg); \
+  result_i = va_arg (ap, int); \
+  result_fr = va_arg (ap, _Fract); \
+  result_d = va_arg (ap, double); \
+  result = va_arg (ap, TYPE); \
+  va_end (ap); \
+  return result; \
+}
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(NAME,PF) \
+  if (vararg_int  (0, 100, 0.9r, 55.0, 0.2 ## PF) != 100) \
+    abort (); \
+  if (vararg_fract  (1, 100, 0.9r, 55.0, 0.2 ## PF) != 0.9r) \
+    abort (); \
+  if (vararg_double  (2, 100, 0.9r, 55.0, 0.2 ## PF) != 55.0) \
+    abort (); \
+  if (vararg_ ## NAME (3, 100, 0.9r, 55.0, 0.2 ## PF) != 0.2 ## PF) \
+    abort (); \
+
+  TEST(sf, hr)
+  TEST(f, r)
+  TEST(lf, lr)
+  TEST(llf, llr)
+  TEST(usf, uhr)
+  TEST(uf, ur)
+  TEST(ulf, ulr)
+  TEST(ullf, ullr)
+  TEST(Ssf, hr)
+  TEST(Sf, r)
+  TEST(Slf, lr)
+  TEST(Sllf, llr)
+  TEST(Susf, uhr)
+  TEST(Suf, ur)
+  TEST(Sulf, ulr)
+  TEST(Sullf, ullr)
+  TEST(sa, hk)
+  TEST(a, k)
+  TEST(la, lk)
+  TEST(lla, llk)
+  TEST(usa, uhk)
+  TEST(ua, uk)
+  TEST(ula, ulk)
+  TEST(ulla, ullk)
+  TEST(Ssa, hk)
+  TEST(Sa, k)
+  TEST(Sla, lk)
+  TEST(Slla, llk)
+  TEST(Susa, uhk)
+  TEST(Sua, uk)
+  TEST(Sula, ulk)
+  TEST(Sulla, ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-vararg-size0.c b/gcc/testsuite/gcc.dg/fixed-point/func-vararg-size0.c
new file mode 100644 (file)
index 0000000..7c54e91
--- /dev/null
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Based on the test from ../dfp/.  */
+
+#include <stdarg.h>
+
+extern void abort (void);
+
+struct S1
+{
+  struct
+  {
+    _Fract e;
+  } b[0];
+};
+
+/* Test handling vararg parameters whose size is 0.  */
+
+int check_var(int z,...)
+{
+  double d;
+  struct S1 s1;
+  long long result;
+  va_list ap;
+  va_start (ap, z);
+  d = va_arg (ap, double);
+  s1 = va_arg (ap, struct S1);
+  result = va_arg (ap, long long);
+  va_end (ap);
+  return (result == 2LL);
+
+}
+
+int
+main ()
+{
+  struct S1 s1;
+  struct S1 a1[5];
+
+  if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/func-vararg.c b/gcc/testsuite/gcc.dg/fixed-point/func-vararg.c
new file mode 100644 (file)
index 0000000..9f517ae
--- /dev/null
@@ -0,0 +1,115 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.2.2 Function calls.
+   Test passing varargs of fixed-point types.
+   Based on the test from ../dfp/.  */
+
+#include <stdarg.h>
+
+extern void abort (void);
+
+#define FUNC(TYPE, NAME) \
+static TYPE \
+vararg_ ## NAME (unsigned arg, ...) \
+{ \
+  int i; \
+  va_list ap; \
+  TYPE result; \
+  va_start (ap, arg); \
+  for (i = 0; i <= arg; i++) \
+    result = va_arg (ap, TYPE); \
+  va_end (ap); \
+  return result; \
+}
+
+FUNC (short _Fract, sf)
+FUNC (_Fract, f)
+FUNC (long _Fract, lf)
+FUNC (long long _Fract, llf)
+FUNC (unsigned short _Fract, usf)
+FUNC (unsigned _Fract, uf)
+FUNC (unsigned long _Fract, ulf)
+FUNC (unsigned long long _Fract, ullf)
+FUNC (_Sat short _Fract, Ssf)
+FUNC (_Sat _Fract, Sf)
+FUNC (_Sat long _Fract, Slf)
+FUNC (_Sat long long _Fract, Sllf)
+FUNC (_Sat unsigned short _Fract, Susf)
+FUNC (_Sat unsigned _Fract, Suf)
+FUNC (_Sat unsigned long _Fract, Sulf)
+FUNC (_Sat unsigned long long _Fract, Sullf)
+FUNC (short _Accum, sa)
+FUNC (_Accum, a)
+FUNC (long _Accum, la)
+FUNC (long long _Accum, lla)
+FUNC (unsigned short _Accum, usa)
+FUNC (unsigned _Accum, ua)
+FUNC (unsigned long _Accum, ula)
+FUNC (unsigned long long _Accum, ulla)
+FUNC (_Sat short _Accum, Ssa)
+FUNC (_Sat _Accum, Sa)
+FUNC (_Sat long _Accum, Sla)
+FUNC (_Sat long long _Accum, Slla)
+FUNC (_Sat unsigned short _Accum, Susa)
+FUNC (_Sat unsigned _Accum, Sua)
+FUNC (_Sat unsigned long _Accum, Sula)
+FUNC (_Sat unsigned long long _Accum, Sulla)
+
+int main()
+{
+#define TEST(NAME,PF) \
+  if (vararg_ ## NAME (0, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.0 ## PF) \
+    abort (); \
+  if (vararg_ ## NAME (1, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.1 ## PF) \
+    abort (); \
+  if (vararg_ ## NAME (2, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.2 ## PF) \
+    abort (); \
+  if (vararg_ ## NAME (3, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.3 ## PF) \
+    abort (); \
+  if (vararg_ ## NAME (4, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.4 ## PF) \
+    abort (); \
+  if (vararg_ ## NAME (5, 0.0 ## PF, 0.1 ## PF, 0.2 ## PF, 0.3 ## PF, \
+                      0.4 ## PF, 0.5 ## PF) != 0.5 ## PF) \
+    abort ();
+
+  TEST(sf, hr)
+  TEST(f, r)
+  TEST(lf, lr)
+  TEST(llf, llr)
+  TEST(usf, uhr)
+  TEST(uf, ur)
+  TEST(ulf, ulr)
+  TEST(ullf, ullr)
+  TEST(Ssf, hr)
+  TEST(Sf, r)
+  TEST(Slf, lr)
+  TEST(Sllf, llr)
+  TEST(Susf, uhr)
+  TEST(Suf, ur)
+  TEST(Sulf, ulr)
+  TEST(Sullf, ullr)
+  TEST(sa, hk)
+  TEST(a, k)
+  TEST(la, lk)
+  TEST(lla, llk)
+  TEST(usa, uhk)
+  TEST(ua, uk)
+  TEST(ula, ulk)
+  TEST(ulla, ullk)
+  TEST(Ssa, hk)
+  TEST(Sa, k)
+  TEST(Sla, lk)
+  TEST(Slla, llk)
+  TEST(Susa, uhk)
+  TEST(Sua, uk)
+  TEST(Sula, ulk)
+  TEST(Sulla, ullk)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/int-warning.c b/gcc/testsuite/gcc.dg/fixed-point/int-warning.c
new file mode 100644 (file)
index 0000000..cf48e4b
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -O2" } */
+
+/* N1169 Conversion from fixed-point to integer.
+   Test if GCC warns when overflow or underflow.  */
+
+signed char sc;
+unsigned char uc;
+
+void test()
+{
+  sc = 500k; /* { dg-warning "overflow in implicit constant conversion" } */
+  sc = -500k; /* { dg-warning "overflow in implicit constant conversion" } */
+  sc = 500lk; /* { dg-warning "overflow in implicit constant conversion" } */
+  sc = -500lk; /* { dg-warning "overflow in implicit constant conversion" } */
+  sc = 500llk; /* { dg-warning "overflow in implicit constant conversion" } */
+  sc = -500llk; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = 500k; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = -500k; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = 500lk; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = -500lk; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = 500llk; /* { dg-warning "overflow in implicit constant conversion" } */
+  uc = -500llk; /* { dg-warning "overflow in implicit constant conversion" } */
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/keywords-c89.c b/gcc/testsuite/gcc.dg/fixed-point/keywords-c89.c
new file mode 100644 (file)
index 0000000..df85214
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c89" } */
+
+/* Flixed-point keywords are not recognized in C89 mode.  */
+
+_Fract w;              /* { dg-error "" } */
+_Accum x;              /* { dg-error "" } */
+_Sat _Fract y;         /* { dg-error "" } */
+_Sat _Accum z;         /* { dg-error "" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/keywords-c99.c b/gcc/testsuite/gcc.dg/fixed-point/keywords-c99.c
new file mode 100644 (file)
index 0000000..471e004
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+/* Fixed-point keywords are not recognized in C99 mode.  */
+
+_Fract w;              /* { dg-error "" } */
+_Accum x;              /* { dg-error "" } */
+_Sat _Fract y;         /* { dg-error "" } */
+_Sat _Fract z;         /* { dg-error "" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/keywords-ignored-c99.c b/gcc/testsuite/gcc.dg/fixed-point/keywords-ignored-c99.c
new file mode 100644 (file)
index 0000000..c20b8e4
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+
+/* Fixed-point keywords are not reserved for c99.  */
+
+int _Fract (void)
+{
+  return 0;
+}
+
+int _Accum (void)
+{
+  return 0;
+}
+
+int _Sat (void)
+{
+  return 0;
+}
+
+int foo1 (int i)
+{
+  int _Fract = i * 2;
+  return _Fract;
+}
+
+int foo2 (int i)
+{
+  int _Accum = i * 2;
+  return _Accum;
+}
+
+int foo3 (int i)
+{
+  int _Sat = i * 2;
+  return _Sat;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/keywords-pedantic.c b/gcc/testsuite/gcc.dg/fixed-point/keywords-pedantic.c
new file mode 100644 (file)
index 0000000..6547106
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -pedantic" } */
+
+/* Fixed-point is a GCC extension.  */
+
+_Fract w;              /* { dg-warning "GCC extension|ISO C" } */
+_Accum x;              /* { dg-warning "GCC extension|ISO C" } */
+_Sat _Fract y;         /* { dg-warning "GCC extension|ISO C" } */
+_Sat _Accum z;         /* { dg-warning "GCC extension|ISO C" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/keywords-reserved.c b/gcc/testsuite/gcc.dg/fixed-point/keywords-reserved.c
new file mode 100644 (file)
index 0000000..63b6349
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.4.1: Keywords.
+   C99 6.4.1(2): Keywords.
+   Fixed-point keywords cannot be used in other contexts.  */
+
+int _Fract (void)              /* { dg-error "" } */
+{
+  return 0;
+}
+
+int _Accum (void)              /* { dg-error "" } */
+{
+  return 0;
+}
+
+int _Sat (void)                        /* { dg-error "" } */
+{
+  return 0;
+}
+
+int foo1 (int i)
+{
+  int _Fract = i * 2;          /* { dg-error "" } */
+  return _Fract;               /* { dg-error "" } */
+}
+
+int foo2 (int i)
+{
+  int _Accum = i * 2;          /* { dg-error "" } */
+  return _Accum;               /* { dg-error "" } */
+}
+
+int foo3 (int i)
+{
+  int _Sat = i * 2;            /* { dg-error "" } */
+  return _Sat;                 /* { dg-error "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/loop-index.c b/gcc/testsuite/gcc.dg/fixed-point/loop-index.c
new file mode 100644 (file)
index 0000000..d7ed911
--- /dev/null
@@ -0,0 +1,91 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.8.5.2: The for statement.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+#define FUNC(TYPE,NAME,PF) \
+void \
+NAME (void) \
+{ \
+  TYPE d; \
+  int i; \
+  for (d = 0.1 ## PF, i = 0; d <= 0.8 ## PF; d += 0.1 ## PF) \
+    i++; \
+  if (i != 8) \
+    abort(); \
+}
+
+FUNC (short _Fract, sf, hr)
+FUNC (_Fract, f, r)
+FUNC (long _Fract, lf, lr)
+FUNC (long long _Fract, llf, llr)
+FUNC (unsigned short _Fract, usf, uhr)
+FUNC (unsigned _Fract, uf, ur)
+FUNC (unsigned long _Fract, ulf, ulr)
+FUNC (unsigned long long _Fract, ullf, ullr)
+FUNC (_Sat short _Fract, Ssf, hr)
+FUNC (_Sat _Fract, Sf, r)
+FUNC (_Sat long _Fract, Slf, lr)
+FUNC (_Sat long long _Fract, Sllf, llr)
+FUNC (_Sat unsigned short _Fract, Susf, uhr)
+FUNC (_Sat unsigned _Fract, Suf, ur)
+FUNC (_Sat unsigned long _Fract, Sulf, ulr)
+FUNC (_Sat unsigned long long _Fract, Sullf, ullr)
+FUNC (short _Accum, sa, hk)
+FUNC (_Accum, a, k)
+FUNC (long _Accum, la, lk)
+FUNC (long long _Accum, lla, llk)
+FUNC (unsigned short _Accum, usa, uhk)
+FUNC (unsigned _Accum, ua, uk)
+FUNC (unsigned long _Accum, ula, ulk)
+FUNC (unsigned long long _Accum, ulla, ullk)
+FUNC (_Sat short _Accum, Ssa, hk)
+FUNC (_Sat _Accum, Sa, k)
+FUNC (_Sat long _Accum, Sla, lk)
+FUNC (_Sat long long _Accum, Slla, llk)
+FUNC (_Sat unsigned short _Accum, Susa, uhk)
+FUNC (_Sat unsigned _Accum, Sua, uk)
+FUNC (_Sat unsigned long _Accum, Sula, ulk)
+FUNC (_Sat unsigned long long _Accum, Sulla, ullk)
+
+int
+main ()
+{
+  sf ();
+  f ();
+  lf ();
+  llf ();
+  usf ();
+  uf ();
+  ulf ();
+  ullf ();
+  Ssf ();
+  Sf ();
+  Slf ();
+  Sllf ();
+  Susf ();
+  Suf ();
+  Sulf ();
+  Sullf ();
+  sa ();
+  a ();
+  la ();
+  lla ();
+  usa ();
+  ua ();
+  ula ();
+  ulla ();
+  Ssa ();
+  Sa ();
+  Sla ();
+  Slla ();
+  Susa ();
+  Sua ();
+  Sula ();
+  Sulla ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/modes.c b/gcc/testsuite/gcc.dg/fixed-point/modes.c
new file mode 100644 (file)
index 0000000..082b2b2
--- /dev/null
@@ -0,0 +1,119 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+typedef _Fract qq  __attribute__ ((mode (QQ)));
+typedef _Fract hq  __attribute__ ((mode (HQ)));
+typedef _Fract sq  __attribute__ ((mode (SQ)));
+typedef _Fract dq  __attribute__ ((mode (DQ)));
+typedef unsigned _Fract uqq  __attribute__ ((mode (UQQ)));
+typedef unsigned _Fract uhq  __attribute__ ((mode (UHQ)));
+typedef unsigned _Fract usq  __attribute__ ((mode (USQ)));
+typedef unsigned _Fract udq  __attribute__ ((mode (UDQ)));
+typedef _Sat _Fract Sqq  __attribute__ ((mode (QQ)));
+typedef _Sat _Fract Shq  __attribute__ ((mode (HQ)));
+typedef _Sat _Fract Ssq  __attribute__ ((mode (SQ)));
+typedef _Sat _Fract Sdq  __attribute__ ((mode (DQ)));
+typedef _Sat unsigned _Fract Suqq  __attribute__ ((mode (UQQ)));
+typedef _Sat unsigned _Fract Suhq  __attribute__ ((mode (UHQ)));
+typedef _Sat unsigned _Fract Susq  __attribute__ ((mode (USQ)));
+typedef _Sat unsigned _Fract Sudq  __attribute__ ((mode (UDQ)));
+typedef _Accum ha  __attribute__ ((mode (HA)));
+typedef _Accum sa  __attribute__ ((mode (SA)));
+typedef _Accum da  __attribute__ ((mode (DA)));
+typedef unsigned _Accum uha  __attribute__ ((mode (UHA)));
+typedef unsigned _Accum usa  __attribute__ ((mode (USA)));
+typedef unsigned _Accum uda  __attribute__ ((mode (UDA)));
+typedef _Sat _Accum Sha  __attribute__ ((mode (HA)));
+typedef _Sat _Accum Ssa  __attribute__ ((mode (SA)));
+typedef _Sat _Accum Sda  __attribute__ ((mode (DA)));
+typedef _Sat unsigned _Accum Suha  __attribute__ ((mode (UHA)));
+typedef _Sat unsigned _Accum Susa  __attribute__ ((mode (USA)));
+typedef _Sat unsigned _Accum Suda  __attribute__ ((mode (UDA)));
+
+/* Not all platforms support TQ, UTQ, TA, UTA modes.  */
+#if defined(__LP64__) && !defined(__hppa__)
+typedef _Fract tq  __attribute__ ((mode (TQ)));
+typedef unsigned _Fract utq  __attribute__ ((mode (UTQ)));
+typedef _Sat _Fract Stq  __attribute__ ((mode (TQ)));
+typedef _Sat unsigned _Fract Sutq  __attribute__ ((mode (UTQ)));
+typedef _Accum ta  __attribute__ ((mode (TA)));
+typedef unsigned _Accum uta  __attribute__ ((mode (UTA)));
+typedef _Sat _Accum Sta  __attribute__ ((mode (TA)));
+typedef _Sat unsigned _Accum Suta  __attribute__ ((mode (UTA)));
+
+int tqsize[sizeof (tq) == 16 ? 1 : -1];
+int utqsize[sizeof (utq) == 16 ? 1 : -1];
+int Stqsize[sizeof (Stq) == 16 ? 1 : -1];
+int Sutqsize[sizeof (Sutq) == 16 ? 1 : -1];
+int tasize[sizeof (ta) == 16 ? 1 : -1];
+int utasize[sizeof (uta) == 16 ? 1 : -1];
+int Stasize[sizeof (Sta) == 16 ? 1 : -1];
+int Sutasize[sizeof (Suta) == 16 ? 1 : -1];
+
+int tqalign = __alignof (tq);
+int utqalign = __alignof (utq);
+int Stqalign = __alignof (Stq);
+int Sutqalign = __alignof (Sutq);
+int taalign = __alignof (ta);
+int utaalign = __alignof (uta);
+int Staalign = __alignof (Sta);
+int Sutaalign = __alignof (Suta);
+#endif
+
+int qqsize[sizeof (qq) == 1 ? 1 : -1];
+int hqsize[sizeof (hq) == 2 ? 1 : -1];
+int sqsize[sizeof (sq) == 4 ? 1 : -1];
+int dqsize[sizeof (dq) == 8 ? 1 : -1];
+int uqqsize[sizeof (qq) == 1 ? 1 : -1];
+int uhqsize[sizeof (hq) == 2 ? 1 : -1];
+int usqsize[sizeof (sq) == 4 ? 1 : -1];
+int udqsize[sizeof (dq) == 8 ? 1 : -1];
+int Sqqsize[sizeof (Sqq) == 1 ? 1 : -1];
+int Shqsize[sizeof (Shq) == 2 ? 1 : -1];
+int Ssqsize[sizeof (Ssq) == 4 ? 1 : -1];
+int Sdqsize[sizeof (Sdq) == 8 ? 1 : -1];
+int Suqqsize[sizeof (Sqq) == 1 ? 1 : -1];
+int Suhqsize[sizeof (Shq) == 2 ? 1 : -1];
+int Susqsize[sizeof (Ssq) == 4 ? 1 : -1];
+int Sudqsize[sizeof (Sdq) == 8 ? 1 : -1];
+int hasize[sizeof (ha) == 2 ? 1 : -1];
+int sasize[sizeof (sa) == 4 ? 1 : -1];
+int dasize[sizeof (da) == 8 ? 1 : -1];
+int uhasize[sizeof (uha) == 2 ? 1 : -1];
+int usasize[sizeof (usa) == 4 ? 1 : -1];
+int udasize[sizeof (uda) == 8 ? 1 : -1];
+int Shasize[sizeof (Sha) == 2 ? 1 : -1];
+int Ssasize[sizeof (Ssa) == 4 ? 1 : -1];
+int Sdasize[sizeof (Sda) == 8 ? 1 : -1];
+int Suhasize[sizeof (Suha) == 2 ? 1 : -1];
+int Susasize[sizeof (Susa) == 4 ? 1 : -1];
+int Sudasize[sizeof (Suda) == 8 ? 1 : -1];
+
+int qqalign = __alignof (qq);
+int hqalign = __alignof (hq);
+int sqalign = __alignof (sq);
+int dqalign = __alignof (dq);
+int uqqalign = __alignof (uqq);
+int uhqalign = __alignof (uhq);
+int usqalign = __alignof (usq);
+int udqalign = __alignof (udq);
+int Sqqalign = __alignof (Sqq);
+int Shqalign = __alignof (Shq);
+int Ssqalign = __alignof (Ssq);
+int Sdqalign = __alignof (Sdq);
+int Suqqalign = __alignof (Suqq);
+int Suhqalign = __alignof (Suhq);
+int Susqalign = __alignof (Susq);
+int Sudqalign = __alignof (Sudq);
+int haalign = __alignof (ha);
+int saalign = __alignof (sa);
+int daalign = __alignof (da);
+int uhaalign = __alignof (uha);
+int usaalign = __alignof (usa);
+int udaalign = __alignof (uda);
+int Shaalign = __alignof (Sha);
+int Ssaalign = __alignof (Ssa);
+int Sdaalign = __alignof (Sda);
+int Suhaalign = __alignof (Suha);
+int Susaalign = __alignof (Susa);
+int Sudaalign = __alignof (Suda);
diff --git a/gcc/testsuite/gcc.dg/fixed-point/muldiv-warning.c b/gcc/testsuite/gcc.dg/fixed-point/muldiv-warning.c
new file mode 100644 (file)
index 0000000..4ac5531
--- /dev/null
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* Check if GCC generates warnings when overflows for mul and div.  */
+
+short _Fract sf0 = __SFRACT_MIN__ * __SFRACT_MIN__; /* { dg-warning "overflow" } */
+_Fract f0 = __FRACT_MIN__ * __FRACT_MIN__; /* { dg-warning "overflow" } */
+long _Fract lf0 = __LFRACT_MIN__ * __LFRACT_MIN__; /* { dg-warning "overflow" } */
+long long _Fract llf0 = __LLFRACT_MIN__ * __LLFRACT_MIN__; /* { dg-warning "overflow" } */
+short _Fract sf1 = __SFRACT_MAX__ * __SFRACT_MIN__;
+_Fract f1 = __FRACT_MAX__ * __FRACT_MIN__;
+long _Fract lf1 = __LFRACT_MAX__ * __LFRACT_MIN__;
+long long _Fract llf1 = __LLFRACT_MAX__ * __LLFRACT_MIN__;
+short _Fract sf2 = __SFRACT_MIN__ / __SFRACT_MIN__; /* { dg-warning "overflow" } */
+_Fract f2 = __FRACT_MIN__ / __FRACT_MIN__; /* { dg-warning "overflow" } */
+long _Fract lf2 = __LFRACT_MIN__ / __LFRACT_MIN__; /* { dg-warning "overflow" } */
+long long _Fract llf2 = __LLFRACT_MIN__ / __LLFRACT_MIN__; /* { dg-warning "overflow" } */
+short _Fract sf3 = __SFRACT_MAX__ / __SFRACT_MIN__;
+_Fract f3 = __FRACT_MAX__ / __FRACT_MIN__;
+long _Fract lf3 = __LFRACT_MAX__ / __LFRACT_MIN__;
+long long _Fract llf3 = __LLFRACT_MAX__ / __LLFRACT_MIN__;
+
+unsigned short _Fract usf0 = __USFRACT_MIN__ * __USFRACT_MIN__;
+unsigned _Fract uf0 = __UFRACT_MIN__ * __UFRACT_MIN__;
+unsigned long _Fract ulf0 = __ULFRACT_MIN__ * __ULFRACT_MIN__;
+unsigned long long _Fract ullf0 = __ULLFRACT_MIN__ * __ULLFRACT_MIN__;
+unsigned short _Fract usf1 = __USFRACT_MAX__ * __USFRACT_MIN__;
+unsigned _Fract uf1 = __UFRACT_MAX__ * __UFRACT_MIN__;
+unsigned long _Fract ulf1 = __ULFRACT_MAX__ * __ULFRACT_MIN__;
+unsigned long long _Fract ullf1 = __ULLFRACT_MAX__ * __ULLFRACT_MIN__;
+unsigned short _Fract usf2 = __USFRACT_MAX__ / __USFRACT_MAX__; /* { dg-warning "overflow" } */
+unsigned _Fract uf2 = __UFRACT_MAX__ / __UFRACT_MAX__; /* { dg-warning "overflow" } */
+unsigned long _Fract ulf2 = __ULFRACT_MAX__ / __ULFRACT_MAX__; /* { dg-warning "overflow" } */
+unsigned long long _Fract ullf2 = __ULLFRACT_MAX__ / __ULLFRACT_MAX__; /* { dg-warning "overflow" } */
+unsigned short _Fract usf3 = __USFRACT_MIN__ / __USFRACT_MAX__;
+unsigned _Fract uf3 = __UFRACT_MIN__ / __UFRACT_MAX__;
+unsigned long _Fract ulf3 = __ULFRACT_MIN__ / __ULFRACT_MAX__;
+unsigned long long _Fract ullf3 = __ULLFRACT_MIN__ / __ULLFRACT_MAX__;
+
+short _Accum sa0 = __SACCUM_MIN__ * __SACCUM_MIN__; /* { dg-warning "overflow" } */
+_Accum a0 = __ACCUM_MIN__ * __ACCUM_MIN__; /* { dg-warning "overflow" } */
+long _Accum la0 = __LACCUM_MIN__ * __LACCUM_MIN__; /* { dg-warning "overflow" } */
+long long _Accum lla0 = __LLACCUM_MIN__ * __LLACCUM_MIN__; /* { dg-warning "overflow" } */
+short _Accum sa1 = __SACCUM_MAX__ * 0.1hk;
+_Accum a1 = __ACCUM_MAX__ * 0.1k;
+long _Accum la1 = __LACCUM_MAX__ * 0.1lk;
+long long _Accum lla1 = __LLACCUM_MAX__ * 0.1llk;
+short _Accum sa2 = __SACCUM_MIN__ / 0.1hk; /* { dg-warning "overflow" } */
+_Accum a2 = __ACCUM_MIN__ / 0.1k; /* { dg-warning "overflow" } */
+long _Accum la2 = __LACCUM_MIN__ / 0.1lk; /* { dg-warning "overflow" } */
+long long _Accum lla2 = __LLACCUM_MIN__ / 0.1llk; /* { dg-warning "overflow" } */
+short _Accum sa3 = __SACCUM_MAX__ / __SACCUM_MIN__;
+_Accum a3 = __ACCUM_MAX__ / __ACCUM_MIN__;
+long _Accum la3 = __LACCUM_MAX__ / __LACCUM_MIN__;
+long long _Accum lla3 = __LLACCUM_MAX__ / __LLACCUM_MIN__;
+
+unsigned short _Accum usa0 = __USACCUM_MIN__ * __USACCUM_MIN__;
+unsigned _Accum ua0 = __UACCUM_MIN__ * __UACCUM_MIN__;
+unsigned long _Accum ula0 = __ULACCUM_MIN__ * __ULACCUM_MIN__;
+unsigned long long _Accum ulla0 = __ULLACCUM_MIN__ * __ULLACCUM_MIN__;
+unsigned short _Accum usa1 = __USACCUM_MAX__ * __USACCUM_MAX__; /* { dg-warning "overflow" } */
+unsigned _Accum ua1 = __UACCUM_MAX__ * __UACCUM_MAX__; /* { dg-warning "overflow" } */
+unsigned long _Accum ula1 = __ULACCUM_MAX__ * __ULACCUM_MAX__; /* { dg-warning "overflow" } */
+unsigned long long _Accum ulla1 = __ULLACCUM_MAX__ * __ULLACCUM_MAX__; /* { dg-warning "overflow" } */
+unsigned short _Accum usa2 = __USACCUM_MAX__ / 0.5hk; /* { dg-warning "overflow" } */
+unsigned _Accum ua2 = __UACCUM_MAX__ / 0.5k; /* { dg-warning "overflow" } */
+unsigned long _Accum ula2 = __ULACCUM_MAX__ / 0.5lk; /* { dg-warning "overflow" } */
+unsigned long long _Accum ulla2 = __ULLACCUM_MAX__ / 0.5llk; /* { dg-warning "overflow" } */
+unsigned short _Accum usa3 = __USACCUM_MIN__ / __USACCUM_MAX__;
+unsigned _Accum ua3 = __UACCUM_MIN__ / __UACCUM_MAX__;
+unsigned long _Accum ula3 = __ULACCUM_MIN__ / __ULACCUM_MAX__;
+unsigned long long _Accum ulla3 = __ULLACCUM_MIN__ / __ULLACCUM_MAX__;
diff --git a/gcc/testsuite/gcc.dg/fixed-point/noassoc.c b/gcc/testsuite/gcc.dg/fixed-point/noassoc.c
new file mode 100644 (file)
index 0000000..5d134e1
--- /dev/null
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -O0" } */
+
+extern void abort (void);
+
+/* Make sure GCC knows there is no associativity for saturating types.  */
+
+/* Don't transform to (temp + (0.5r + 0.8r))  */
+_Sat _Fract add_test (_Sat _Fract temp)
+{
+  return temp + 0.5r + 0.8r;
+}
+
+/* Don't transform to (temp * ((-0.5r - 0.5r) * (-0.5r - 0.5r)))  */
+_Sat _Fract mul_test (_Sat _Fract temp)
+{
+  return temp * (-0.5r - 0.5r) * (-0.5r - 0.5r);
+}
+
+/* Don't transform to ((temp1 + temp2) * 0.5r)  */
+_Sat _Fract mul_add_test (_Sat _Fract temp1, _Sat _Fract temp2)
+{
+  return temp1 * 0.5r + temp2 * 0.5r;
+}
+
+/* Don't transform to ((temp1 - temp2) * 0.5r)  */
+_Sat _Fract mul_sub_test (_Sat _Fract temp1, _Sat _Fract temp2)
+{
+  return temp1 * 0.5r - temp2 * 0.5r;
+}
+
+int main ()
+{
+  _Sat _Fract a;
+
+  a = add_test (-0.5r);
+  if (a != 0.8r)
+    abort ();
+
+  a = mul_test (0.1r);
+  if (a != 0.1r)
+    abort ();
+
+  a = mul_add_test (0.75r, 0.5r);
+  if (a != 0.625r)
+    abort ();
+
+  a = mul_sub_test (0.75r, -0.5r);
+  if (a != 0.625r)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/operator-bitwise.c b/gcc/testsuite/gcc.dg/fixed-point/operator-bitwise.c
new file mode 100644 (file)
index 0000000..31aecf5
--- /dev/null
@@ -0,0 +1,167 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* 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 fixed-point operands.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+#define OPERATE(OPRD1,OPRT,OPRD2)              \
+do                                             \
+{                                              \
+  OPRD1 OPRT OPRD2;                            \
+} while (0)
+
+
+
+#define 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_fixed_point()
+{
+  short _Fract sf;
+  _Fract f;
+  long _Fract lf;
+  long long _Fract llf;
+  unsigned short _Fract usf;
+  unsigned _Fract uf;
+  unsigned long _Fract ulf;
+  unsigned long long _Fract ullf;
+  _Sat short _Fract Ssf;
+  _Sat _Fract Sf;
+  _Sat long _Fract Slf;
+  _Sat long long _Fract Sllf;
+  _Sat unsigned short _Fract Susf;
+  _Sat unsigned _Fract Suf;
+  _Sat unsigned long _Fract Sulf;
+  _Sat unsigned long long _Fract Sullf;
+  short _Accum sa;
+  _Accum a;
+  long _Accum la;
+  long long _Accum lla;
+  unsigned short _Accum usa;
+  unsigned _Accum ua;
+  unsigned long _Accum ula;
+  unsigned long long _Accum ulla;
+  _Sat short _Accum Ssa;
+  _Sat _Accum Sa;
+  _Sat long _Accum Sla;
+  _Sat long long _Accum Slla;
+  _Sat unsigned short _Accum Susa;
+  _Sat unsigned _Accum Sua;
+  _Sat unsigned long _Accum Sula;
+  _Sat unsigned long long _Accum Sulla;
+
+  /* C99 Section 6.5.{10,11,12} Bitwise operator.  Constraints: Each of
+   the operands shall have integer type.  Fixed-point type is rejected
+   by compiler when bitwise operation is performed.  */
+
+  BITWISE_OPERATOR(&,sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,f); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,f); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,f); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,lf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,lf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,lf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,llf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,llf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,llf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,usf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,usf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,usf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,uf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,uf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,uf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,ulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,ulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,ulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,ullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,ullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,ullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Ssf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Ssf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Ssf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Slf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Slf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Slf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sllf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sllf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sllf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Susf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Susf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Susf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Suf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Suf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Suf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sulf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sullf); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,a); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,a); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,a); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,la); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,la); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,la); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,lla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,lla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,lla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,usa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,usa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,usa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,ua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,ua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,ua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,ula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,ula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,ula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,ulla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,ulla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,ulla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Ssa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Ssa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Ssa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Slla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Slla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Slla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Susa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Susa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Susa); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sua); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sula); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(&,Sulla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(|,Sulla); /* { dg-error "invalid operands to binary" } */
+  BITWISE_OPERATOR(^,Sulla); /* { dg-error "invalid operands to binary" } */
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/operator-comma.c b/gcc/testsuite/gcc.dg/fixed-point/operator-comma.c
new file mode 100644 (file)
index 0000000..2f1316c
--- /dev/null
@@ -0,0 +1,98 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -O0" } */
+
+/* C99 6.5.17: Comma operator.
+   Test with fixed-point operands.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+#define FUNC(TYPE,NAME,PF) \
+volatile TYPE NAME ## a, NAME ## b, NAME ## c; \
+void \
+init_ ## NAME () \
+{ \
+  NAME ## b = 0.2 ## PF; \
+  NAME ## c = 0.3 ## PF; \
+}
+
+FUNC (short _Fract, sf, hr)
+FUNC (_Fract, f, r)
+FUNC (long _Fract, lf, lr)
+FUNC (long long _Fract, llf, llr)
+FUNC (unsigned short _Fract, usf, uhr)
+FUNC (unsigned _Fract, uf, ur)
+FUNC (unsigned long _Fract, ulf, ulr)
+FUNC (long long _Fract, ullf, ullr)
+FUNC (_Sat short _Fract, Ssf, hr)
+FUNC (_Sat _Fract, Sf, r)
+FUNC (_Sat long _Fract, Slf, lr)
+FUNC (_Sat long long _Fract, Sllf, llr)
+FUNC (_Sat unsigned short _Fract, Susf, uhr)
+FUNC (_Sat unsigned _Fract, Suf, ur)
+FUNC (_Sat unsigned long _Fract, Sulf, ulr)
+FUNC (_Sat long long _Fract, Sullf, ullr)
+FUNC (short _Accum, sa, hk)
+FUNC (_Accum, a, k)
+FUNC (long _Accum, la, lk)
+FUNC (long long _Accum, lla, llk)
+FUNC (unsigned short _Accum, usa, uhk)
+FUNC (unsigned _Accum, ua, uk)
+FUNC (unsigned long _Accum, ula, ulk)
+FUNC (long long _Accum, ulla, ullk)
+FUNC (_Sat short _Accum, Ssa, hk)
+FUNC (_Sat _Accum, Sa, k)
+FUNC (_Sat long _Accum, Sla, lk)
+FUNC (_Sat long long _Accum, Slla, llk)
+FUNC (_Sat unsigned short _Accum, Susa, uhk)
+FUNC (_Sat unsigned _Accum, Sua, uk)
+FUNC (_Sat unsigned long _Accum, Sula, ulk)
+FUNC (_Sat long long _Accum, Sulla, ullk)
+
+int
+main ()
+{
+#define TEST(NAME) \
+  init_ ## NAME (); \
+  NAME ## a = (NAME ## b, NAME ## c); \
+  if (NAME ## a != NAME ## c) \
+    abort (); \
+  NAME ## a = (NAME ## c, 123, NAME ## b); \
+  if (NAME ## a != NAME ## b) \
+    abort ();
+
+  TEST(sf)
+  TEST(f)
+  TEST(lf)
+  TEST(llf)
+  TEST(usf)
+  TEST(uf)
+  TEST(ulf)
+  TEST(ullf)
+  TEST(Ssf)
+  TEST(Sf)
+  TEST(Slf)
+  TEST(Sllf)
+  TEST(Susf)
+  TEST(Suf)
+  TEST(Sulf)
+  TEST(Sullf)
+  TEST(sa)
+  TEST(a)
+  TEST(la)
+  TEST(lla)
+  TEST(usa)
+  TEST(ua)
+  TEST(ula)
+  TEST(ulla)
+  TEST(Ssa)
+  TEST(Sa)
+  TEST(Sla)
+  TEST(Slla)
+  TEST(Susa)
+  TEST(Sua)
+  TEST(Sula)
+  TEST(Sulla)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/operator-cond.c b/gcc/testsuite/gcc.dg/fixed-point/operator-cond.c
new file mode 100644 (file)
index 0000000..94b0de0
--- /dev/null
@@ -0,0 +1,101 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -O0" } */
+
+/* C99 6.5.15 Conditional operator.
+   Test with fixed-point operands.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+volatile int yes, no;
+
+#define FUNC(TYPE,NAME,PF) \
+volatile TYPE NAME ## a, NAME ## b, NAME ## c; \
+void \
+init_ ## NAME () \
+{ \
+  NAME ## b = 0.2 ## PF; \
+  NAME ## c = 0.3 ## PF; \
+  yes = 1; \
+  no = 0; \
+}
+
+FUNC (short _Fract, sf, hr)
+FUNC (_Fract, f, r)
+FUNC (long _Fract, lf, lr)
+FUNC (long long _Fract, llf, llr)
+FUNC (unsigned short _Fract, usf, uhr)
+FUNC (unsigned _Fract, uf, ur)
+FUNC (unsigned long _Fract, ulf, ulr)
+FUNC (long long _Fract, ullf, ullr)
+FUNC (_Sat short _Fract, Ssf, hr)
+FUNC (_Sat _Fract, Sf, r)
+FUNC (_Sat long _Fract, Slf, lr)
+FUNC (_Sat long long _Fract, Sllf, llr)
+FUNC (_Sat unsigned short _Fract, Susf, uhr)
+FUNC (_Sat unsigned _Fract, Suf, ur)
+FUNC (_Sat unsigned long _Fract, Sulf, ulr)
+FUNC (_Sat long long _Fract, Sullf, ullr)
+FUNC (short _Accum, sa, hk)
+FUNC (_Accum, a, k)
+FUNC (long _Accum, la, lk)
+FUNC (long long _Accum, lla, llk)
+FUNC (unsigned short _Accum, usa, uhk)
+FUNC (unsigned _Accum, ua, uk)
+FUNC (unsigned long _Accum, ula, ulk)
+FUNC (long long _Accum, ulla, ullk)
+FUNC (_Sat short _Accum, Ssa, hk)
+FUNC (_Sat _Accum, Sa, k)
+FUNC (_Sat long _Accum, Sla, lk)
+FUNC (_Sat long long _Accum, Slla, llk)
+FUNC (_Sat unsigned short _Accum, Susa, uhk)
+FUNC (_Sat unsigned _Accum, Sua, uk)
+FUNC (_Sat unsigned long _Accum, Sula, ulk)
+FUNC (_Sat long long _Accum, Sulla, ullk)
+
+int
+main ()
+{
+#define TEST(NAME) \
+  init_ ## NAME (); \
+  NAME ## a = yes ? NAME ## b : NAME ## c; \
+  if (NAME ## a != NAME ## b) \
+    abort (); \
+  NAME ## a = no ? NAME ## b : NAME ## c; \
+  if (NAME ## a != NAME ## c) \
+    abort ();
+
+  TEST(sf)
+  TEST(f)
+  TEST(lf)
+  TEST(llf)
+  TEST(usf)
+  TEST(uf)
+  TEST(ulf)
+  TEST(ullf)
+  TEST(Ssf)
+  TEST(Sf)
+  TEST(Slf)
+  TEST(Sllf)
+  TEST(Susf)
+  TEST(Suf)
+  TEST(Sulf)
+  TEST(Sullf)
+  TEST(sa)
+  TEST(a)
+  TEST(la)
+  TEST(lla)
+  TEST(usa)
+  TEST(ua)
+  TEST(ula)
+  TEST(ulla)
+  TEST(Ssa)
+  TEST(Sa)
+  TEST(Sla)
+  TEST(Slla)
+  TEST(Susa)
+  TEST(Sua)
+  TEST(Sula)
+  TEST(Sulla)
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/operator-logical.c b/gcc/testsuite/gcc.dg/fixed-point/operator-logical.c
new file mode 100644 (file)
index 0000000..3873b25
--- /dev/null
@@ -0,0 +1,115 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 Logical AND operator.
+   C99 Logical OR operator.
+   Test with fixed-point operands.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+#define OPERATE(OPRD1,OPRT,OPRD2,RLT)  \
+do                                     \
+{                                      \
+  if (( (OPRD1) OPRT (OPRD2) )!= RLT)  \
+    abort ();                          \
+} while (0)
+
+#define FIXED_POINT_LOGICAL(OPRD)      \
+do                                     \
+{                                      \
+  OPRD = 0.1;                          \
+  OPERATE(1,||,OPRD,1);                        \
+  OPERATE(0,||,OPRD,1);                        \
+  OPERATE(OPRD,||,1,1);                        \
+  OPERATE(OPRD,||,0,1);                        \
+  OPRD = 0;                            \
+  OPERATE(1,||,OPRD,1);                        \
+  OPERATE(0,||,OPRD,0);                        \
+  OPERATE(OPRD,||,1,1);                        \
+  OPERATE(OPRD,||,0,0);                        \
+  OPRD = 0.1;                          \
+  OPERATE(1,&&,OPRD,1);                        \
+  OPERATE(0,&&,OPRD,0);                        \
+  OPERATE(OPRD,&&,1,1);                        \
+  OPERATE(OPRD,&&,0,0);                        \
+  OPRD = 0;                            \
+  OPERATE(1,&&,OPRD,0);                        \
+  OPERATE(0,&&,OPRD,0);                        \
+  OPERATE(OPRD,&&,1,0);                        \
+  OPERATE(OPRD,&&,0,0);                        \
+} while (0)
+
+int
+main ()
+{
+  short _Fract sf;
+  _Fract f;
+  long _Fract lf;
+  long long _Fract llf;
+  unsigned short _Fract usf;
+  unsigned _Fract uf;
+  unsigned long _Fract ulf;
+  unsigned long long _Fract ullf;
+  _Sat short _Fract Ssf;
+  _Sat _Fract Sf;
+  _Sat long _Fract Slf;
+  _Sat long long _Fract Sllf;
+  _Sat unsigned short _Fract Susf;
+  _Sat unsigned _Fract Suf;
+  _Sat unsigned long _Fract Sulf;
+  _Sat unsigned long long _Fract Sullf;
+  short _Accum sa;
+  _Accum a;
+  long _Accum la;
+  long long _Accum lla;
+  unsigned short _Accum usa;
+  unsigned _Accum ua;
+  unsigned long _Accum ula;
+  unsigned long long _Accum ulla;
+  _Sat short _Accum Ssa;
+  _Sat _Accum Sa;
+  _Sat long _Accum Sla;
+  _Sat long long _Accum Slla;
+  _Sat unsigned short _Accum Susa;
+  _Sat unsigned _Accum Sua;
+  _Sat unsigned long _Accum Sula;
+  _Sat unsigned long long _Accum Sulla;
+
+  /* C99 Section 6.5.{13,14} Logical operator.  Constraints Each of the
+     operands shall have scalar type.  Fixed-point types would obey this.  */
+  FIXED_POINT_LOGICAL (sf);
+  FIXED_POINT_LOGICAL (f);
+  FIXED_POINT_LOGICAL (lf);
+  FIXED_POINT_LOGICAL (llf);
+  FIXED_POINT_LOGICAL (usf);
+  FIXED_POINT_LOGICAL (uf);
+  FIXED_POINT_LOGICAL (ulf);
+  FIXED_POINT_LOGICAL (ullf);
+  FIXED_POINT_LOGICAL (Ssf);
+  FIXED_POINT_LOGICAL (Sf);
+  FIXED_POINT_LOGICAL (Slf);
+  FIXED_POINT_LOGICAL (Sllf);
+  FIXED_POINT_LOGICAL (Susf);
+  FIXED_POINT_LOGICAL (Suf);
+  FIXED_POINT_LOGICAL (Sulf);
+  FIXED_POINT_LOGICAL (Sullf);
+  FIXED_POINT_LOGICAL (sa);
+  FIXED_POINT_LOGICAL (a);
+  FIXED_POINT_LOGICAL (la);
+  FIXED_POINT_LOGICAL (lla);
+  FIXED_POINT_LOGICAL (usa);
+  FIXED_POINT_LOGICAL (ua);
+  FIXED_POINT_LOGICAL (ula);
+  FIXED_POINT_LOGICAL (ulla);
+  FIXED_POINT_LOGICAL (Ssa);
+  FIXED_POINT_LOGICAL (Sa);
+  FIXED_POINT_LOGICAL (Sla);
+  FIXED_POINT_LOGICAL (Slla);
+  FIXED_POINT_LOGICAL (Susa);
+  FIXED_POINT_LOGICAL (Sua);
+  FIXED_POINT_LOGICAL (Sula);
+  FIXED_POINT_LOGICAL (Sulla);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/operator-unary.c b/gcc/testsuite/gcc.dg/fixed-point/operator-unary.c
new file mode 100644 (file)
index 0000000..5ad420b
--- /dev/null
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.3 Unary operators & and *.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+#define UNARY_OPERATOR(TYPE,SUFFIX)    \
+do                                     \
+{                                      \
+ TYPE unary_d = 0.1 ## SUFFIX;         \
+ TYPE* unary_dp;                       \
+ /*  & operator.  */                   \
+ unary_dp = &(unary_d);                        \
+ /*  * operator.  */                   \
+ unary_d = *(unary_dp);                        \
+} while (0)
+
+int
+main ()
+{
+  /*  C99 6.5.3 Unary operators.  */
+  UNARY_OPERATOR(short _Fract, hr);
+  UNARY_OPERATOR(_Fract, r);
+  UNARY_OPERATOR(long _Fract, lr);
+  UNARY_OPERATOR(long long _Fract, llr);
+  UNARY_OPERATOR(unsigned short _Fract, uhr);
+  UNARY_OPERATOR(unsigned _Fract, ur);
+  UNARY_OPERATOR(unsigned long _Fract, ulr);
+  UNARY_OPERATOR(unsigned long long _Fract, ullr);
+  UNARY_OPERATOR(_Sat short _Fract, hr);
+  UNARY_OPERATOR(_Sat _Fract, r);
+  UNARY_OPERATOR(_Sat long _Fract, lr);
+  UNARY_OPERATOR(_Sat long long _Fract, llr);
+  UNARY_OPERATOR(_Sat unsigned short _Fract, uhr);
+  UNARY_OPERATOR(_Sat unsigned _Fract, ur);
+  UNARY_OPERATOR(_Sat unsigned long _Fract, ulr);
+  UNARY_OPERATOR(_Sat unsigned long long _Fract, ullr);
+  UNARY_OPERATOR(short _Accum, hk);
+  UNARY_OPERATOR(_Accum, k);
+  UNARY_OPERATOR(long _Accum, lk);
+  UNARY_OPERATOR(long long _Accum, llk);
+  UNARY_OPERATOR(unsigned short _Accum, uhk);
+  UNARY_OPERATOR(unsigned _Accum, uk);
+  UNARY_OPERATOR(unsigned long _Accum, ulk);
+  UNARY_OPERATOR(unsigned long long _Accum, ullk);
+  UNARY_OPERATOR(_Sat short _Accum, hk);
+  UNARY_OPERATOR(_Sat _Accum, k);
+  UNARY_OPERATOR(_Sat long _Accum, lk);
+  UNARY_OPERATOR(_Sat long long _Accum, llk);
+  UNARY_OPERATOR(_Sat unsigned short _Accum, uhk);
+  UNARY_OPERATOR(_Sat unsigned _Accum, uk);
+  UNARY_OPERATOR(_Sat unsigned long _Accum, ulk);
+  UNARY_OPERATOR(_Sat unsigned long long _Accum, ullk);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/struct-layout-1.c b/gcc/testsuite/gcc.dg/fixed-point/struct-layout-1.c
new file mode 100644 (file)
index 0000000..b9a02f0
--- /dev/null
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* This test is based on the test from ../dfp/.  */
+
+#include <stdarg.h>
+
+extern void abort (void);
+
+struct S1
+{
+  long _Fract a[0];
+};
+
+struct S2
+{
+  struct
+  {
+    long _Fract e;
+  } b[0];
+};
+
+struct S3
+{
+  union
+  {
+    long _Fract c;
+  } a[0];
+};
+
+struct S4
+{
+  int a[0];
+  long _Fract b[0];
+};
+
+struct S5
+{
+  union
+  {
+    long _Fract c[0];
+  } a;
+};
+
+int check_var (int z, ...)
+{
+  long long result;
+  va_list ap;
+  va_start (ap, z);
+  va_arg (ap, struct S1);
+  result = va_arg (ap, long long);
+  va_end (ap);
+
+  return (result == 2LL);
+}
+
+int main ()
+{
+  struct S1 s1;
+  struct S2 s2;
+  struct S3 s3;
+  struct S4 s4;
+  struct S5 s5;
+
+  if (check_var (2, s1, 2LL) == 0)
+    abort ();
+  if (check_var (2, s2, 2LL) == 0)
+    abort ();
+  if (check_var (2, s3, 2LL) == 0)
+    abort ();
+  if (check_var (2, s4, 2LL) == 0)
+    abort ();
+  if (check_var (2, s5, 2LL) == 0)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/struct-union.c b/gcc/testsuite/gcc.dg/fixed-point/struct-union.c
new file mode 100644 (file)
index 0000000..1147752
--- /dev/null
@@ -0,0 +1,63 @@
+/* { 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.
+   Based on the test from ../dfp/.  */
+
+struct s {_Fract f; const long _Fract lf;};
+struct sv { volatile _Fract f; volatile long _Fract lf; };
+union u
+{
+  const long _Fract lf;
+  _Fract f;
+  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.f = 0.1r; /* { dg-error "assignment of read-only variable" } */
+  cs.lf = 0.2lr; /* { dg-error "assignment of read-only variable" } */
+  s.lf = 0.3lr;  /* { dg-error "assignment of read-only member" } */
+
+  s.f = 0.4r;
+  u.f = 0.5r;
+
+  u.lf = 0.6lr;    /* { dg-error "assignment of read-only member" } */
+  u.cs.f = 0.7r; /* { dg-error "assignment of read-only member" } */
+  u.cs.lf = 0.8lr; /* { dg-error "assignment of read-only member" } */
+
+  cu.f = 0.9r;   /* { dg-error "assignment of read-only variable" } */
+
+  cu.lf = 0.01lr;    /* { dg-error "assignment of read-only variable" } */
+  cu.cs.f = 0.02r; /* { dg-error "assignment of read-only variable" } */
+  cu.cs.lf = 0.03lr; /* { dg-error "assignment of read-only variable" } */
+
+  /* f().x is a valid postfix expression but is not an lvalue if
+     function f() returning a structure or union.  */
+  g(s).f = 0.04r;  /* { dg-error "lvalue required" } */
+  h(u).lf = 0.05lr;  /* { dg-error "lvalue required" } */
+
+  /* Test assignment to volatile structure members.  */
+  sv.f = 0.06r;
+  sv.lf = 0.07lr;
+}
+
diff --git a/gcc/testsuite/gcc.dg/fixed-point/types.c b/gcc/testsuite/gcc.dg/fixed-point/types.c
new file mode 100644 (file)
index 0000000..011345c
--- /dev/null
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1169 6.3.1.3a - Fixed-point types (NEW CLAUSE).
+
+   Check if all types are ok.  */
+
+short _Fract q0;
+_Fract q1;
+long _Fract q2;
+long long _Fract q3;
+unsigned short _Fract q4;
+unsigned _Fract q5;
+unsigned long _Fract q6;
+unsigned long long _Fract q7;
+_Sat short _Fract sq0;
+_Sat _Fract sq1;
+_Sat long _Fract sq2;
+_Sat long long _Fract sq3;
+_Sat unsigned short _Fract sq4;
+_Sat unsigned _Fract sq5;
+_Sat unsigned long _Fract sq6;
+_Sat unsigned long long _Fract sq7;
+
+short _Accum a0;
+_Accum a1;
+long _Accum a2;
+long long _Accum a3;
+unsigned short _Accum a4;
+unsigned _Accum a5;
+unsigned long _Accum a6;
+unsigned long long _Accum a7;
+_Sat short _Accum sa0;
+_Sat _Accum sa1;
+_Sat long _Accum sa2;
+_Sat long long _Accum sa3;
+_Sat unsigned short _Accum sa4;
+_Sat unsigned _Accum sa5;
+_Sat unsigned long _Accum sa6;
+_Sat unsigned long long _Accum sa7;
diff --git a/gcc/testsuite/gcc.dg/fixed-point/typespec.c b/gcc/testsuite/gcc.dg/fixed-point/typespec.c
new file mode 100644 (file)
index 0000000..9eaa29f
--- /dev/null
@@ -0,0 +1,303 @@
+/* Test for valid and invalid combinations of type specifiers.
+   Based off gcc.dg/test-spec-1.c */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+typedef char type;
+
+void _Fract *x0;  /* { dg-error "" "void _Fract" } */
+char _Fract *x3;  /* { dg-error "" "char _Fract" } */
+short _Fract *x6;
+int _Fract *x9;   /* { dg-error "" "int _Fract" } */
+long _Fract *x12;
+float _Fract *x15;   /* { dg-error "" "float _Fract" } */
+double _Fract *x18;   /* { dg-error "" "double _Fract" } */
+signed _Fract *x21;
+_Bool _Fract *x24;   /* { dg-error "" "_Bool _Fract" } */
+int _Fract *x27;    /* { dg-error "" "int _Fract" } */
+type _Fract *x30;   /* { dg-error "" "type _Fract" } */
+char signed _Fract *x33;  /* { dg-error "" "char signed _Fract" } */
+char unsigned _Fract *x36; /* { dg-error "" "char unsigned _Fract" } */
+short _Fract *x39;
+short signed _Fract *x42;
+short unsigned _Fract *x45;
+_Fract short*x48;
+_Fract short signed*x51;
+_Fract short unsigned*x54;
+_Fract long*x57;
+_Fract long signed*x60;
+_Fract long unsigned*x63;
+_Fract signed long*x66;
+_Fract signed short*x69;
+int signed _Fract *x72;  /* { dg-error "" "int signed _Fract" } */
+int unsigned _Fract *x75;  /* { dg-error "" "int unsigned _Fract" } */
+long int _Fract *x78;  /* { dg-error "" "long int _Fract" } */
+long long _Fract *x81;
+long double _Fract *x84;  /* { dg-error "" "long double _Fract" } */
+long signed _Fract *x87;
+long unsigned _Fract *x90;
+double long _Fract *x93;  /* { dg-error "" "double long _Fract" } */
+signed char _Fract *x96;   /* { dg-error "" "signed char _Fract" } */
+signed short _Fract *x99;
+signed int _Fract *x102;  /* { dg-error "" "signed int _Fract" } */
+signed long _Fract *x105;
+unsigned char _Fract *x108; /* { dg-error "" "unsigned char _Fract" } */
+unsigned short _Fract *x111;
+unsigned int _Fract *x114; /* { dg-error "" "unsigned int _Fract" } */
+unsigned long _Fract *x117;
+short int signed _Fract *x120; /* { dg-error "" "short int signed _Fract" } */
+short int unsigned _Fract *x123; /* { dg-error "" "short int unsigned _Fract" } */
+short signed int _Fract *x126; /* { dg-error "" "short signed int _Fract" } */
+short unsigned int _Fract *x129; /* { dg-error "" "short unsigned int _Fract" } */
+int short signed _Fract *x132; /* { dg-error "" "int short signed _Fract" } */
+int short unsigned _Fract *x135; /* { dg-error "" "int short unsigned _Fract" } */
+int long long _Fract *x138; /* { dg-error "" "int long long _Fract" } */
+int long signed _Fract *x141; /* { dg-error "" "int long signed _Fract" } */
+int long unsigned _Fract *x144; /* { dg-error "" "int long unsigned _Fract" } */
+int signed short _Fract *x147; /* { dg-error "" "int signed short _Fract" } */
+int signed long _Fract *x150; /* { dg-error "" "int signed long _Fract" } */
+int unsigned short _Fract *x153; /* { dg-error "" "int unsigned short _Fract" } */
+int unsigned long _Fract *x156; /* { dg-error "" "int unsigned long _Fract" } */
+long int long _Fract *x159; /* { dg-error "" "long int long _Fract" } */
+long int signed _Fract *x162; /* { dg-error "" "long int signed _Fract" } */
+long int unsigned _Fract *x165; /* { dg-error "" "long int unsigned _Fract" } */
+long long int _Fract *x168; /* { dg-error "" "long long int _Fract" } */
+long long signed _Fract *x171;
+long long unsigned _Fract *x175;
+long signed int _Fract *x178; /* { dg-error "" "long signed int _Fract" } */
+long unsigned int _Fract *x181; /* { dg-error "" "long unsigned int _Fract" } */
+long unsigned long _Fract *x184;
+signed short int _Fract *x187; /* { dg-error "" "signed short int _Fract" } */
+signed int short _Fract *x190; /* { dg-error "" "signed int short _Fract" } */
+signed int long _Fract *x192; /* { dg-error "" "signed int long _Fract" } */
+signed long int _Fract *x195; /* { dg-error "" "signed long int _Fract" } */
+signed long long _Fract *x198;
+unsigned short int _Fract *x201; /* { dg-error "" "unsigned short int _Fract" } */
+unsigned int short _Fract *x204; /* { dg-error "" "unsigned int short _Fract" } */
+unsigned int long _Fract *x207; /* { dg-error "" "unsigned int long _Fract" } */
+unsigned long int _Fract *x210; /* { dg-error "" "unsigned long int _Fract" } */
+unsigned long long _Fract *x213;
+int long long signed _Fract *x216; /* { dg-error "" "int long long signed _Fract" } */
+int long long unsigned _Fract *x219; /* { dg-error "" "int long long unsigned _Fract" } */
+int long signed long _Fract *x222; /* { dg-error "" "int long signed long _Fract" } */
+int long unsigned long _Fract *x226; /* { dg-error "" "int long unsigned long _Fract" } */
+int signed long long _Fract *x229; /* { dg-error "" "int signed long long _Fract" } */
+int unsigned long long _Fract *x232; /* { dg-error "" "int unsigned long long _Fract" } */
+long int long signed _Fract *x235; /* { dg-error "" "long int long signed _Fract" } */
+long int long unsigned _Fract *x238; /* { dg-error "" "long int long unsigned _Fract" } */
+long int signed long _Fract *x241; /* { dg-error "" "long int signed long _Fract" } */
+long int unsigned long _Fract *x244; /* { dg-error "" "long int unsigned long _Fract" } */
+long long int signed _Fract *x247; /* { dg-error "" "long long int signed _Fract" } */
+long long int unsigned _Fract *x250; /* { dg-error "" "long long int unsigned _Fract" } */
+long long signed int _Fract *x253; /* { dg-error "" "long long signed int _Fract" } */
+long long unsigned int _Fract *x256; /* { dg-error "" "long long unsigned int _Fract" } */
+long signed int long _Fract *x259; /* { dg-error "" "long signed int long _Fract" } */
+long signed long int _Fract *x262; /* { dg-error "" "long signed long int _Fract" } */
+long unsigned int long _Fract *x265; /* { dg-error "" "long unsigned int long _Fract" } */
+long unsigned long int _Fract *x268; /* { dg-error "" "long unsigned long int _Fract" } */
+signed long long int _Fract *x271; /* { dg-error "" "signed long long int _Fract" } */
+unsigned int long long _Fract *x274; /* { dg-error "" "unsigned int long long _Fract" } */
+unsigned long int long _Fract *x277; /* { dg-error "" "unsigned long int long _Fract" } */
+unsigned long long int _Fract *x280; /* { dg-error "" "unsigned long long int _Fract" } */
+_Complex _Fract *x283; /* { dg-error "" "_Complex _Fract" } */
+_Fract _Complex *x286; /* { dg-error "" "_Fract _Complex" } */
+unsigned _Fract *x289;
+signed _Fract *x292;
+
+void _Accum *k0;  /* { dg-error "" "void _Accum" } */
+char _Accum *k3;  /* { dg-error "" "char _Accum" } */
+short _Accum *k6;
+int _Accum *k9;   /* { dg-error "" "int _Accum" } */
+long _Accum *k12;
+float _Accum *k15;   /* { dg-error "" "float _Accum" } */
+double _Accum *k18;   /* { dg-error "" "double _Accum" } */
+signed _Accum *k21;
+_Bool _Accum *k24;   /* { dg-error "" "_Bool _Accum" } */
+int _Accum *k27;    /* { dg-error "" "int _Accum" } */
+type _Accum *k30;   /* { dg-error "" "type _Accum" } */
+char signed _Accum *k33;  /* { dg-error "" "char signed _Accum" } */
+char unsigned _Accum *k36; /* { dg-error "" "char unsigned _Accum" } */
+short _Accum *k39;
+short signed _Accum *k42;
+short unsigned _Accum *k45;
+_Accum short*k48;
+_Accum short signed*k51;
+_Accum short unsigned*k54;
+_Accum long*k57;
+_Accum long signed*k60;
+_Accum long unsigned*k63;
+_Accum signed long*k66;
+_Accum signed short*k69;
+int signed _Accum *k72;  /* { dg-error "" "int signed _Accum" } */
+int unsigned _Accum *k75;  /* { dg-error "" "int unsigned _Accum" } */
+long int _Accum *k78;  /* { dg-error "" "long int _Accum" } */
+long long _Accum *k81;
+long double _Accum *k84;  /* { dg-error "" "long double _Accum" } */
+long signed _Accum *k87;
+long unsigned _Accum *k90;
+double long _Accum *k93;  /* { dg-error "" "double long _Accum" } */
+signed char _Accum *k96;   /* { dg-error "" "signed char _Accum" } */
+signed short _Accum *k99;
+signed int _Accum *k102;  /* { dg-error "" "signed int _Accum" } */
+signed long _Accum *k105;
+unsigned char _Accum *k108; /* { dg-error "" "unsigned char _Accum" } */
+unsigned short _Accum *k111;
+unsigned int _Accum *k114; /* { dg-error "" "unsigned int _Accum" } */
+unsigned long _Accum *k117;
+short int signed _Accum *k120; /* { dg-error "" "short int signed _Accum" } */
+short int unsigned _Accum *k123; /* { dg-error "" "short int unsigned _Accum" } */
+short signed int _Accum *k126; /* { dg-error "" "short signed int _Accum" } */
+short unsigned int _Accum *k129; /* { dg-error "" "short unsigned int _Accum" } */
+int short signed _Accum *k132; /* { dg-error "" "int short signed _Accum" } */
+int short unsigned _Accum *k135; /* { dg-error "" "int short unsigned _Accum" } */
+int long long _Accum *k138; /* { dg-error "" "int long long _Accum" } */
+int long signed _Accum *k141; /* { dg-error "" "int long signed _Accum" } */
+int long unsigned _Accum *k144; /* { dg-error "" "int long unsigned _Accum" } */
+int signed short _Accum *k147; /* { dg-error "" "int signed short _Accum" } */
+int signed long _Accum *k150; /* { dg-error "" "int signed long _Accum" } */
+int unsigned short _Accum *k153; /* { dg-error "" "int unsigned short _Accum" } */
+int unsigned long _Accum *k156; /* { dg-error "" "int unsigned long _Accum" } */
+long int long _Accum *k159; /* { dg-error "" "long int long _Accum" } */
+long int signed _Accum *k162; /* { dg-error "" "long int signed _Accum" } */
+long int unsigned _Accum *k165; /* { dg-error "" "long int unsigned _Accum" } */
+long long int _Accum *k168; /* { dg-error "" "long long int _Accum" } */
+long long signed _Accum *k171;
+long long unsigned _Accum *k175;
+long signed int _Accum *k178; /* { dg-error "" "long signed int _Accum" } */
+long unsigned int _Accum *k181; /* { dg-error "" "long unsigned int _Accum" } */
+long unsigned long _Accum *k184;
+signed short int _Accum *k187; /* { dg-error "" "signed short int _Accum" } */
+signed int short _Accum *k190; /* { dg-error "" "signed int short _Accum" } */
+signed int long _Accum *k192; /* { dg-error "" "signed int long _Accum" } */
+signed long int _Accum *k195; /* { dg-error "" "signed long int _Accum" } */
+signed long long _Accum *k198;
+unsigned short int _Accum *k201; /* { dg-error "" "unsigned short int _Accum" } */
+unsigned int short _Accum *k204; /* { dg-error "" "unsigned int short _Accum" } */
+unsigned int long _Accum *k207; /* { dg-error "" "unsigned int long _Accum" } */
+unsigned long int _Accum *k210; /* { dg-error "" "unsigned long int _Accum" } */
+unsigned long long _Accum *k213;
+int long long signed _Accum *k216; /* { dg-error "" "int long long signed _Accum" } */
+int long long unsigned _Accum *k219; /* { dg-error "" "int long long unsigned _Accum" } */
+int long signed long _Accum *k222; /* { dg-error "" "int long signed long _Accum" } */
+int long unsigned long _Accum *k226; /* { dg-error "" "int long unsigned long _Accum" } */
+int signed long long _Accum *k229; /* { dg-error "" "int signed long long _Accum" } */
+int unsigned long long _Accum *k232; /* { dg-error "" "int unsigned long long _Accum" } */
+long int long signed _Accum *k235; /* { dg-error "" "long int long signed _Accum" } */
+long int long unsigned _Accum *k238; /* { dg-error "" "long int long unsigned _Accum" } */
+long int signed long _Accum *k241; /* { dg-error "" "long int signed long _Accum" } */
+long int unsigned long _Accum *k244; /* { dg-error "" "long int unsigned long _Accum" } */
+long long int signed _Accum *k247; /* { dg-error "" "long long int signed _Accum" } */
+long long int unsigned _Accum *k250; /* { dg-error "" "long long int unsigned _Accum" } */
+long long signed int _Accum *k253; /* { dg-error "" "long long signed int _Accum" } */
+long long unsigned int _Accum *k256; /* { dg-error "" "long long unsigned int _Accum" } */
+long signed int long _Accum *k259; /* { dg-error "" "long signed int long _Accum" } */
+long signed long int _Accum *k262; /* { dg-error "" "long signed long int _Accum" } */
+long unsigned int long _Accum *k265; /* { dg-error "" "long unsigned int long _Accum" } */
+long unsigned long int _Accum *k268; /* { dg-error "" "long unsigned long int _Accum" } */
+signed long long int _Accum *k271; /* { dg-error "" "signed long long int _Accum" } */
+unsigned int long long _Accum *k274; /* { dg-error "" "unsigned int long long _Accum" } */
+unsigned long int long _Accum *k277; /* { dg-error "" "unsigned long int long _Accum" } */
+unsigned long long int _Accum *k280; /* { dg-error "" "unsigned long long int _Accum" } */
+_Complex _Accum *k283; /* { dg-error "" "_Complex _Accum" } */
+_Accum _Complex *k286; /* { dg-error "" "_Accum _Complex" } */
+unsigned _Accum *k289;
+signed _Accum *k292;
+
+void _Sat *s0;  /* { dg-error "" "void _Sat" } */
+char _Sat *s3;  /* { dg-error "" "char _Sat" } */
+short _Sat *s6; /* { dg-error "" "short _Sat" } */
+int _Sat *s9;   /* { dg-error "" "int _Sat" } */
+long _Sat *s12;   /* { dg-error "" "long _Sat" } */
+float _Sat *s15;   /* { dg-error "" "float _Sat" } */
+double _Sat *s18;   /* { dg-error "" "double _Sat" } */
+signed _Sat *s21;   /* { dg-error "" "signed _Sat" } */
+_Bool _Sat *s24;   /* { dg-error "" "_Bool _Sat" } */
+int _Sat *s27;   /* { dg-error "" "int _Sat" } */
+type _Sat *s30;   /* { dg-error "" "type _Sat" } */
+char signed _Sat *s33;  /* { dg-error "" "char signed _Sat" } */
+char unsigned _Sat *s36; /* { dg-error "" "char unsigned _Sat" } */
+short _Sat *s39;  /* { dg-error "" "short _Sat" } */
+short signed _Sat *s42;  /* { dg-error "" "short signed _Sat" } */
+short unsigned _Sat *s45;  /* { dg-error "" "short unsigned _Sat" } */
+_Sat short*s48;  /* { dg-error "" "_Sat short" } */
+_Sat short signed*s51;  /* { dg-error "" "_Sat short signed" } */
+_Sat short unsigned*s54;  /* { dg-error "" "_Sat short unsigned" } */
+_Sat long*s57;  /* { dg-error "" "_Sat long" } */
+_Sat long signed*s60;  /* { dg-error "" "_Sat long signed" } */
+_Sat long unsigned*s63;  /* { dg-error "" "_Sat long unsigned" } */
+_Sat signed long*s66;  /* { dg-error "" "_Sat signed long" } */
+_Sat signed short*s69;  /* { dg-error "" "_Sat signed short" } */
+int signed _Sat *s72;  /* { dg-error "" "int signed _Sat" } */
+int unsigned _Sat *s75;  /* { dg-error "" "int unsigned _Sat" } */
+long int _Sat *s78;  /* { dg-error "" "long int _Sat" } */
+long long _Sat *s81;  /* { dg-error "" "long long _Sat" } */
+long double _Sat *s84;  /* { dg-error "" "long double _Sat" } */
+long signed _Sat *s87;  /* { dg-error "" "long signed _Sat" } */
+long unsigned _Sat *s90;  /* { dg-error "" "long unsigned _Sat" } */
+double long _Sat *s93;  /* { dg-error "" "double long _Sat" } */
+signed char _Sat *s96;   /* { dg-error "" "signed char _Sat" } */
+signed short _Sat *s99;   /* { dg-error "" "signed short _Sat" } */
+signed int _Sat *s102;  /* { dg-error "" "signed int _Sat" } */
+signed long _Sat *s105; /* { dg-error "" "signed long _Sat" } */
+unsigned char _Sat *s108; /* { dg-error "" "unsigned char _Sat" } */
+unsigned short _Sat *s111; /* { dg-error "" "unsigned short _Sat" } */
+unsigned int _Sat *s114; /* { dg-error "" "unsigned int _Sat" } */
+unsigned long _Sat *s117; /* { dg-error "" "unsigned long _Sat" } */
+short int signed _Sat *s120; /* { dg-error "" "short int signed _Sat" } */
+short int unsigned _Sat *s123; /* { dg-error "" "short int unsigned _Sat" } */
+short signed int _Sat *s126; /* { dg-error "" "short signed int _Sat" } */
+short unsigned int _Sat *s129; /* { dg-error "" "short unsigned int _Sat" } */
+int short signed _Sat *s132; /* { dg-error "" "int short signed _Sat" } */
+int short unsigned _Sat *s135; /* { dg-error "" "int short unsigned _Sat" } */
+int long long _Sat *s138; /* { dg-error "" "int long long _Sat" } */
+int long signed _Sat *s141; /* { dg-error "" "int long signed _Sat" } */
+int long unsigned _Sat *s144; /* { dg-error "" "int long unsigned _Sat" } */
+int signed short _Sat *s147; /* { dg-error "" "int signed short _Sat" } */
+int signed long _Sat *s150; /* { dg-error "" "int signed long _Sat" } */
+int unsigned short _Sat *s153; /* { dg-error "" "int unsigned short _Sat" } */
+int unsigned long _Sat *s156; /* { dg-error "" "int unsigned long _Sat" } */
+long int long _Sat *s159; /* { dg-error "" "long int long _Sat" } */
+long int signed _Sat *s162; /* { dg-error "" "long int signed _Sat" } */
+long int unsigned _Sat *s165; /* { dg-error "" "long int unsigned _Sat" } */
+long long int _Sat *s168; /* { dg-error "" "long long int _Sat" } */
+long long signed _Sat *s171; /* { dg-error "" "long long signed _Sat" } */
+long long unsigned _Sat *s175; /* { dg-error "" "long long unsigned _Sat" } */
+long signed int _Sat *s178; /* { dg-error "" "long signed int _Sat" } */
+long unsigned int _Sat *s181; /* { dg-error "" "long unsigned int _Sat" } */
+long unsigned long _Sat *s184; /* { dg-error "" "long unsigned long _Sat" } */
+signed short int _Sat *s187; /* { dg-error "" "signed short int _Sat" } */
+signed int short _Sat *s190; /* { dg-error "" "signed int short _Sat" } */
+signed int long _Sat *s192; /* { dg-error "" "signed int long _Sat" } */
+signed long int _Sat *s195; /* { dg-error "" "signed long int _Sat" } */
+signed long long _Sat *s198; /* { dg-error "" "signed long long _Sat" } */
+unsigned short int _Sat *s201; /* { dg-error "" "unsigned short int _Sat" } */
+unsigned int short _Sat *s204; /* { dg-error "" "unsigned int short _Sat" } */
+unsigned int long _Sat *s207; /* { dg-error "" "unsigned int long _Sat" } */
+unsigned long int _Sat *s210; /* { dg-error "" "unsigned long int _Sat" } */
+unsigned long long _Sat *s213; /* { dg-error "" "unsigned long long _Sat" } */
+int long long signed _Sat *s216; /* { dg-error "" "int long long signed _Sat" } */
+int long long unsigned _Sat *s219; /* { dg-error "" "int long long unsigned _Sat" } */
+int long signed long _Sat *s222; /* { dg-error "" "int long signed long _Sat" } */
+int long unsigned long _Sat *s226; /* { dg-error "" "int long unsigned long _Sat" } */
+int signed long long _Sat *s229; /* { dg-error "" "int signed long long _Sat" } */
+int unsigned long long _Sat *s232; /* { dg-error "" "int unsigned long long _Sat" } */
+long int long signed _Sat *s235; /* { dg-error "" "long int long signed _Sat" } */
+long int long unsigned _Sat *s238; /* { dg-error "" "long int long unsigned _Sat" } */
+long int signed long _Sat *s241; /* { dg-error "" "long int signed long _Sat" } */
+long int unsigned long _Sat *s244; /* { dg-error "" "long int unsigned long _Sat" } */
+long long int signed _Sat *s247; /* { dg-error "" "long long int signed _Sat" } */
+long long int unsigned _Sat *s250; /* { dg-error "" "long long int unsigned _Sat" } */
+long long signed int _Sat *s253; /* { dg-error "" "long long signed int _Sat" } */
+long long unsigned int _Sat *s256; /* { dg-error "" "long long unsigned int _Sat" } */
+long signed int long _Sat *s259; /* { dg-error "" "long signed int long _Sat" } */
+long signed long int _Sat *s262; /* { dg-error "" "long signed long int _Sat" } */
+long unsigned int long _Sat *s265; /* { dg-error "" "long unsigned int long _Sat" } */
+long unsigned long int _Sat *s268; /* { dg-error "" "long unsigned long int _Sat" } */
+signed long long int _Sat *s271; /* { dg-error "" "signed long long int _Sat" } */
+unsigned int long long _Sat *s274; /* { dg-error "" "unsigned int long long _Sat" } */
+unsigned long int long _Sat *s277; /* { dg-error "" "unsigned long int long _Sat" } */
+unsigned long long int _Sat *s280; /* { dg-error "" "unsigned long long int _Sat" } */
+_Complex _Sat *s283; /* { dg-error "" "_Complex _Sat" } */
+_Sat _Complex *s286; /* { dg-error "" "_Sat _Complex" } */
+unsigned _Sat *s289; /* { dg-error "" "unsigned _Sat" } */
+signed _Sat *s292; /* { dg-error "" "signed _Sat" } */
diff --git a/gcc/testsuite/gcc.dg/fixed-point/unary.c b/gcc/testsuite/gcc.dg/fixed-point/unary.c
new file mode 100644 (file)
index 0000000..4e09549
--- /dev/null
@@ -0,0 +1,256 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* C99 6.5.3 Unary operators.
+
+   Check unary operators ++ -- + - !.  */
+
+extern void abort (void);
+
+#define INCDEC(TYPE,POSTFIX) \
+  { TYPE a = 0.0 ## POSTFIX; \
+    if (a++ != 0.0 ## POSTFIX) \
+      abort(); \
+    if (a != 1.0 ## POSTFIX) \
+      abort(); \
+    if (a-- != 1.0 ## POSTFIX) \
+      abort(); \
+    if (a != 0.0 ## POSTFIX) \
+      abort(); \
+    if (++a != 1.0 ## POSTFIX) \
+      abort(); \
+    if (a != 1.0 ## POSTFIX) \
+      abort(); \
+    if (--a != 0.0 ## POSTFIX) \
+      abort(); \
+    if (a != 0.0 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_INCDEC(TYPE,POSTFIX) \
+  { TYPE a = -0.5 ## POSTFIX; \
+    if (a++ != -0.5 ## POSTFIX) \
+      abort(); \
+    if (a != 0.5 ## POSTFIX) \
+      abort(); \
+    if (a-- != 0.5 ## POSTFIX) \
+      abort(); \
+    if (a != -0.5 ## POSTFIX) \
+      abort(); \
+    if (++a != 0.5 ## POSTFIX) \
+      abort(); \
+    if (a != 0.5 ## POSTFIX) \
+      abort(); \
+    if (--a != -0.5 ## POSTFIX) \
+      abort(); \
+    if (a != -0.5 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_INCDEC(TYPE,POSTFIX) \
+  { TYPE a = 0.9 ## POSTFIX; \
+    if (++a != 1.0 ## POSTFIX) \
+      abort(); \
+    a = -0.1 ## POSTFIX; \
+    if (--a != -0.5 ## POSTFIX - 0.5 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_UNS_INCDEC(TYPE,POSTFIX) \
+  { TYPE a = 0.9 ## POSTFIX; \
+    if (++a != 1.0 ## POSTFIX) \
+      abort(); \
+    a = 0.1 ## POSTFIX; \
+    if (--a != 0.0 ## POSTFIX) \
+      abort(); \
+  }
+
+#define PLUS(TYPE,POSTFIX) \
+  { TYPE a = 0.1 ## POSTFIX; \
+    if (+a != 0.1 ## POSTFIX) \
+      abort(); \
+  }
+
+#define NEG(TYPE,POSTFIX) \
+  { TYPE a = -0.1 ## POSTFIX; \
+    if (-a != 0.1 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_NEG(TYPE,POSTFIX) \
+  { TYPE a = -0.5 ## POSTFIX - 0.5 ## POSTFIX; \
+    if (-a != 1.0 ## POSTFIX) \
+      abort(); \
+  }
+
+#define UNS_NEG(TYPE,POSTFIX) \
+  { TYPE a = 0.0 ## POSTFIX; \
+    if (-a != 0.0 ## POSTFIX) \
+      abort(); \
+  }
+
+#define FRACT_SAT_UNS_NEG(TYPE,POSTFIX) \
+  { TYPE a = 0.5 ## POSTFIX; \
+    if (-a != 0.0 ## POSTFIX) \
+      abort(); \
+  }
+
+#define LOGNEG(TYPE,POSTFIX) \
+  { TYPE a = 0.0 ## POSTFIX; \
+    TYPE b = 0.1 ## POSTFIX; \
+    if (!a != 1) \
+      abort(); \
+    if (!b != 0) \
+      abort(); \
+  }
+
+int main ()
+{
+  FRACT_INCDEC(short _Fract, hr);
+  FRACT_INCDEC(_Fract, r);
+  FRACT_INCDEC(long _Fract, lr);
+  FRACT_INCDEC(long long _Fract, llr);
+  FRACT_INCDEC(_Sat short _Fract, hr);
+  FRACT_INCDEC(_Sat _Fract, r);
+  FRACT_INCDEC(_Sat long _Fract, lr);
+  FRACT_INCDEC(_Sat long long _Fract, llr);
+
+  INCDEC(short _Accum, hk);
+  INCDEC(_Accum, k);
+  INCDEC(long _Accum, lk);
+  INCDEC(long long _Accum, llk);
+  INCDEC(unsigned short _Accum, uhk);
+  INCDEC(unsigned _Accum, uk);
+  INCDEC(unsigned long _Accum, ulk);
+  INCDEC(unsigned long long _Accum, ullk);
+  INCDEC(_Sat short _Accum, hk);
+  INCDEC(_Sat _Accum, k);
+  INCDEC(_Sat long _Accum, lk);
+  INCDEC(_Sat long long _Accum, llk);
+  INCDEC(_Sat unsigned short _Accum, uhk);
+  INCDEC(_Sat unsigned _Accum, uk);
+  INCDEC(_Sat unsigned long _Accum, ulk);
+  INCDEC(_Sat unsigned long long _Accum, ullk);
+
+  FRACT_SAT_INCDEC(_Sat short _Fract, hr);
+  FRACT_SAT_INCDEC(_Sat _Fract, r);
+  FRACT_SAT_INCDEC(_Sat long _Fract, lr);
+  FRACT_SAT_INCDEC(_Sat long long _Fract, llr);
+
+  FRACT_SAT_UNS_INCDEC(_Sat unsigned short _Fract, uhr);
+  FRACT_SAT_UNS_INCDEC(_Sat unsigned _Fract, ur);
+  FRACT_SAT_UNS_INCDEC(_Sat unsigned long _Fract, ulr);
+  FRACT_SAT_UNS_INCDEC(_Sat unsigned long long _Fract, ullr);
+
+  PLUS(short _Fract, hr);
+  PLUS(_Fract, r);
+  PLUS(long _Fract, lr);
+  PLUS(long long _Fract, llr);
+  PLUS(unsigned short _Fract, uhr);
+  PLUS(unsigned _Fract, ur);
+  PLUS(unsigned long _Fract, ulr);
+  PLUS(unsigned long long _Fract, ullr);
+  PLUS(_Sat short _Fract, hr);
+  PLUS(_Sat _Fract, r);
+  PLUS(_Sat long _Fract, lr);
+  PLUS(_Sat long long _Fract, llr);
+  PLUS(_Sat unsigned short _Fract, uhr);
+  PLUS(_Sat unsigned _Fract, ur);
+  PLUS(_Sat unsigned long _Fract, ulr);
+  PLUS(_Sat unsigned long long _Fract, ullr);
+  PLUS(short _Accum, hk);
+  PLUS(_Accum, k);
+  PLUS(long _Accum, lk);
+  PLUS(long long _Accum, llk);
+  PLUS(unsigned short _Accum, uhk);
+  PLUS(unsigned _Accum, uk);
+  PLUS(unsigned long _Accum, ulk);
+  PLUS(unsigned long long _Accum, ullk);
+  PLUS(_Sat short _Accum, hk);
+  PLUS(_Sat _Accum, k);
+  PLUS(_Sat long _Accum, lk);
+  PLUS(_Sat long long _Accum, llk);
+  PLUS(_Sat unsigned short _Accum, uhk);
+  PLUS(_Sat unsigned _Accum, uk);
+  PLUS(_Sat unsigned long _Accum, ulk);
+  PLUS(_Sat unsigned long long _Accum, ullk);
+
+  NEG(short _Fract, hr);
+  NEG(_Fract, r);
+  NEG(long _Fract, lr);
+  NEG(long long _Fract, llr);
+  NEG(_Sat short _Fract, hr);
+  NEG(_Sat _Fract, r);
+  NEG(_Sat long _Fract, lr);
+  NEG(_Sat long long _Fract, llr);
+  NEG(short _Accum, hk);
+  NEG(_Accum, k);
+  NEG(long _Accum, lk);
+  NEG(long long _Accum, llk);
+  NEG(_Sat short _Accum, hk);
+  NEG(_Sat _Accum, k);
+  NEG(_Sat long _Accum, lk);
+  NEG(_Sat long long _Accum, llk);
+
+  FRACT_SAT_NEG(_Sat short _Fract, hr);
+  FRACT_SAT_NEG(_Sat _Fract, r);
+  FRACT_SAT_NEG(_Sat long _Fract, lr);
+  FRACT_SAT_NEG(_Sat long long _Fract, llr);
+
+  UNS_NEG(short _Fract, hr);
+  UNS_NEG(_Fract, r);
+  UNS_NEG(long _Fract, lr);
+  UNS_NEG(long long _Fract, llr);
+  UNS_NEG(_Sat short _Fract, hr);
+  UNS_NEG(_Sat _Fract, r);
+  UNS_NEG(_Sat long _Fract, lr);
+  UNS_NEG(_Sat long long _Fract, llr);
+  UNS_NEG(short _Accum, hk);
+  UNS_NEG(_Accum, k);
+  UNS_NEG(long _Accum, lk);
+  UNS_NEG(long long _Accum, llk);
+  UNS_NEG(_Sat short _Accum, hk);
+  UNS_NEG(_Sat _Accum, k);
+  UNS_NEG(_Sat long _Accum, lk);
+  UNS_NEG(_Sat long long _Accum, llk);
+
+  FRACT_SAT_UNS_NEG(_Sat unsigned short _Fract, uhr);
+  FRACT_SAT_UNS_NEG(_Sat unsigned _Fract, ur);
+  FRACT_SAT_UNS_NEG(_Sat unsigned long _Fract, ulr);
+  FRACT_SAT_UNS_NEG(_Sat unsigned long long _Fract, ullr);
+
+  LOGNEG(short _Fract, hr);
+  LOGNEG(_Fract, r);
+  LOGNEG(long _Fract, lr);
+  LOGNEG(long long _Fract, llr);
+  LOGNEG(unsigned short _Fract, uhr);
+  LOGNEG(unsigned _Fract, ur);
+  LOGNEG(unsigned long _Fract, ulr);
+  LOGNEG(unsigned long long _Fract, ullr);
+  LOGNEG(_Sat short _Fract, hr);
+  LOGNEG(_Sat _Fract, r);
+  LOGNEG(_Sat long _Fract, lr);
+  LOGNEG(_Sat long long _Fract, llr);
+  LOGNEG(_Sat unsigned short _Fract, uhr);
+  LOGNEG(_Sat unsigned _Fract, ur);
+  LOGNEG(_Sat unsigned long _Fract, ulr);
+  LOGNEG(_Sat unsigned long long _Fract, ullr);
+  LOGNEG(short _Accum, hk);
+  LOGNEG(_Accum, k);
+  LOGNEG(long _Accum, lk);
+  LOGNEG(long long _Accum, llk);
+  LOGNEG(unsigned short _Accum, uhk);
+  LOGNEG(unsigned _Accum, uk);
+  LOGNEG(unsigned long _Accum, ulk);
+  LOGNEG(unsigned long long _Accum, ullk);
+  LOGNEG(_Sat short _Accum, hk);
+  LOGNEG(_Sat _Accum, k);
+  LOGNEG(_Sat long _Accum, lk);
+  LOGNEG(_Sat long long _Accum, llk);
+  LOGNEG(_Sat unsigned short _Accum, uhk);
+  LOGNEG(_Sat unsigned _Accum, uk);
+  LOGNEG(_Sat unsigned long _Accum, ulk);
+  LOGNEG(_Sat unsigned long long _Accum, ullk);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/fixed-point/union-init.c b/gcc/testsuite/gcc.dg/fixed-point/union-init.c
new file mode 100644 (file)
index 0000000..126cc9e
--- /dev/null
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+/* Cast to union is a GNU C extension.
+   Based on the test from ../dfp/.  */
+
+extern void abort (void);
+
+union u
+{
+  long _Fract lf;
+  double d;
+};
+
+union n
+{
+  double d;
+  _Fract f;
+};
+
+int main ()
+{
+  static union u u1 = { 0.1lr };
+  static union u u2 = { 0.2lr };
+  static union u u4 = { 0.0 };
+
+  static union n n1 = { 0.3r };
+  static union n n2 = { 3.25 };
+
+  long _Fract lf;
+  _Fract f;
+  double d;
+
+  if (u1.lf != 0.1lr)
+    abort ();
+
+  if (u2.lf != 0.2lr)
+    abort ();
+
+  /* cast fixed-point to union type.  */
+  lf = 0.4lr;
+  f = 0.5r;
+  d = 3.25;
+
+  u4 = (union u) lf;
+  if (u4.lf != 0.4lr)
+    abort ();
+
+  u4 = (union u) d;
+  if (u4.d != 3.25)
+    abort ();
+
+  n1 = (union n) f;
+  if (n1.f != 0.5r)
+    abort ();
+
+  n1 = (union n)d;
+  if (n1.d != 3.25)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/nofixed-point-1.c b/gcc/testsuite/gcc.dg/nofixed-point-1.c
new file mode 100644 (file)
index 0000000..babbe59
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile { target {! fixed_point} } } */
+/* { dg-options "-std=gnu99" } */
+
+_Fract w;       /* { dg-error "not supported" "reject fixed-point" } */
+_Sat _Fract x;  /* { dg-error "not supported" "reject fixed-point" } */
+_Accum y;       /* { dg-error "not supported" "reject fixed-point" } */
+_Sat _Accum z;  /* { dg-error "not supported" "reject fixed-point" } */
diff --git a/gcc/testsuite/gcc.target/mips/dpaq_sa_l_w.c b/gcc/testsuite/gcc.target/mips/dpaq_sa_l_w.c
new file mode 100644 (file)
index 0000000..2565e17
--- /dev/null
@@ -0,0 +1,49 @@
+/* { dg-do compile { target {fixed_point} } } */
+/* { dg-mips-options "-O2 -mips32r2 -mdsp" } */
+/* { dg-final { scan-assembler-times "\tdpaq_sa.l.w\t\\\$ac" 3 } } */
+
+_Sat long long _Fract
+f1 (_Sat long _Fract x, _Sat long _Fract y, _Sat long long _Fract z)
+{
+  return (_Sat long long _Fract) x * y + z;
+}
+
+_Sat long long _Fract
+f2 (_Sat long _Fract x, _Sat long _Fract y, _Sat long long _Fract z)
+{
+  return z + (_Sat long long _Fract) y * x;
+}
+
+_Sat long long _Fract
+f3 (_Sat long _Fract x, _Sat long _Fract y, _Sat long long _Fract z)
+{
+  _Sat long long _Fract t = (_Sat long long _Fract) x * y;
+  int temp = 5;
+  if (temp == 5)
+    z = t + z; /* Need to put z at the end.  GCC does not swap operands to
+                 match the ssmadd pattern, because types are saturating.  */
+  return z;
+}
+
+long long _Fract
+f4 (long _Fract x, long _Fract y, long long _Fract z)
+{
+  return (long long _Fract) x * y + z;
+}
+
+long long _Fract
+f5 (long _Fract x, long _Fract y, long long _Fract z)
+{
+  return z + (long long _Fract) y * x;
+}
+
+long long _Fract
+f6 (long _Fract x, long _Fract y, long long _Fract z)
+{
+  long long _Fract t = (long long _Fract) x * y;
+  int temp = 5;
+  if (temp == 5)
+    z = t + z; /* Need to put z at the end.  GCC does not swap operands to
+                 match the ssmadd pattern, because types are saturating.  */
+  return z;
+}
diff --git a/gcc/testsuite/gcc.target/mips/dpsq_sa_l_w.c b/gcc/testsuite/gcc.target/mips/dpsq_sa_l_w.c
new file mode 100644 (file)
index 0000000..f418a13
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do compile { target {fixed_point} } } */
+/* { dg-mips-options "-O2 -mips32r2 -mdsp" } */
+/* { dg-final { scan-assembler-times "\tdpsq_sa.l.w\t\\\$ac" 2 } } */
+
+_Sat long long _Fract
+f1 (_Sat long _Fract x, _Sat long _Fract y, _Sat long long _Fract z)
+{
+  return z - (_Sat long long _Fract) x * y;
+}
+
+_Sat long long _Fract
+f2 (_Sat long _Fract x, _Sat long _Fract y, _Sat long long _Fract z)
+{
+  _Sat long long _Fract t = (_Sat long long _Fract) x * y;
+  int temp = 5;
+  if (temp == 5)
+    z -= t;
+  return z;
+}
+
+long long _Fract
+f3 (long _Fract x, long _Fract y, long long _Fract z)
+{
+  return z - (long long _Fract) x * y;
+}
+
+long long _Fract
+f4 (long _Fract x, long _Fract y, long long _Fract z)
+{
+  long long _Fract t = (long long _Fract) x * y;
+  int temp = 5;
+  if (temp == 5)
+    z -= t;
+  return z;
+}
diff --git a/gcc/testsuite/gcc.target/mips/fixed-scalar-type.c b/gcc/testsuite/gcc.target/mips/fixed-scalar-type.c
new file mode 100644 (file)
index 0000000..4455d3d
--- /dev/null
@@ -0,0 +1,215 @@
+/* Test scalar fixed-point instructions */
+/* { dg-do compile { target {fixed_point} } } */
+/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2" } */
+/* { dg-final { scan-assembler-times "\taddu\t" 10 } } */
+/* { dg-final { scan-assembler-times "\tsubu\t" 10 } } */
+/* { dg-final { scan-assembler "\taddu_s.qb\t" } } */
+/* { dg-final { scan-assembler-times "\taddu_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\taddq_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\taddq_s.w\t" 2 } } */
+/* { dg-final { scan-assembler "\tsubu_s.qb\t" } } */
+/* { dg-final { scan-assembler-times "\tsubu_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsubq_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsubq_s.w\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tmulq_rs.ph\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tmulq_rs.w\t" 1 } } */
+
+short _Fract non_sat_test1 (short _Fract a, short _Fract b)
+{
+  return a + b;
+}
+
+_Fract non_sat_test2 (_Fract a, _Fract b)
+{
+  return a + b;
+}
+
+long _Fract non_sat_test3 (long _Fract a, long _Fract b)
+{
+  return a + b;
+}
+
+unsigned short _Fract non_sat_test4 (unsigned short _Fract a,
+                                    unsigned short _Fract b)
+{
+  return a + b;
+}
+
+unsigned _Fract non_sat_test5 (unsigned _Fract a, unsigned _Fract b)
+{
+  return a + b;
+}
+
+unsigned long _Fract non_sat_test6 (unsigned long _Fract a,
+                                   unsigned long _Fract b)
+{
+  return a + b;
+}
+
+short _Accum non_sat_test7 (short _Accum a, short _Accum b)
+{
+  return a + b;
+}
+
+_Accum non_sat_test8 (_Accum a, _Accum b)
+{
+  return a + b;
+}
+
+unsigned short _Accum non_sat_test9 (unsigned short _Accum a,
+                                    unsigned short _Accum b)
+{
+  return a + b;
+}
+
+unsigned _Accum non_sat_test10 (unsigned _Accum a, unsigned _Accum b)
+{
+  return a + b;
+}
+
+short _Fract non_sat_test11 (short _Fract a, short _Fract b)
+{
+  return a - b;
+}
+
+_Fract non_sat_test12 (_Fract a, _Fract b)
+{
+  return a - b;
+}
+
+long _Fract non_sat_test13 (long _Fract a, long _Fract b)
+{
+  return a - b;
+}
+
+unsigned short _Fract non_sat_test14 (unsigned short _Fract a,
+                                    unsigned short _Fract b)
+{
+  return a - b;
+}
+
+unsigned _Fract non_sat_test15 (unsigned _Fract a, unsigned _Fract b)
+{
+  return a - b;
+}
+
+unsigned long _Fract non_sat_test16 (unsigned long _Fract a,
+                                   unsigned long _Fract b)
+{
+  return a - b;
+}
+
+short _Accum non_sat_test17 (short _Accum a, short _Accum b)
+{
+  return a - b;
+}
+
+_Accum non_sat_test18 (_Accum a, _Accum b)
+{
+  return a - b;
+}
+
+unsigned short _Accum non_sat_test19 (unsigned short _Accum a,
+                                    unsigned short _Accum b)
+{
+  return a - b;
+}
+
+unsigned _Accum non_sat_test20 (unsigned _Accum a, unsigned _Accum b)
+{
+  return a - b;
+}
+
+_Sat unsigned short _Fract test1 (_Sat unsigned short _Fract a,
+                                 _Sat unsigned short _Fract b)
+{
+  return a + b;
+}
+
+_Sat unsigned _Fract test2 (_Sat unsigned  _Fract a, _Sat unsigned _Fract b)
+{
+  return a + b;
+}
+
+_Sat unsigned short _Accum test3 (_Sat unsigned short _Accum a,
+                                 _Sat unsigned short _Accum b)
+{
+  return a + b;
+}
+
+_Sat _Fract test4 (_Sat _Fract a, _Sat _Fract b)
+{
+  return a + b;
+}
+
+_Sat long _Fract test5 (_Sat long _Fract a, _Sat long _Fract b)
+{
+  return a + b;
+}
+
+_Sat short _Accum test6 (_Sat short _Accum a, _Sat short _Accum b)
+{
+  return a + b;
+}
+
+_Sat _Accum test7 (_Sat _Accum a, _Sat _Accum b)
+{
+  return a + b;
+}
+
+_Sat unsigned short _Fract test8 (_Sat unsigned short _Fract a,
+                                 _Sat unsigned short _Fract b)
+{
+  return a - b;
+}
+
+_Sat unsigned _Fract test9 (_Sat unsigned  _Fract a, _Sat unsigned _Fract b)
+{
+  return a - b;
+}
+
+_Sat unsigned short _Accum test10 (_Sat unsigned short _Accum a,
+                                 _Sat unsigned short _Accum b)
+{
+  return a - b;
+}
+
+_Sat _Fract test11 (_Sat _Fract a, _Sat _Fract b)
+{
+  return a - b;
+}
+
+_Sat long _Fract test12 (_Sat long _Fract a, _Sat long _Fract b)
+{
+  return a - b;
+}
+
+_Sat short _Accum test13 (_Sat short _Accum a, _Sat short _Accum b)
+{
+  return a - b;
+}
+
+_Sat _Accum test14 (_Sat _Accum a, _Sat _Accum b)
+{
+  return a - b;
+}
+
+_Sat _Fract test15 (_Sat _Fract a, _Sat _Fract b)
+{
+  return a * b;
+}
+
+_Sat long _Fract test16 (_Sat long _Fract a, _Sat long _Fract b)
+{
+  return a * b;
+}
+
+_Fract test17 (_Fract a, _Fract b)
+{
+  return a * b;
+}
+
+long _Fract test18 (long _Fract a, long _Fract b)
+{
+  return a * b;
+}
diff --git a/gcc/testsuite/gcc.target/mips/fixed-vector-type.c b/gcc/testsuite/gcc.target/mips/fixed-vector-type.c
new file mode 100644 (file)
index 0000000..30dba5b
--- /dev/null
@@ -0,0 +1,132 @@
+/* Test vector fixed-point instructions */
+/* { dg-do compile { target {fixed_point} } } */
+/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2" } */
+/* { dg-final { scan-assembler-times "\taddq_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsubq_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\taddu_s.qb\t" 1 } } */
+/* { dg-final { scan-assembler-times "\taddu_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tsubu_s.qb\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tsubu_s.ph\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tmulq_rs.ph\t" 1 } } */
+
+typedef _Sat unsigned short _Fract sat_v4uqq __attribute__ ((vector_size(4)));
+typedef _Sat unsigned _Fract sat_v2uhq __attribute__ ((vector_size(4)));
+typedef _Sat unsigned short _Accum sat_v2uha __attribute__ ((vector_size(4)));
+typedef _Sat _Fract sat_v2hq __attribute__ ((vector_size(4)));
+typedef _Sat short _Accum sat_v2ha __attribute__ ((vector_size(4)));
+
+typedef unsigned short _Fract v4uqq __attribute__ ((vector_size(4)));
+typedef unsigned _Fract v2uhq __attribute__ ((vector_size(4)));
+typedef unsigned short _Accum v2uha __attribute__ ((vector_size(4)));
+typedef _Fract v2hq __attribute__ ((vector_size(4)));
+typedef short _Accum v2ha __attribute__ ((vector_size(4)));
+
+sat_v2hq test1 (sat_v2hq a, sat_v2hq b)
+{
+  return a + b;
+}
+
+sat_v2ha test2 (sat_v2ha a, sat_v2ha b)
+{
+  return a + b;
+}
+
+sat_v2hq test3 (sat_v2hq a, sat_v2hq b)
+{
+  return a - b;
+}
+
+sat_v2ha test4 (sat_v2ha a, sat_v2ha b)
+{
+  return a - b;
+}
+
+sat_v4uqq test5 (sat_v4uqq a, sat_v4uqq b)
+{
+  return a + b;
+}
+
+sat_v2uhq test6 (sat_v2uhq a, sat_v2uhq b)
+{
+  return a + b;
+}
+
+sat_v2uha test7 (sat_v2uha a, sat_v2uha b)
+{
+  return a + b;
+}
+
+sat_v4uqq test8 (sat_v4uqq a, sat_v4uqq b)
+{
+  return a - b;
+}
+
+sat_v2uhq test9 (sat_v2uhq a, sat_v2uhq b)
+{
+  return a - b;
+}
+
+sat_v2uha test10 (sat_v2uha a, sat_v2uha b)
+{
+  return a - b;
+}
+
+sat_v2hq test11 (sat_v2hq a, sat_v2hq b)
+{
+  return a * b;
+}
+
+v2hq test12 (v2hq a, v2hq b)
+{
+  return a + b;
+}
+
+v2hq test13 (v2hq a, v2hq b)
+{
+  return a - b;
+}
+
+v2hq test14 (v2hq a, v2hq b)
+{
+  return a * b;
+}
+
+v2ha test15 (v2ha a, v2ha b)
+{
+  return a + b;
+}
+
+v2ha test16 (v2ha a, v2ha b)
+{
+  return a - b;
+}
+
+v4uqq test17 (v4uqq a, v4uqq b)
+{
+  return a + b;
+}
+
+v4uqq test18 (v4uqq a, v4uqq b)
+{
+  return a - b;
+}
+
+v2uhq test19 (v2uhq a, v2uhq b)
+{
+  return a + b;
+}
+
+v2uhq test20 (v2uhq a, v2uhq b)
+{
+  return a - b;
+}
+
+v2uha test21 (v2uha a, v2uha b)
+{
+  return a + b;
+}
+
+v2uha test22 (v2uha a, v2uha b)
+{
+  return a - b;
+}
index b744e2eb1efe5d24b51160e024ccd24c8a0ad3e0..2aa8bcc1465010707942ac36d449d525d822247e 100644 (file)
@@ -1271,6 +1271,14 @@ proc check_effective_target_large_long_double { } {
     }]
 }
 
+# Return 1 if the target supports compiling fixed-point,
+# 0 otherwise.
+
+proc check_effective_target_fixed_point { } {
+    return [check_no_compiler_messages fixed_point object {
+        _Sat _Fract x; _Sat _Accum y;
+    }]
+}
 
 # Return 1 if the target supports compiling decimal floating point,
 # 0 otherwise.