* [fixed-point] Update tests
@ 2007-05-21 23:42 Fu, Chao-Ying
0 siblings, 0 replies; only message in thread
From: Fu, Chao-Ying @ 2007-05-21 23:42 UTC (permalink / raw)
To: gcc-patches; +Cc: Thekkath, Radhika, Stephens, Nigel
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
Hi,
This patch updates comments in several tests
and adds a new test. We will work on adding more tests
for the fixed-point extension. Thanks!
Regards,
Chao-ying
testsuite/ChangeLog
2007-05-21 Chao-ying Fu <fu@mips.com>
* gcc.dg/fixed-ponit/allconv.c: Update comments.
Add tests for complex types.
* gcc.dg/fixed-ponit/unary.c, gcc.dg/fixed-ponit/convert.c,
* gcc.dg/fixed-ponit/convert.c, gcc.dg/fixed-ponit/types.c,
* gcc.dg/fixed-ponit/const-1.c, gcc.dg/fixed-ponit/binary.c,
* gcc.dg/fixed-ponit/allop.c, gcc.dg/fixed-ponit/constant.c,
* gcc.dg/fixed-ponit/define.c, gcc.dg/fixed-ponit/allop-const.c:
Update comments.
* gcc.dg/fixed-ponit/call-by-value.c: New.
[-- Attachment #2: gcc.diff --]
[-- Type: application/octet-stream, Size: 10183 bytes --]
Index: allconv.c
===================================================================
--- allconv.c (revision 124839)
+++ allconv.c (working copy)
@@ -1,8 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if all conversions are ok. */
+/* 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; } \
@@ -115,7 +117,19 @@
_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; }
+ _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);
Index: unary.c
===================================================================
--- unary.c (revision 124839)
+++ unary.c (working copy)
@@ -1,10 +1,12 @@
/* { dg-do run } */
/* { dg-options "-std=gnu99" } */
+/* C99 6.5.3 Unary operators.
+
+ Check unary operators ++ -- + - !. */
+
extern void abort (void);
-/* Check unary operators ++ -- + - !. */
-
#define INCDEC(TYPE,POSTFIX) \
{ TYPE a = 0.0 ## POSTFIX; \
if (a++ != 0.0 ## POSTFIX) \
Index: convert.c
===================================================================
--- convert.c (revision 124839)
+++ convert.c (working copy)
@@ -1,10 +1,12 @@
/* { dg-do run } */
/* { dg-options "-std=gnu99 -O0" } */
+/* C99 6.3 Conversions.
+
+ Check conversions involving fixed-point. */
+
extern void abort (void);
-/* Check conversions involving fixed-point. */
-
/* Fixed-point to fixed-point. */
#define CONV(TYPE1,POSTFIX1,TYPE2,POSTFIX2) \
{ \
Index: types.c
===================================================================
--- types.c (revision 124839)
+++ types.c (working copy)
@@ -1,8 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if all types are ok. */
+/* N1169 6.3.1.3a - Fixed-point types (NEW CLAUSE).
+ Check if all types are ok. */
+
short _Fract q0;
_Fract q1;
long _Fract q2;
Index: const-1.c
===================================================================
--- const-1.c (revision 124839)
+++ const-1.c (working copy)
@@ -1,8 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if the constant 1 is ok. */
+/* 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;
Index: binary.c
===================================================================
--- binary.c (revision 124839)
+++ binary.c (working copy)
@@ -1,10 +1,18 @@
/* { 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);
-/* Check binary operators + - * / << >> < <= >= > == != += -= *= /= <<= >>=. */
-
#define BINARY(TYPE,POSTFIX) \
{ TYPE a = 0.5 ## POSTFIX; \
TYPE b = 0.25 ## POSTFIX; \
Index: allop.c
===================================================================
--- allop.c (revision 124839)
+++ allop.c (working copy)
@@ -1,8 +1,17 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if all operations are ok. */
+/* 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();
Index: constant.c
===================================================================
--- constant.c (revision 124839)
+++ constant.c (working copy)
@@ -1,8 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if fixed-point constants are ok. */
+/* 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;
Index: define.c
===================================================================
--- define.c (revision 124839)
+++ define.c (working copy)
@@ -1,8 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if defined fixed-point constants are ok. */
+/* N1169 7.18a.3 - Precision macros.
+ Check if defined fixed-point constants are ok. */
+
short _Fract sf = __SFRACT_MAX__;
_Fract f = __FRACT_MAX__;
long _Fract lf = __LFRACT_MAX__;
Index: allop-const.c
===================================================================
--- allop-const.c (revision 124839)
+++ allop-const.c (working copy)
@@ -1,8 +1,17 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
-/* Check if all operations on constants are ok. */
+/* 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; \
Index: call-by-value.c
===================================================================
--- call-by-value.c (revision 0)
+++ call-by-value.c (revision 0)
@@ -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.2r)
+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.2r)
+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.2k)
+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.2k)
+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.2r)
+ 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.2r)
+ 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.2k)
+ 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.2k)
+ FOO_TEST (Sula, _Sat unsigned long _Accum, 0.2ulk)
+ FOO_TEST (Sulla, _Sat unsigned long long _Accum, 0.2ullk)
+
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-05-21 23:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-21 23:42 [fixed-point] Update tests Fu, Chao-Ying
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).