OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gcc-4.5.1/gcc-4.5.1-or32-1.0rc1/gcc/testsuite/c-c++-common
    from Rev 295 to Rev 338
    Reverse comparison

Rev 295 → Rev 338

/restrict-2.c
0,0 → 1,14
/* { dg-do compile } */
/* { dg-options "-O -fno-strict-aliasing -fdump-tree-lim-details" } */
 
void foo (float * __restrict__ a, float * __restrict__ b, int n, int j)
{
int i;
for(i = 0; i < n; ++i)
a[i] = (b[j+50] + b[j-50]) * 0.5f;
}
 
/* We should move the RHS of the store out of the loop. */
 
/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim1" } } */
/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
restrict-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-4.c =================================================================== --- raw-string-4.c (nonexistent) +++ raw-string-4.c (revision 338) @@ -0,0 +1,29 @@ +// R is not applicable for character literals. +// { dg-do compile } +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +const int i0 = R'a'; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 6 } +const int i1 = uR'a'; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 8 } +const int i2 = UR'a'; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } +const int i3 = u8R'a'; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } +const int i4 = LR'a'; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 14 } + +#define R 1 + +#define uR 2 + +#define UR 3 + +#define u8R 4 + +#define LR 5 + + +const int i5 = R'a'; +const int i6 = uR'a'; +const int i7 = UR'a'; +const int i8 = u8R'a'; +const int i9 = LR'a'; + +int main () {}
raw-string-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-5.c =================================================================== --- raw-string-5.c (nonexistent) +++ raw-string-5.c (revision 338) @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +const void *s0 = R"0123456789abcdefg()0123456789abcdefg"; + // { dg-error "raw string delimiter longer" "" { target *-*-* } 5 } + // { dg-error "stray" "" { target *-*-* } 5 } +const void *s1 = R" () "; + // { dg-error "invalid character" "" { target *-*-* } 8 } + // { dg-error "stray" "" { target *-*-* } 8 } +const void *s2 = R" () "; + // { dg-error "invalid character" "" { target *-*-* } 11 } + // { dg-error "stray" "" { target *-*-* } 11 } +const void *s3 = R")())"; + // { dg-error "invalid character" "" { target *-*-* } 14 } + // { dg-error "stray" "" { target *-*-* } 14 } +const void *s4 = R"@()@"; + // { dg-error "invalid character" "" { target *-*-* } 17 } + // { dg-error "stray" "" { target *-*-* } 17 } +const void *s5 = R"$()$"; + // { dg-error "invalid character" "" { target *-*-* } 20 } + // { dg-error "stray" "" { target *-*-* } 20 } +const void *s6 = R"\u0040()\u0040"; + // { dg-error "invalid character" "" { target *-*-* } 23 } + // { dg-error "stray" "" { target *-*-* } 23 } + +int main () {}
raw-string-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: restrict-4.c =================================================================== --- restrict-4.c (nonexistent) +++ restrict-4.c (revision 338) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-lim1-details" } */ + +struct Foo +{ + int n; + int * __restrict__ p; +}; +void bar(struct Foo f, int * __restrict__ q) +{ + int i; + for (i = 0; i < f.n; ++i) + { + *q += f.p[i]; + } +} + +/* { dg-final { scan-tree-dump "Executing store motion" "lim1" } } */ +/* { dg-final { cleanup-tree-dump "lim1" } } */
restrict-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-6.c =================================================================== --- raw-string-6.c (nonexistent) +++ raw-string-6.c (revision 338) @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +const void *s0 = R"ouch()ouCh"; // { dg-error "at end of input" } + // { dg-error "unterminated raw string" "" { target *-*-* } 5 }
raw-string-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-7.c =================================================================== --- raw-string-7.c (nonexistent) +++ raw-string-7.c (revision 338) @@ -0,0 +1,24 @@ +// The trailing whitespace after \ and before newline extension +// breaks full compliance for raw strings. +// { dg-do run { xfail *-*-* } } +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +// Note, there is a single space after \ on the following line. +const char *s0 = R"(\ +)"; +// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 8 } + +// Note, there is a single tab after \ on the following line. +const char *s1 = R"(\ +)"; +// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 13 } + +int +main (void) +{ + if (__builtin_strcmp (s0, "\\ \n") != 0 + || __builtin_strcmp (s1, "\\\t\n") != 0) + __builtin_abort (); + return 0; +}
raw-string-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-8.c =================================================================== --- raw-string-8.c (nonexistent) +++ raw-string-8.c (revision 338) @@ -0,0 +1,10 @@ +// Test that we track line numbers properly across newlines +// both escaped and not in raw strings. +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +const char a[] = R"(\ + +)"; + +T t; // { dg-error "" }
raw-string-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-9.c =================================================================== --- raw-string-9.c (nonexistent) +++ raw-string-9.c (revision 338) @@ -0,0 +1,19 @@ +// Make sure that we properly handle trigraphs in raw strings when +// trigraphs are disabled, too. +// { dg-options "-std=gnu99" { target c } } +// { dg-options "-std=gnu++0x" { target c++ } } +// { dg-do run } + +const char b[] = "??>"; // { dg-message "-trigraphs" } +const char a[] = R"(??>??)??/ +??)"; + +#define TEST(str, val) \ + if (sizeof (str) != sizeof (val) \ + || __builtin_memcmp (str, val, sizeof (str)) != 0) \ + __builtin_abort () + +int main() +{ + TEST (a, "?\?>?\?)?\?/\n?\?"); +}
raw-string-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dwarf2/pr43190.c =================================================================== --- dwarf2/pr43190.c (nonexistent) +++ dwarf2/pr43190.c (revision 338) @@ -0,0 +1,13 @@ +/* PR debug/43190 */ +/* { dg-options "-gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"S\[^\\r\\n\]*DW_AT_name" } } */ +/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"T\[^\\r\\n\]*DW_AT_name" } } */ + +typedef struct S { int i; } *T; +#define M(p) ((T) (p)) + +void +foo (void *p) +{ + M (p)->i++; +}
dwarf2/pr43190.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dwarf2/vla1.c =================================================================== --- dwarf2/vla1.c (nonexistent) +++ dwarf2/vla1.c (revision 338) @@ -0,0 +1,11 @@ +// PR debug/42800 +// { dg-options "-gdwarf-2 -dA" } +// { dg-final { scan-assembler "DW_AT_upper_bound" } } + +int +f (int i) +{ + char a[i]; + + return a[0]; +}
dwarf2/vla1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asmgoto-1.c =================================================================== --- asmgoto-1.c (nonexistent) +++ asmgoto-1.c (revision 338) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +foo (void) +{ + int i = 0; + asm ("" : : : "memory"); + asm ("" : : : ); + asm ("" : : "r" (i)); + asm ("" : : ); + asm ("" : "=r" (i)); + asm ("" : ); + asm (""); +}
asmgoto-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attr-used-2.c =================================================================== --- attr-used-2.c (nonexistent) +++ attr-used-2.c (revision 338) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -O2" } */ + +static int xyzzy __attribute__((__used__)) = 1; + +void foo() +{ + int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */ +} + +/* { dg-final { scan-assembler "xyzzy" } } */
attr-used-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asmgoto-2.c =================================================================== --- asmgoto-2.c (nonexistent) +++ asmgoto-2.c (revision 338) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +foo (void) +{ + __label__ lab; + int i = 0; + asm goto ("" : : : : lab); + asm goto ("" : "=r" (i) : : : lab); /* { dg-error "expected" } */ + asm goto ("" : : : : ); /* { dg-error "expected" } */ + asm goto ("" : : : "memory"); /* { dg-error "expected" } */ + asm goto ("" : : : ); /* { dg-error "expected" } */ + asm goto ("" : : "r" (i)); /* { dg-error "expected" } */ + asm goto ("" : : ); /* { dg-error "expected" } */ + asm goto ("" : "=r" (i)); /* { dg-error "expected" } */ + asm goto ("" : ); /* { dg-error "expected" } */ + asm goto (""); /* { dg-error "expected" } */ + lab:; +}
asmgoto-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attr-used.c =================================================================== --- attr-used.c (nonexistent) +++ attr-used.c (revision 338) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +static void function_declaration_before(void) __attribute__((__used__)); + +static void function_declaration_before(void) {} + +static void function_declaration_after(void) {} + +static void function_declaration_after(void) __attribute__((__used__)); + +/* { dg-final { scan-assembler "function_declaration_before" } } */ +/* { dg-final { scan-assembler "function_declaration_after" } } */
attr-used.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asmgoto-3.c =================================================================== --- asmgoto-3.c (nonexistent) +++ asmgoto-3.c (revision 338) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +int foo () +{ + asm goto ("" : : : : label); + return 1; + label: + return 0; +}
asmgoto-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asmgoto-4.c =================================================================== --- asmgoto-4.c (nonexistent) +++ asmgoto-4.c (revision 338) @@ -0,0 +1,44 @@ +/* PR middle-end/44071 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +static inline int +f1 (void) +{ + asm goto ("" : : : : l1, l2); + __builtin_unreachable (); + l1: + return 1; + l2: + return 0; +} + +int +b1 (int x) +{ + if (f1 () || x == 6) + x = 1; + else + x = 2; + return x; +} + +static inline int +f2 (void) +{ + asm goto ("" : : : : l1, l2); + l1: + return 1; + l2: + return 0; +} + +int +b2 (int x) +{ + if (f2 () || x == 6) + x = 1; + else + x = 2; + return x; +}
asmgoto-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-10.c =================================================================== --- raw-string-10.c (nonexistent) +++ raw-string-10.c (revision 338) @@ -0,0 +1,20 @@ +// Test that we don't revert trigraphs and line splicing when a raw string +// literal is formed by token pasting. +// { dg-options "-std=gnu99 -trigraphs" { target c } } +// { dg-options "-std=c++0x" { target c++ } } +// { dg-do run } + +#define PASTE(X,Y) X##Y + +const char a[] = PASTE(R,"(??>\ +)"); + +#define TEST(str, val) \ + if (sizeof (str) != sizeof (val) \ + || __builtin_memcmp (str, val, sizeof (str)) != 0) \ + __builtin_abort () + +int main() +{ + TEST (a, "}"); +}
raw-string-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-offsetof.c =================================================================== --- builtin-offsetof.c (nonexistent) +++ builtin-offsetof.c (revision 338) @@ -0,0 +1,29 @@ +// Contributed by Dodji Seketeli +// Origin PR c++/38699 +// { dg-options "-Warray-bounds" } +// { dg-do compile } + +struct A +{ + const char *p; +}; + +struct B +{ + char p[10]; + struct A a; +}; + +void +f0 () +{ + __builtin_offsetof(struct A, p); // OK + __builtin_offsetof(struct A, p[0]); // { dg-error "non constant address" } + __builtin_offsetof(struct B, p[0]); // OK + __builtin_offsetof(struct B, p[9]); // OK + __builtin_offsetof(struct B, p[10]); // OK + __builtin_offsetof(struct B, p[11]); // { dg-warning "greater than size" } + __builtin_offsetof(struct B, a.p); // OK + __builtin_offsetof(struct B, p[0]); // OK + __builtin_offsetof(struct B, a.p[0]); // { dg-error "non constant address" } +}
builtin-offsetof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr36513-2.c =================================================================== --- pr36513-2.c (nonexistent) +++ pr36513-2.c (revision 338) @@ -0,0 +1,13 @@ +/* PR 36513: -Wlogical-op warns about strchr */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-op" } */ +#ifdef __cplusplus +#include +#else +#include +#endif +int main2 () +{ + char *s, t; + strchr (s, t); +}
pr36513-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr36513.c =================================================================== --- pr36513.c (nonexistent) +++ pr36513.c (revision 338) @@ -0,0 +1,15 @@ +/* PR 36513: -Wlogical-op warns about strchr */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-op" } */ + +extern void *__rawmemchr (const void *__s, int __c); +int main1 () +{ + char *s, t; + (__extension__ (__builtin_constant_p (t) + && !__builtin_constant_p (s) + && (t) == '\0' + ? (char *) __rawmemchr (s, t) + : __builtin_strchr (s, t))); +} +
pr36513.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mixed-add.c =================================================================== --- torture/complex-sign-mixed-add.c (nonexistent) +++ torture/complex-sign-mixed-add.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Mixed real/complex + addition. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, +, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, -, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, +, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, -, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, +, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, -, ZERO, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, +, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, -, ZERO, -, -); \ + } while (0) + +void +check_add_float (void) +{ + CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_add_double (void) +{ + CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_add_long_double (void) +{ + CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_add_float (); + check_add_double (); + check_add_long_double (); + exit (0); +}
torture/complex-sign-mixed-add.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mul-one.c =================================================================== --- torture/complex-sign-mul-one.c (nonexistent) +++ torture/complex-sign-mul-one.c (revision 338) @@ -0,0 +1,61 @@ +/* Test complex arithmetic with signed zeros. Pure complex + multiplication with 1.0 + 0.0i. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \ + do { \ + _Complex TYPE a1, b1, c1; \ + volatile _Complex TYPE a2, b2, c2; \ + a1 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a1, COPY, S1, S2); \ + b1 = ONE + ZEROI; \ + c1 = a1 * b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + c1 = a1 * (ONE + ZEROI); \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a2, COPY, S1, S2); \ + b2 = ONE + ZEROI; \ + c2 = a2 * b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + c2 = a2 * (ONE + ZEROI); \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0) + +#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \ + do { \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \ + } while (0) + +void +check_mul_float (void) +{ + CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f); +} + +void +check_mul_double (void) +{ + CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0); +} + +void +check_mul_long_double (void) +{ + CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l); +} + +int +main (void) +{ + check_mul_float (); + check_mul_double (); + check_mul_long_double (); + exit (0); +}
torture/complex-sign-mul-one.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mixed-sub.c =================================================================== --- torture/complex-sign-mixed-sub.c (nonexistent) +++ torture/complex-sign-mixed-sub.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Mixed real/complex + subtraction. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, +, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, -, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, +, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, -, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, +, ZERO, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, -, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, +, ZERO, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, -, ZERO, +, -); \ + } while (0) + +void +check_sub_float (void) +{ + CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_sub_double (void) +{ + CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_sub_long_double (void) +{ + CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_sub_float (); + check_sub_double (); + check_sub_long_double (); + exit (0); +}
torture/complex-sign-mixed-sub.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mul.c =================================================================== --- torture/complex-sign-mul.c (nonexistent) +++ torture/complex-sign-mul.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Pure complex + multiplication. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, -, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, +, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, +, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, -, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, -, +, +); \ + } while (0) + +void +check_mul_float (void) +{ + CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_mul_double (void) +{ + CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_mul_long_double (void) +{ + CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_mul_float (); + check_mul_double (); + check_mul_long_double (); + exit (0); +}
torture/complex-sign-mul.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mixed-mul.c =================================================================== --- torture/complex-sign-mixed-mul.c (nonexistent) +++ torture/complex-sign-mixed-mul.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Mixed real/complex + multiplication. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, -); \ + CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, +, ZERO, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, -, ZERO, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, +, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, -, ZERO, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, +, ZERO, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, -, ZERO, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, +, ZERO, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, -, ZERO, +, +); \ + } while (0) + +void +check_mul_float (void) +{ + CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_mul_double (void) +{ + CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_mul_long_double (void) +{ + CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_mul_float (); + check_mul_double (); + check_mul_long_double (); + exit (0); +}
torture/complex-sign-mixed-mul.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mul-minus-one.c =================================================================== --- torture/complex-sign-mul-minus-one.c (nonexistent) +++ torture/complex-sign-mul-minus-one.c (revision 338) @@ -0,0 +1,61 @@ +/* Test complex arithmetic with signed zeros. Pure complex + multiplication with -1.0 + 0.0i. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \ + do { \ + _Complex TYPE a1, b1, c1; \ + volatile _Complex TYPE a2, b2, c2; \ + a1 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a1, COPY, S1, S2); \ + b1 = -ONE + ZEROI; \ + c1 = a1 * b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + c1 = a1 * (-ONE + ZEROI); \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a2, COPY, S1, S2); \ + b2 = -ONE + ZEROI; \ + c2 = a2 * b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + c2 = a2 * (-ONE + ZEROI); \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0) + +#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \ + do { \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, -, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, +, -); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, +); \ + } while (0) + +void +check_mul_float (void) +{ + CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f); +} + +void +check_mul_double (void) +{ + CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0); +} + +void +check_mul_long_double (void) +{ + CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l); +} + +int +main (void) +{ + check_mul_float (); + check_mul_double (); + check_mul_long_double (); + exit (0); +}
torture/complex-sign-mul-minus-one.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-mixed-div.c =================================================================== --- torture/complex-sign-mixed-div.c (nonexistent) +++ torture/complex-sign-mixed-div.c (revision 338) @@ -0,0 +1,45 @@ +/* Test complex arithmetic with signed zeros. Mixed real/complex + division. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_DIV(TYPE, COPY, ZERO, ZEROI, ONE) \ + do { \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, +, ONE, +, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, -, ONE, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, +, ONE, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, -, ONE, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, +, ONE, -, +); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, -, ONE, +, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, +, ONE, -, -); \ + CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, -, ONE, +, +); \ + } while (0) + +void +check_div_float (void) +{ + CHECK_DIV (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f); +} + +void +check_div_double (void) +{ + CHECK_DIV (double, __builtin_copysign, 0.0, 0.0i, 1.0); +} + +void +check_div_long_double (void) +{ + CHECK_DIV (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l); +} + +int +main (void) +{ + check_div_float (); + check_div_double (); + check_div_long_double (); + exit (0); +}
torture/complex-sign-mixed-div.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign.h =================================================================== --- torture/complex-sign.h (nonexistent) +++ torture/complex-sign.h (revision 338) @@ -0,0 +1,80 @@ +/* Common header for complex arithmetic sign tests. */ + +#ifdef __cplusplus +extern "C" { +#endif +extern void abort (void); +extern void exit (int); +#ifdef __cplusplus +} +#endif + +#define CHECK_RES(VALUE, COPY, SIGN_REAL, SIGN_IMAG) \ + do { \ + if ((VALUE) != 0 \ + || COPY (1.0, __real__ (VALUE)) != SIGN_REAL 1.0 \ + || COPY (1.0, __imag__ (VALUE)) != SIGN_IMAG 1.0) \ + abort (); \ + } while (0) + +/* This definition is intended to work with or without imaginary + types, as long as mixed real/complex arithmetic is handled + correctly. */ +#define ENCODE(ZERO, ZEROI, SA, SB) \ + (SA 1 == 1 \ + ? SB 1 == 1 ? ZERO + ZEROI : ZERO - ZEROI \ + : SB 1 == 1 ? -(ZERO - ZEROI) : -(ZERO + ZEROI)) + +#define CHECK_ARITH(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, S4, SR, SI) \ + do { \ + _Complex TYPE a1, b1, c1; \ + volatile _Complex TYPE a2, b2, c2; \ + a1 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a1, COPY, S1, S2); \ + b1 = ENCODE(ZERO, ZEROI, S3, S4); \ + CHECK_RES (b1, COPY, S3, S4); \ + c1 = a1 OP b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a2, COPY, S1, S2); \ + b2 = ENCODE(ZERO, ZEROI, S3, S4); \ + CHECK_RES (b2, COPY, S3, S4); \ + c2 = a2 OP b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0) + +#define CHECK_ARITH_RC(TYPE, COPY, ZERO, ZEROI, OP, S1, S3, S4, SR, SI) \ + do { \ + TYPE a1; \ + _Complex TYPE b1, c1; \ + volatile TYPE a2; \ + volatile _Complex TYPE b2, c2; \ + a1 = S1 ZERO; \ + b1 = ENCODE(ZERO, ZEROI, S3, S4); \ + CHECK_RES (b1, COPY, S3, S4); \ + c1 = a1 OP b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = S1 ZERO; \ + b2 = ENCODE(ZERO, ZEROI, S3, S4); \ + CHECK_RES (b2, COPY, S3, S4); \ + c2 = a2 OP b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0) + +#define CHECK_ARITH_CR(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, V3, SR, SI) \ + do { \ + _Complex TYPE a1, c1; \ + TYPE b1; \ + volatile _Complex TYPE a2, c2; \ + volatile TYPE b2; \ + a1 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a1, COPY, S1, S2); \ + b1 = S3 V3; \ + c1 = a1 OP b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a2, COPY, S1, S2); \ + b2 = S3 V3; \ + c2 = a2 OP b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0)
torture/complex-sign.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-add.c =================================================================== --- torture/complex-sign-add.c (nonexistent) +++ torture/complex-sign-add.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Pure complex + addition. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, -, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, -, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, -, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, +, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -, -); \ + } while (0) + +void +check_add_float (void) +{ + CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_add_double (void) +{ + CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_add_long_double (void) +{ + CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_add_float (); + check_add_double (); + check_add_long_double (); + exit (0); +}
torture/complex-sign-add.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-alias-1.c =================================================================== --- torture/complex-alias-1.c (nonexistent) +++ torture/complex-alias-1.c (revision 338) @@ -0,0 +1,35 @@ +/* Accesses to complex numbers were sometimes marked as scalar and + sometimes as struct accesses. */ +/* { dg-do run } */ +/* { dg-options "-std=c99" { target c } } */ + +#ifdef __cplusplus +extern "C" { +#endif +extern void abort (void); +#ifdef __cplusplus +} +#endif +static double _Complex *fp_cxd(double _Complex *cx) { + return cx; +} + +int main( ) { + double _Complex cx = 4.0 + 3.0*(__extension__ 1.0iF); + double _Complex cx43 = 4.0 + 3.0*(__extension__ 1.0iF); + double _Complex cx11 = 1.0 + 1.0*(__extension__ 1.0iF); + + *fp_cxd(&cx) *= cx11; + *fp_cxd(&cx) /= cx11; + + double r_cx = __real__(cx); + double i_cx = __imag__(cx); + double r_cx43 = __real__(cx43); + double i_cx43 = __imag__(cx43); + + if( (r_cx == r_cx43) && (i_cx == i_cx43) ) { + return 0; + } else { + abort (); + } +}
torture/complex-alias-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: torture/complex-sign-sub.c =================================================================== --- torture/complex-sign-sub.c (nonexistent) +++ torture/complex-sign-sub.c (revision 338) @@ -0,0 +1,53 @@ +/* Test complex arithmetic with signed zeros. Pure complex + subtraction. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \ + do { \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, +, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, +, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, -, -, +); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +, -); \ + CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, -, +, +); \ + } while (0) + +void +check_sub_float (void) +{ + CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if); +} + +void +check_sub_double (void) +{ + CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i); +} + +void +check_sub_long_double (void) +{ + CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il); +} + +int +main (void) +{ + check_sub_float (); + check_sub_double (); + check_sub_long_double (); + exit (0); +}
torture/complex-sign-sub.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr43942.c =================================================================== --- pr43942.c (nonexistent) +++ pr43942.c (revision 338) @@ -0,0 +1,33 @@ +/* PR debug/43942 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +extern int f1 (int); + +int +f2 (int x) +{ + extern int v; + return f1 (x); +} + +void +f3 (void) +{ + f2 (0); +} + +static inline int +f4 (int x) +{ + extern int w; + if (w) + return f1 (x); + return 0; +} + +void +f5 (void) +{ + f4 (0); +}
pr43942.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr41935.c =================================================================== --- pr41935.c (nonexistent) +++ pr41935.c (revision 338) @@ -0,0 +1,70 @@ +/* { dg-options "-Warray-bounds" } */ +/* { dg-do compile } */ + +struct A +{ + int i; + char p[1]; +}; + +struct B +{ + struct A a; + int i; +}; + +struct C +{ + int i; + struct A a; +}; + +union D +{ + char p[1]; + struct A a; + struct B b; + struct C c; +}; + +struct E +{ + int i; + union D d; +}; + +struct F +{ + union D d; + int i; +}; + +union G +{ + int i; + union D d; +}; + +void +f0 () +{ + __builtin_offsetof (struct A, p[4]); /* OK */ + __builtin_offsetof (struct B, a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (struct C, a.p[4]); /* OK */ + __builtin_offsetof (union D, p[4]); /* OK */ + __builtin_offsetof (union D, a.p[4]); /* OK */ + __builtin_offsetof (union D, b.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (union D, c.a.p[4]); /* OK */ + __builtin_offsetof (struct E, d.p[4]); /* OK */ + __builtin_offsetof (struct E, d.a.p[4]); /* OK */ + __builtin_offsetof (struct E, d.b.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (struct E, d.c.a.p[4]); /* OK */ + __builtin_offsetof (struct F, d.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (struct F, d.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (struct F, d.b.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (struct F, d.c.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (union G, d.p[4]); /* OK */ + __builtin_offsetof (union G, d.a.p[4]); /* OK */ + __builtin_offsetof (union G, d.b.a.p[4]); /* { dg-warning "greater than size" } */ + __builtin_offsetof (union G, d.c.a.p[4]); /* OK */ +}
pr41935.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr42674.c =================================================================== --- pr42674.c (nonexistent) +++ pr42674.c (revision 338) @@ -0,0 +1,13 @@ +/* PR middle-end/42674 */ +/* { dg-do compile } */ +/* { dg-options "-Wreturn-type" } */ + +extern void bar (void); +static int foo (void) __attribute__ ((__noreturn__, __used__)); + +static int +foo (void) +{ + while (1) + bar (); +}
pr42674.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-array.c =================================================================== --- dfp/func-array.c (nonexistent) +++ dfp/func-array.c (revision 338) @@ -0,0 +1,157 @@ +/* C99 6.5.2.2 Function calls. + Test passing array elements involving decimal floating point types. */ + +#include "dfp-dbg.h" + +/* A handful of functions that return the Nth _Decimal32 argument of + an incoming array. */ + +_Decimal32 +arg0_32 (_Decimal32 args[]) +{ + return args[0]; +} + +_Decimal32 +arg1_32 (_Decimal32 args[]) +{ + return args[1]; +} + +_Decimal32 +arg2_32 (_Decimal32 args[]) +{ + return args[2]; +} + +_Decimal32 +arg3_32 (_Decimal32 args[]) +{ + return args[3]; +} + +_Decimal32 +arg4_32 (_Decimal32 args[]) +{ + return args[4]; +} + +_Decimal32 +arg5_32 (_Decimal32 args[]) +{ + return args[5]; +} + + +/* A handful of functions that return the Nth _Decimal64 argument of + an incoming array. */ + +_Decimal64 +arg0_64 (_Decimal64 args[]) +{ + return args[0]; +} + +_Decimal64 +arg1_64 (_Decimal64 args[]) +{ + return args[1]; +} + +_Decimal64 +arg2_64 (_Decimal64 args[]) +{ + return args[2]; +} + +_Decimal64 +arg3_64 (_Decimal64 args[]) +{ + return args[3]; +} + +_Decimal64 +arg4_64 (_Decimal64 args[]) +{ + return args[4]; +} + +_Decimal64 +arg5_64 (_Decimal64 args[]) +{ + return args[5]; +} + + +/* A handful of functions that return the Nth _Decimal128 argument of + an incoming array. */ + +_Decimal128 +arg0_128 (_Decimal128 args[]) +{ + return args[0]; +} + +_Decimal128 +arg1_128 (_Decimal128 args[]) +{ + return args[1]; +} + +_Decimal128 +arg2_128 (_Decimal128 args[]) +{ + return args[2]; +} + +_Decimal128 +arg3_128 (_Decimal128 args[]) +{ + return args[3]; +} + +_Decimal128 +arg4_128 (_Decimal128 args[]) +{ + return args[4]; +} + +_Decimal128 +arg5_128 (_Decimal128 args[]) +{ + return args[5]; +} + + +int main() +{ + _Decimal32 d32[] = { 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df }; + _Decimal64 d64[] = { 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd }; + _Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl }; + + /* _Decimal32 variants. */ + if (arg0_32 (d32) != 0.0df) FAILURE + if (arg1_32 (d32) != 1.0df) FAILURE + if (arg2_32 (d32) != 2.0df) FAILURE + if (arg3_32 (d32) != 3.0df) FAILURE + if (arg4_32 (d32) != 4.0df) FAILURE + if (arg5_32 (d32) != 5.0df) FAILURE + + /* _Decimal64 variants. */ + if (arg0_64 (d64) != 0.0dd) FAILURE + if (arg1_64 (d64) != 1.0dd) FAILURE + if (arg2_64 (d64) != 2.0dd) FAILURE + if (arg3_64 (d64) != 3.0dd) FAILURE + if (arg4_64 (d64) != 4.0dd) FAILURE + if (arg5_64 (d64) != 5.0dd) FAILURE + + /* _Decimal128 variants. */ + if (arg0_128 (d128) != 0.0dl) FAILURE + if (arg1_128 (d128) != 1.0dl) FAILURE + if (arg2_128 (d128) != 2.0dl) FAILURE + if (arg3_128 (d128) != 3.0dl) FAILURE + if (arg4_128 (d128) != 4.0dl) FAILURE + if (arg5_128 (d128) != 5.0dl) FAILURE + + FINISH +}
dfp/func-array.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-dfp-fold.c =================================================================== --- dfp/convert-dfp-fold.c (nonexistent) +++ dfp/convert-dfp-fold.c (revision 338) @@ -0,0 +1,47 @@ +/* { dg-options "-O2" } */ + +/* N1150 5.2 Conversions among decimal floating types and between + decimal floating types and generic floating types. + C99 6.3.1.5(3) New. */ + +#include "dfp-dbg.h" + +extern void link_error (); + +int +main () +{ + _Decimal32 d32; + _Decimal64 d64; + _Decimal128 d128; + + /* Conversions to larger types. */ + d32 = 123.4df; + d64 = d32; + if (d64 != 123.4dd) + link_error (); + d128 = d32; + if (d128 != 123.4dl) + link_error (); + d64 = 345.678dd; + d128 = d64; + if (d128 != 345.678dl) + link_error (); + + /* Conversions to smaller types for which the value fits. */ + d64 = 3456.789dd; + d32 = d64; + if (d32 != 3456.789df) + link_error (); + d128 = 123.4567dl; + d32 = d128; + if (d32 != 123.4567dl) + link_error (); + + d128 = 1234567890.123456dl; + d64 = d128; + if (d64 != 1234567890.123456dd) + link_error (); + + return 0; +}
dfp/convert-dfp-fold.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-pointer.c =================================================================== --- dfp/func-pointer.c (nonexistent) +++ dfp/func-pointer.c (revision 338) @@ -0,0 +1,205 @@ +/* C99 6.5.2.2 Function calls. + Test pointer argument passing and return values involving decimal floating + point types. */ + +#include "dfp-dbg.h" + +/* A handful of functions that return their Nth pointer to Decimal32 + argument. */ + +_Decimal32 * +arg0_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg0; +} + +_Decimal32 * +arg1_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg1; +} + +_Decimal32 * +arg2_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg2; +} + +_Decimal32 * +arg3_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg3; +} + +_Decimal32 * +arg4_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg4; +} + +_Decimal32 * +arg5_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2, + _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth pointer to _Decimal64 + argument. */ + +_Decimal64 * +arg0_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg0; +} + +_Decimal64 * +arg1_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg1; +} + +_Decimal64 * +arg2_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg2; +} + +_Decimal64 * +arg3_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg3; +} + +_Decimal64 * +arg4_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg4; +} + +_Decimal64 * +arg5_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2, + _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth _Decimal128 + argument. */ + +_Decimal128 * +arg0_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg0; +} + +_Decimal128 * +arg1_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg1; +} + +_Decimal128 * +arg2_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg2; +} + +_Decimal128 * +arg3_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg3; +} + +_Decimal128 * +arg4_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg4; +} + +_Decimal128 * +arg5_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2, + _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5) +{ + return arg5; +} + + + +_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df, + df3 = 3.0df, df4 = 4.0df, df5 = 5.0df; +_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2, + *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5; +_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd, + dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd; +_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2, + *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5; +_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl, + dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl; +_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2, + *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5; + +int +main () +{ + /* _Decimal32 variants. */ + if (*arg0_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 0.0df) + FAILURE + if (*arg1_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 1.0df) + FAILURE + if (*arg2_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 2.0df) + FAILURE + if (*arg3_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 3.0df) + FAILURE + if (*arg4_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 4.0df) + FAILURE + if (*arg5_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 5.0df) + FAILURE + + /* _Decimal64 variants. */ + if (*arg0_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 0.0dd) + FAILURE + if (*arg1_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 1.0dd) + FAILURE + if (*arg2_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 2.0dd) + FAILURE + if (*arg3_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 3.0dd) + FAILURE + if (*arg4_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 4.0dd) + FAILURE + if (*arg5_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 5.0dd) + FAILURE + + /* _Decimal128 variants. */ + if (*arg0_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 0.0dl) + FAILURE + if (*arg1_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 1.0dl) + FAILURE + if (*arg2_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 2.0dl) + FAILURE + if (*arg3_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 3.0dl) + FAILURE + if (*arg4_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 4.0dl) + FAILURE + if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl) + FAILURE + + FINISH +}
dfp/func-pointer.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/inf-1.c =================================================================== --- dfp/inf-1.c (nonexistent) +++ dfp/inf-1.c (revision 338) @@ -0,0 +1,61 @@ +/* N1150 4: Characteristics of decimal floating types (not explicit) + C99 5.2.4.2.2: Characteristics of floating types. + A few simple checks on arithmetic operations. */ + +#include "dfp-dbg.h" + +int main() +{ + /* Assumes rounding mode. */ + if (9999999.E90DF + 1.E90df != __builtin_infd32 ()) + FAILURE + + if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df)) + FAILURE + + if (9.999999999999999E384dd + .000000000000001e384dd + != __builtin_infd32 ()) + FAILURE + + if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ()) + FAILURE + + if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd)) + FAILURE + + if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl + != __builtin_infd32 ()) + FAILURE + + if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ()) + FAILURE + + if (__builtin_infd32 () * 2 != __builtin_infd32 ()) + FAILURE + + if (__builtin_infd64 () * -5 != -__builtin_infd32 ()) + FAILURE + + if (!__builtin_isinfd128 (__builtin_infd32 () / 4)) + FAILURE + + if (__builtin_infd64 () != __builtin_infd128 ()) + FAILURE + + if (!__builtin_isinfd64 (__builtin_infd128 ())) + FAILURE + + if (__builtin_finited64 (__builtin_infd32 () * 4)) + FAILURE + + if (!__builtin_finited128 (9.999999E90DL - 1.E90dd)) + FAILURE + + if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ())) + FAILURE + + if (__builtin_finited32 (__builtin_nand32 (""))) + FAILURE + + FINISH +}
dfp/inf-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel.h =================================================================== --- dfp/compare-rel.h (nonexistent) +++ dfp/compare-rel.h (revision 338) @@ -0,0 +1,132 @@ +/* Basic test of runtime relational comparisons using simple values that + are not affected by rounding. */ + +#include +#include "dfp-dbg.h" + +#undef FAILURE +#ifdef DBG +#define FAILURE(OP,KIND) \ + { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ + failures++; } +#else +#define FAILURE(OP,KIND) __builtin_abort (); +#endif + +#define PASTE2(A,B) A ## B +#define PASTE(A,B) PASTE2(A,B) + +#ifndef WIDTH +#error define WIDTH as decimal float size in bytes +#endif + +#if WIDTH == 32 +#define DTYPE _Decimal32 +#define SUFFIX DF +#elif WIDTH == 64 +#define DTYPE _Decimal64 +#define SUFFIX DD +#elif WIDTH == 128 +#define DTYPE _Decimal128 +#define SUFFIX DL +#elif WIDTH == 0 +/* This is for testing the test using a type known to work. */ +#define DTYPE double +#define SUFFIX +#else +#error invalid width for decimal float type +#endif + +DTYPE m_two = PASTE(-2.0, SUFFIX); +DTYPE m_one = PASTE(-1.0, SUFFIX); +DTYPE zero = PASTE(0.0, SUFFIX); +DTYPE one = PASTE(1.0, SUFFIX); +DTYPE two = PASTE(2.0, SUFFIX); + +void +test_compares (void) +{ + DTYPE x = one; + DTYPE y = zero; + DTYPE z = m_one; + + /* Less than or equal to: comparisons against equal values. */ + + if (! (x <= one)) FAILURE ("<=", "equal") + if (! (y <= zero)) FAILURE ("<=", "equal") + if (! (z <= m_one)) FAILURE ("<=", "equal") + + /* Less than or equal to: comparisons against lesser values. */ + + if (x <= m_one) FAILURE ("<=", "lesser") + if (x <= zero) FAILURE ("<=", "lesser") + if (y <= m_one) FAILURE ("<=", "lesser") + if (z <= m_two) FAILURE ("<=", "lesser") + + /* Less than or equal to: comparisons against greater values. */ + + if (! (x <= two)) FAILURE ("<=", "greater") + if (! (y <= one)) FAILURE ("<=", "greater") + if (! (z <= zero)) FAILURE ("<=", "greater") + if (! (z <= one)) FAILURE ("<=", "greater") + + /* Less than: comparisons against equal values. */ + + if (x < one) FAILURE ("<", "equal") + if (y < zero) FAILURE ("<", "equal") + if (z < m_one) FAILURE ("<", "equal") + + /* Less than: comparisons against lesser values. */ + + if (x < m_one) FAILURE ("<", "lesser") + if (x < zero) FAILURE ("<", "lesser") + if (y < m_one) FAILURE ("<", "lesser") + if (z < m_two) FAILURE ("<", "lesser") + + /* Less than: comparisons against greater values. */ + + if (! (x < two)) FAILURE ("<", "greater") + if (! (y < one)) FAILURE ("<", "greater") + if (! (z < zero)) FAILURE ("<", "greater") + if (! (z < one)) FAILURE ("<", "greater") + + /* Greater than or equal to: comparisons against equal values. */ + + if (! (x >= one)) FAILURE (">=", "equal") + if (! (y >= zero)) FAILURE (">=", "equal") + if (! (z >= m_one)) FAILURE (">=", "equal") + + /* Greater than or equal to: comparisons against lesser values. */ + + if (! (x >= m_one)) FAILURE (">=", "lesser") + if (! (x >= zero)) FAILURE (">=", "lesser") + if (! (y >= m_one)) FAILURE (">=", "lesser") + if (! (z >= m_two)) FAILURE (">=", "lesser") + + /* Greater than or equal to: comparisons against greater values. */ + + if (x >= two) FAILURE (">=", "greater") + if (y >= one) FAILURE (">=", "greater") + if (z >= zero) FAILURE (">=", "greater") + if (z >= one) FAILURE (">=", "greater") + + /* Greater than: comparisons against equal values. */ + + if (x > one) FAILURE (">", "equal") + if (y > zero) FAILURE (">", "equal") + if (z > m_one) FAILURE (">", "equal") + + /* Greater than: comparisons against lesser values. */ + + if (! (x > m_one)) FAILURE (">", "lesser") + if (! (x > zero)) FAILURE (">", "lesser") + if (! (y > m_one)) FAILURE (">", "lesser") + if (! (z > m_two)) FAILURE (">", "lesser") + + /* Greater than: comparisons against greater values. */ + + if (x > two) FAILURE (">", "greater") + if (y > one) FAILURE (">", "greater") + if (z > zero) FAILURE (">", "greater") + if (z > one) FAILURE (">", "greater") +}
dfp/compare-rel.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-int-max-fold.c =================================================================== --- dfp/convert-int-max-fold.c (nonexistent) +++ dfp/convert-int-max-fold.c (revision 338) @@ -0,0 +1,148 @@ +/* { dg-options "-O2 -w" } */ + +/* N1150 5.1 Conversions from decimal float to integer. */ + +/* Test decimal float to integer conversions for values at the limit of + what will fit into the destination type. This assumes 32-bit int and + 64-bit long long (there's a check for that below). This version tests + conversions during compilation. */ + +#include "dfp-dbg.h" + +extern void link_error (void); + +void +doit () +{ + _Decimal32 d32; + _Decimal64 d64; + _Decimal128 d128; + int si; + unsigned int ui; + long long sll; + unsigned long long ull; + + /* _Decimal32 to int. */ + + d32 = 2147483.E3DF; + si = d32; + if (si != 2147483000) + link_error (); + + d32 = -2147483.E3DF; + si = d32; + if (si != -2147483000) + link_error (); + + /* _Decimal32 to unsigned int. */ + + d32 = 4.294967E9DF; + ui = d32; + if (ui != 4294967000U) + link_error (); + + /* _Decimal32 to long long. */ + + d32 = 922.3372E16DF; + sll = d32; + if (sll != 9223372000000000000LL) + link_error (); + + d32 = -92233.72E14DF; + sll = d32; + if (sll != -9223372000000000000LL) + link_error (); + + /* _Decimal32 to unsigned long long. */ + + d32 = 0.1844674E20DF; + ull = d32; + if (ull != 18446740000000000000ULL) + link_error (); + + /* _Decimal64 to int. */ + + d64 = 2.147483647E9DD; + si = d64; + if (si != 2147483647) + link_error (); + + d64 = -2147483648.DD; + si = d64; + if (si != -2147483648) + link_error (); + + /* _Decimal64 to unsigned int. */ + + d64 = 42949.67295E5DD; + ui = d64; + if (ui != 4294967295) + link_error (); + + /* _Decimal64 to long long. */ + + d64 = 9.223372036854775E18DD; + sll = d64; + if (sll != 9223372036854775000LL) + link_error (); + + d64 = -92233720.36854775E11DD; + sll = d64; + if (sll != -9223372036854775000LL) + link_error (); + + /* _Decimal64 to unsigned long long. */ + d64 = 1844674407370955.E4DD; + ull = d64; + if (ull != 18446744073709550000ULL) + link_error (); + + /* _Decimal128 to int. */ + + d128 = 2.147483647E9DL; + si = d128; + if (si != 2147483647) + link_error (); + + d128 = -2147483648.DL; + si = d128; + if (si != -2147483648) + link_error (); + + /* _Decimal128 to unsigned int. */ + + d128 = 4294.967295E6DL; + ui = d128; + if (ui != 4294967295) + link_error (); + + /* _Decimal128 to long long. */ + + d128 = 9223372036854775807.DL; + sll = d128; + if (sll != 9223372036854775807LL) + link_error (); + + d128 = -9.223372036854775808E19DL; + sll = d128; + if (sll != -9223372036854775807LL - 1LL) + link_error (); + + /* _Decimal128 to unsigned long long. */ + d128 = 18446744073709551615.DL; + ull = d128; + if (ull != 18446744073709551615ULL) + link_error (); +} + +int +main () +{ + /* This test assumes 32-bit int and 64-bit long long. */ + + if (sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + doit (); + return 0; +}
dfp/convert-int-max-fold.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-struct.c =================================================================== --- dfp/func-struct.c (nonexistent) +++ dfp/func-struct.c (revision 338) @@ -0,0 +1,93 @@ +/* C99 6.5.2.2 Function calls. + Test structure passing and return values involving decimal floating + point types. */ + +#include "dfp-dbg.h" + +struct example +{ + _Decimal128 d128; + char dummy1; + _Decimal64 d64; + char dummy2; + _Decimal32 d32; +} nums = { 1.0dl, 'a', 2.0dd, 'b', 3.0df }; + +_Decimal32 +d32_field (struct example s) +{ + return s.d32; +} + +_Decimal64 +d64_field (struct example s) +{ + return s.d64; +} + +_Decimal128 +d128_field (struct example s) +{ + return s.d128; +} + +char +dummy1_field (struct example s) +{ + return s.dummy1; +} + +char +dummy2_field (struct example s) +{ + return s.dummy2; +} + +_Decimal32 +ptr_d32_field (struct example *s) +{ + return s->d32; +} + +_Decimal64 +ptr_d64_field (struct example *s) +{ + return s->d64; +} + +_Decimal128 +ptr_d128_field (struct example *s) +{ + return s->d128; +} + +char +ptr_dummy1_field (struct example *s) +{ + return s->dummy1; +} + +char +ptr_dummy2_field (struct example *s) +{ + return s->dummy2; +} + + +int +main () +{ + if (d32_field (nums) != 3.0df) FAILURE + if (d64_field (nums) != 2.0dd) FAILURE + if (d128_field (nums) != 1.0dl) FAILURE + if (dummy1_field (nums) != 'a') FAILURE + if (dummy2_field (nums) != 'b') FAILURE + + if (ptr_d32_field (&nums) != 3.0df) FAILURE + if (ptr_d64_field (&nums) != 2.0dd) FAILURE + if (ptr_d128_field (&nums) != 1.0dl) FAILURE + if (ptr_dummy1_field (&nums) != 'a') FAILURE + if (ptr_dummy2_field (&nums) != 'b') FAILURE + + FINISH +}
dfp/func-struct.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq-d32.c =================================================================== --- dfp/compare-eq-d32.c (nonexistent) +++ dfp/compare-eq-d32.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.9 Equality operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 32 +#include "compare-eq.h" + +int main () +{ + test_compares (); + + FINISH +}
dfp/compare-eq-d32.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-mixed.c =================================================================== --- dfp/func-vararg-mixed.c (nonexistent) +++ dfp/func-vararg-mixed.c (revision 338) @@ -0,0 +1,102 @@ +/* C99 6.5.2.2 Function calls. + Test passing varargs of the combination of decimal float types and + other types. */ + +#include +#include "dfp-dbg.h" + +/* Supposing the list of varying number of arguments is: + unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */ + +static _Decimal32 +vararg_d32 (unsigned arg, ...) +{ + va_list ap; + _Decimal32 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + result = va_arg (ap, _Decimal32); + + va_end (ap); + return result; +} + +static _Decimal32 +vararg_d64 (unsigned arg, ...) +{ + va_list ap; + _Decimal64 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + va_arg (ap, _Decimal32); + result = va_arg (ap, _Decimal64); + + va_end (ap); + return result; +} + +static _Decimal128 +vararg_d128 (unsigned arg, ...) +{ + va_list ap; + _Decimal128 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + result = va_arg (ap, _Decimal128); + + va_end (ap); + return result; +} + +static unsigned int +vararg_int (unsigned arg, ...) +{ + va_list ap; + unsigned int result; + + va_start (ap, arg); + + result = va_arg (ap, unsigned int); + + va_end (ap); + return result; +} + +static double +vararg_double (unsigned arg, ...) +{ + va_list ap; + float result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + result = va_arg (ap, double); + + va_end (ap); + return result; +} + + +int +main () +{ + if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE + if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE + if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE + if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE + if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE + + FINISH +}
dfp/func-vararg-mixed.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-special-d128.c =================================================================== --- dfp/compare-special-d128.c (nonexistent) +++ dfp/compare-special-d128.c (revision 338) @@ -0,0 +1,15 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + C99 6.5.9 Equality operators. + Compare decimal float special values at runtime. */ + +#define WIDTH 128 +#include "compare-special.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-special-d128.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr35620.c =================================================================== --- dfp/pr35620.c (nonexistent) +++ dfp/pr35620.c (revision 338) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#ifdef __cplusplus +typedef float _Decimal32 __attribute__((mode(SD))); +#endif + +extern void foo (_Decimal32); +_Decimal32 *p; + +extern int i; +union U { _Decimal32 a; int b; } u; + +void +blatz (void) +{ + _Decimal32 d; + u.b = i; + d = u.a; + foo (d); +} + +void +bar (void) +{ + foo (*p); +}
dfp/pr35620.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel-d128.c =================================================================== --- dfp/compare-rel-d128.c (nonexistent) +++ dfp/compare-rel-d128.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 128 +#include "compare-rel.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-rel-d128.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr31385.c =================================================================== --- dfp/pr31385.c (nonexistent) +++ dfp/pr31385.c (revision 338) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef float fp_t __attribute__((mode(SD))); + +extern fp_t g(fp_t); + +fp_t +bug(fp_t x) +{ + fp_t result; + int n; + fp_t f, f3, y, z; + + n = 0; + y = 1.DF; + f = g(x); + + if (f < 0.DF) + f = -f; + + f3 = 2.DF; + + z = (y + y + f / (y * y)); + y = (z + z) / (9.DF) + f3 / (z * z); + + result = y; + + return (result); +}
dfp/pr31385.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-comma.c =================================================================== --- dfp/operator-comma.c (nonexistent) +++ dfp/operator-comma.c (revision 338) @@ -0,0 +1,47 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.17: Comma operator. + Test with decimal float operands. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 d32a, d32b, d32c; +volatile _Decimal64 d64a, d64b, d64c; +volatile _Decimal128 d128a, d128b, d128c; + +void +init () +{ + d32b = 123.456e94df; + d64b = 12.3456789012345e383dd; + d128b = 12345.6789012345678901e4000dl; + + d32c = 1.3df; + d64c = 1.2dd; + d128c = 1.1dl; +} + +int +main () +{ + d32a = (d32b, d32c); + if (d32a != d32c) + FAILURE + d64a = (d64b, 7.89dd, d64c); + if (d64a != d64c) + FAILURE + d128a = (45678.987654dl, d128c, d128b); + if (d128a != d128b) + FAILURE + d128a = (d32b, d64b, d128b); + if (d128a != d128b) + FAILURE + d32a = (d32b, 12, d64c); + if (d32a != d64c) + FAILURE; + d64a = (d64b, d32b, 12); + if (d64a != 12.0dd) + FAILURE; + + FINISH +}
dfp/operator-comma.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-alternate.h =================================================================== --- dfp/func-vararg-alternate.h (nonexistent) +++ dfp/func-vararg-alternate.h (revision 338) @@ -0,0 +1,143 @@ +/* Simple test of vararg passing for problematic types with and without + double values passed between them. */ + +#include "dfp-dbg.h" +#include + +DTYPE a[10]; +double b[10]; + +union U { + DTYPE d; + unsigned int i[INTS]; +}; + +void +compare (double r, double s, unsigned int *p, unsigned int *q, int n, int line) +{ + int i; + + for (i = 0; i < n; i++) + if (r != s || p[i] != q[i]) +#ifdef DBG + { + int j; + + failures++; + printf ("line %-3d", line); + for (j = 0; j < n; j++) + printf (" %08x", p[j]); + printf (" %10.2g\n ", r); + for (j = 0; j < n; j++) + printf (" %08x", q[j]); + printf (" %10.2g\n\n", s); + + return; + } +#else + __builtin_abort (); +#endif +} + +void +bar0 (int n, ...) +{ + union U u; + int j; + va_list ap; + + va_start (ap, n); + for (j = 0; j < n; j++) + a[j] = va_arg (ap, DTYPE); + va_end (ap); +} + +void +bar1 (int n, ...) +{ + union U u; + int j; + va_list ap; + + va_start (ap, n); + for (j = 0; j < n; j++) + { + a[j] = va_arg (ap, DTYPE); + b[j] = va_arg (ap, double); + } + va_end (ap); +} + +void +bar2 (int n, ...) +{ + union U u; + int j; + va_list ap; + + va_start (ap, n); + for (j = 0; j < n; j++) + { + b[j] = va_arg (ap, double); + a[j] = va_arg (ap, DTYPE); + } + va_end (ap); +} + +void +doit () +{ + DTYPE x, y, z; + union U u1, u2; + + /* Sanity check that test setup is right, especially for long double + which can be changed by command line option. */ + if (INTS * 4 != sizeof (DTYPE)) + { +#ifdef DBG + printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n", + INTS, sizeof (DTYPE)); +#endif + __builtin_abort (); + } + + x = ONE / THREE; + y = ONE / SEVEN; + z = ONE / ELEVEN; + + bar0 (1, x); + u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + + bar0 (2, x, y); + u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + + bar0 (3, x, y, z); + u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + u1.d = z; u2.d = a[2]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__); + + bar1 (1, x, 1.5); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + + bar1 (2, x, 1.5, y, 2.5); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__); + + bar1 (3, x, 1.5, y, 2.5, z, 3.5); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__); + u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__); + + bar2 (1, 1.5, x); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + + bar2 (2, 1.5, x, 2.5, y); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__); + + bar2 (3, 1.5, x, 2.5, y, 3.5, z); + u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); + u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__); + u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__); +}
dfp/func-vararg-alternate.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-mixed.c =================================================================== --- dfp/func-mixed.c (nonexistent) +++ dfp/func-mixed.c (revision 338) @@ -0,0 +1,174 @@ +/* { dg-options "-Wall" } */ + +/* C99 6.5.2.2 Function calls. + Test scalar passing and return values involving decimal floating + point types. */ + +#include "dfp-dbg.h" + +/* A handful of functions that return their Nth _Decimal32 + argument with mixed types in parameter list. */ + +_Decimal32 +arg0_32 (_Decimal32 arg0, int arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg0; +} + +_Decimal32 +arg1_32 (int arg0, _Decimal32 arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg1; +} + +_Decimal32 +arg2_32 (int arg0, unsigned int arg1, _Decimal32 arg2, + float arg3, double arg4, long double arg5) +{ + return arg2; +} + + +_Decimal32 +arg3_32 (int arg0, unsigned int arg1, float arg2, + _Decimal32 arg3, double arg4, long double arg5) +{ + return arg3; +} + +_Decimal32 +arg4_32 (int arg0, unsigned int arg1, float arg2, + double arg3, _Decimal32 arg4, long double arg5) +{ + return arg4; +} + +_Decimal32 +arg5_32 (int arg0, unsigned int arg1, float arg2, + double arg3, long double arg4, _Decimal32 arg5) +{ + return arg5; +} + +/* A handful of functions that return their Nth _Decimal64 + argument with mixed types in parameter list. */ + +_Decimal64 +arg0_64 (_Decimal64 arg0, int arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg0; +} + +_Decimal64 +arg1_64 (int arg0, _Decimal64 arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg1; +} + +_Decimal64 +arg2_64 (int arg0, unsigned int arg1, _Decimal64 arg2, + float arg3, double arg4, long double arg5) +{ + return arg2; +} + +_Decimal64 +arg3_64 (int arg0, unsigned int arg1, float arg2, + _Decimal64 arg3, double arg4, long double arg5) +{ + return arg3; +} + +_Decimal64 +arg4_64 (int arg0, unsigned int arg1, float arg2, + float arg3, _Decimal64 arg4, long double arg5) +{ + return arg4; +} + +_Decimal64 +arg5_64 (int arg0, unsigned int arg1, float arg2, + double arg3, long double arg4, _Decimal64 arg5) +{ + return arg5; +} + +/* A handful of functions that return their Nth _Decimal128 + argument with mixed types in parameter list. */ + +_Decimal128 +arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg0; +} +_Decimal128 +arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2, + float arg3, double arg4, long double arg5) +{ + return arg1; +} + +_Decimal128 +arg2_128 (int arg0, unsigned int arg1, _Decimal128 arg2, + float arg3, double arg4, long double arg5) +{ + return arg2; +} + +_Decimal128 +arg3_128 (int arg0, unsigned int arg1, float arg2, + _Decimal128 arg3, double arg4, long double arg5) +{ + return arg3; +} + +_Decimal128 +arg4_128 (int arg0, unsigned int arg1, float arg2, + float arg3, _Decimal32 arg4, long double arg5) +{ + return arg4; +} + +_Decimal128 +arg5_128 (int arg0, unsigned int arg1, float arg2, + double arg3, long double arg4, _Decimal128 arg5) +{ + return arg5; +} + + + +int +main () +{ + /* _Decimal32 variants. */ + if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) FAILURE + if (arg1_32 (0, 1.0df, 2, 3.0f, 4.0, 5.0l) != 1.0df) FAILURE + if (arg2_32 (0, -1, 2.0df, 3.0f, 4.0, 5.0l) != 2.0df) FAILURE + if (arg3_32 (0, -1, 2.0f, 3.0df, 4.0, 5.0l) != 3.0df) FAILURE + if (arg4_32 (0, -1, 2.0f, 3.0, 4.0df, 5.0l) != 4.0df) FAILURE + if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) FAILURE + + /* _Decimal64 variants. */ + if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) FAILURE + if (arg1_64 (0, 1.0dd, 2, 3.0f, 4.0, 5.0l) != 1.0dd) FAILURE + if (arg2_64 (0, -1, 2.0dd, 3.0f, 4.0, 5.0l) != 2.0dd) FAILURE + if (arg3_64 (0, -1, 2.0f, 3.0dd, 4.0, 5.0l) != 3.0dd) FAILURE + if (arg4_64 (0, -1, 2.0f, 3.0, 4.0dd, 5.0l) != 4.0dd) FAILURE + if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) FAILURE + + /* _Decimal128 variants. */ + if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) FAILURE + if (arg1_128 (0, 1.0dl, 2, 3.0f, 4.0, 5.0l) != 1.0dl) FAILURE + if (arg2_128 (0, -1, 2.0dl, 3.0f, 4.0, 5.0l) != 2.0dl) FAILURE + if (arg3_128 (0, -1, 2.0f, 3.0dl, 4.0, 5.0l) != 3.0dl) FAILURE + if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE + if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE + + FINISH +}
dfp/func-mixed.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-special-d64.c =================================================================== --- dfp/compare-special-d64.c (nonexistent) +++ dfp/compare-special-d64.c (revision 338) @@ -0,0 +1,15 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + C99 6.5.9 Equality operators. + Compare decimal float special values at runtime. */ + +#define WIDTH 64 +#include "compare-special.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-special-d64.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq-dfp.c =================================================================== --- dfp/compare-eq-dfp.c (nonexistent) +++ dfp/compare-eq-dfp.c (revision 338) @@ -0,0 +1,53 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.9 Equality operators. + Compare decimal float values against variables of different types. */ + +#include "dfp-dbg.h" + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; + +/* Use some typedefs of decimal float types, too. */ +typedef _Decimal32 SDtype; +typedef _Decimal64 DDtype; +typedef _Decimal128 TDtype; + +SDtype d32b; +DDtype d64b; +TDtype d128b; + +void +inits (void) +{ + d32 = 1.0df; + d64 = 3.0dd; + d128 = 5.0dl; + d32b = -1.0df; + d64b = -4.0dd; + d128b = -6.0dl; +} + +void +compare_dfp (void) +{ + if ((d32 == d64) != 0) FAILURE + if ((d32 != d128b) != 1) FAILURE + + if ((d64 != d32) != 1) FAILURE + if ((d64 == d128) != 0) FAILURE + + if ((d128 != d32) != 1) FAILURE + if ((d128 == d64) != 0) FAILURE +} + +int +main () +{ + inits (); + + compare_dfp (); + + FINISH +}
dfp/compare-eq-dfp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-assignment.c =================================================================== --- dfp/operator-assignment.c (nonexistent) +++ dfp/operator-assignment.c (revision 338) @@ -0,0 +1,56 @@ +/* C99 6.5.16 Assignment operators. + Verify the compound assignment operator for decimal float types, + using it with other decimal float types, integers, and other binary + float types cast to decimal float types. */ + +#include "dfp-dbg.h" + +#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ + if (( OPRD1 OPRT OPRD2 )!= RLT) \ + FAILURE + +#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \ +{ \ + _Decimal##TYPE d = OPRD; \ + OPERATE(d,+=,1,(OPRD + 1)); \ + d = OPRD; \ + OPERATE(d,+=,0,OPRD); \ + d = OPRD; \ + OPERATE(d,+=,(-1),(OPRD - 1)); \ + d = OPRD; \ + OPERATE(d,+=,d32a,(OPRD + d32a)); \ + d = OPRD; \ + OPERATE(d,+=,d64a,(OPRD + d64a)); \ + d = OPRD; \ + OPERATE(d,+=,d128a,(OPRD + d128a)); \ + d = OPRD; \ + OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \ + d = OPRD; \ + OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \ + d = OPRD; \ + OPERATE(d,-=,1,(OPRD - 1)); \ + d = OPRD; \ + OPERATE(d,-=,0,OPRD); \ + d = OPRD; \ + OPERATE(d,-=,(-1),(OPRD + 1)); \ + d = OPRD; \ + OPERATE(d,-=,d32a,OPRD-d32a); \ + d = OPRD; \ + OPERATE(d,-=,d64a,OPRD-d64a); \ + d = OPRD; \ + OPERATE(d,-=,d128a,OPRD-d128a); \ +} + +int +main () +{ + _Decimal32 d32 = 1.23456df, d32a = 1.2df; + _Decimal64 d64 = 23.456789dd, d64a = 2.8dd; + _Decimal128 d128 = 345.67890123456789dl, d128a = 4.7dl; + + DECIMAL_COMPOUND_ASSIGNMENT(32, d32); + DECIMAL_COMPOUND_ASSIGNMENT(64, d64); + DECIMAL_COMPOUND_ASSIGNMENT(128, d128); + + FINISH +}
dfp/operator-assignment.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-11.c =================================================================== --- dfp/convert-bfp-11.c (nonexistent) +++ dfp/convert-bfp-11.c (revision 338) @@ -0,0 +1,58 @@ +/* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */ + +/* Test decimal float conversions to and from IBM 128-bit long double. + Checks are skipped at runtime if long double is not 128 bits. + Don't force 128-bit long doubles because runtime support depends + on glibc. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; + +/* A value slightly less than DEC32_MAX can be converted in both directions. */ +CONVERT_VALID (101, sd, tf, 9.999998e96df, 9.999998e96L, 1.e+81L) +CONVERT_VALID (102, tf, sd, 9.999998e96L, 9.999998e96df, 0.df) + +/* A value slightly less than DBL_MAX can be converted in both directions. */ +CONVERT_VALID (201, tf, dd, 1.79768e+308l, 1.79768e+308dd, 0.dd) +CONVERT_VALID (202, dd, tf, 1.79768e+308dd, 1.79768e+308l, 2.e292l) +CONVERT_VALID (203, tf, td, 1.79768e+308l, 1.79768e+308dl, 1.e292dl) +CONVERT_VALID (204, td, tf, 1.79768e+308dl, 1.79768e+308l, 2.e292l) + +/* Check values that are too large for the result type. */ +CONVERT_TO_PINF (301, dd, tf, 1.8e+308dd, l) +CONVERT_TO_PINF (302, dd, tf, 9.9e+384dd, l) +CONVERT_TO_PINF (303, td, tf, 1.8e+308dl, l) +CONVERT_TO_PINF (304, td, tf, 9.9e+384dl, l) + +CONVERT_TO_PINF (311, tf, sd, 1.0e+97L, d32) +CONVERT_TO_PINF (312, tf, sd, 1.6e+308L, d32) + +int +main () +{ + if (sizeof (long double) != 16) + return 0; + + convert_101 (); + convert_102 (); + + convert_201 (); + convert_202 (); + convert_203 (); + convert_204 (); + + convert_301 (); + convert_302 (); + convert_303 (); + convert_304 (); + convert_311 (); + convert_312 (); + + FINISH +}
dfp/convert-bfp-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-13.c =================================================================== --- dfp/convert-bfp-13.c (nonexistent) +++ dfp/convert-bfp-13.c (revision 338) @@ -0,0 +1,18 @@ +/* Test for bug where fold changed binary operation to decimal + depending on typedefs. */ + +#include "dfp-dbg.h" + +volatile double d = 1.2345675; + +typedef const volatile _Decimal32 d32; + +int +main (void) +{ + _Decimal32 a = (d * d); + d32 b = (d * d); + if (a != b) + FAILURE + FINISH +}
dfp/convert-bfp-13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/modes.c =================================================================== --- dfp/modes.c (nonexistent) +++ dfp/modes.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +typedef float decimal32 __attribute__ ((mode (SD))); +typedef float decimal64 __attribute__ ((mode (DD))); +typedef float decimal128 __attribute__ ((mode (TD))); + +int ssize[sizeof (decimal32) == 4 ? 1 : -1]; +int dsize[sizeof (decimal64) == 8 ? 1 : -1]; +int tsize[sizeof (decimal128) == 16 ? 1 : -1]; + +int salign = __alignof (decimal32); +int dalign = __alignof (decimal64); +int talign = __alignof (decimal128); +
dfp/modes.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/nan-1.c =================================================================== --- dfp/nan-1.c (nonexistent) +++ dfp/nan-1.c (revision 338) @@ -0,0 +1,106 @@ +/* N1150 4: Characteristics of decimal floating types (not explicit) + C99 5.2.4.2.2: Characteristics of floating types. + A few simple checks on arithmetic operations. */ + +#include "dfp-dbg.h" + +int main() +{ + /* Some possibly non-obvious tests, but most logical + operations on NaN return false, including NaN == NaN. */ + if (__builtin_nand32("") == __builtin_nand32("")) + FAILURE + + if (__builtin_nand64("") == __builtin_nand64("")) + FAILURE + + if (__builtin_nand128("") == __builtin_nand128("")) + FAILURE + + if (!(__builtin_nand32("") != __builtin_nand32(""))) + FAILURE + + if (!(__builtin_nand64("") != __builtin_nand64(""))) + FAILURE + + if (!(__builtin_nand128("") != __builtin_nand128(""))) + FAILURE + + if (__builtin_nand32("") > __builtin_nand32("")) + FAILURE + + if (__builtin_nand64("") >= __builtin_nand64("")) + FAILURE + + if (__builtin_nand128("") < __builtin_nand128("")) + FAILURE + + if (-__builtin_nand128("") < +__builtin_nand128("")) + FAILURE + + /* 0.0/0.0 => NaN, but NaN != NaN. */ + if (0.0df/0.0dl == __builtin_nand32("")) + FAILURE + + /* 0.0 * INF => NaN. */ + if (!__builtin_isnand32 (0.0df * __builtin_infd32())) + FAILURE + + if (!__builtin_isnand64 (0.0dd * __builtin_infd64())) + FAILURE + + if (!__builtin_isnand128 (0.0dd * __builtin_infd128())) + FAILURE + + /* INF - INF => NaN. */ + if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32())) + FAILURE + + if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64())) + FAILURE + + if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128())) + FAILURE + + /* INF/INF => NaN. */ + if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) ) + FAILURE + + if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) ) + FAILURE + + if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) ) + FAILURE + + /* 0.0/0.0 => NaN, but NaN != NaN. */ + if ((0.0dd/0.0df) == (0.0dd/0.0df)) + FAILURE + + if (__builtin_nand32("") < __builtin_infd32()) + FAILURE + + if (__builtin_nand32("") >= __builtin_infd32()) + FAILURE + + /* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */ + + if (!__builtin_isnand32(__builtin_nand32(""))) + FAILURE + + if (!__builtin_isnand64(__builtin_nand64(""))) + FAILURE + + if (!__builtin_isnand128(__builtin_nand128(""))) + FAILURE + + if (!__builtin_isnand128(8.0df * __builtin_nand128(""))) + FAILURE + + if (!__builtin_isnand32(8.1dl - __builtin_nand32(""))) + FAILURE + + if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128(""))) + FAILURE + + FINISH +}
dfp/nan-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/loop-index.c =================================================================== --- dfp/loop-index.c (nonexistent) +++ dfp/loop-index.c (revision 338) @@ -0,0 +1,57 @@ +/* C99 6.8.5.2: The for statement. */ + +#include +#include +#include "dfp-dbg.h" + +void +f32 (void) +{ + _Decimal32 d; + int i; + + for (d = 1.1df, i=0; d <= 1.5df; d += 0.1df) + i++; + + if (i != 5) + FAILURE +} + +void +f64 (void) +{ + _Decimal64 d; + int i; + + for (d = 1.1dd, i=0; d <= 1.5dd; d += 0.1dd) + i++; + + if (i != 5) + FAILURE +} + +void +f128 (void) +{ + _Decimal128 d; + int i; + + for (d = 1.1dl, i=0; d <= 1.5dl; d += 0.1dl) + i++; + + if (i != 5) + FAILURE +} + +int +main () +{ + int i; + + f32 (); + f64 (); + f128 (); + + FINISH + return (0); +}
dfp/loop-index.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq-d64.c =================================================================== --- dfp/compare-eq-d64.c (nonexistent) +++ dfp/compare-eq-d64.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.9 Equality operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 64 +#include "compare-eq.h" + +int main () +{ + test_compares (); + + FINISH +}
dfp/compare-eq-d64.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp.c =================================================================== --- dfp/convert-bfp.c (nonexistent) +++ dfp/convert-bfp.c (revision 338) @@ -0,0 +1,131 @@ +/* N1150 5.2 Conversions among decimal floating types and between + decimal floating types and generic floating types. + C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */ + +/* Long double isn't supported yet at runtime, so disable those checks. */ + +#include "dfp-dbg.h" + +static int skip_long_double; + +volatile _Decimal32 d32; +volatile _Decimal64 d64; +volatile _Decimal128 d128; +volatile float sf; +volatile double df; +volatile long double tf; + +int +main () +{ + /* Conversions from decimal float to binary float. */ + + if (sizeof (long double) == sizeof (double)) + skip_long_double = 1; + + /* Conversions from _Decimal32. */ + d32 = 2.0df; + sf = d32; + if (sf != 2.0f) + FAILURE + + df = d32; + if (df != 2.0) + FAILURE + + if (skip_long_double == 0) + { + tf = d32; + if (tf != 2.0l) + FAILURE + } + + /* Conversions from _Decimal64. */ + d64 = -7.0dd; + sf = d64; + if (sf != -7.0f) + FAILURE + + df = d64; + if (df != -7.0) + FAILURE + + if (skip_long_double == 0) + { + tf = d64; + if (tf != -7.0l) + FAILURE + } + + /* Conversions from _Decimal128. */ + d128 = 30.0dl; + sf = d128; + if (sf != 30.0f) + FAILURE + + df = d128; + if (df != 30.0) + FAILURE + + df = d128; + if (df != 30.0l) + FAILURE + + /* Conversions from binary float to decimal float. */ + sf = 30.0f; + d32 = sf; + if (d32 != 30.0df) + FAILURE + + d64 = sf; + if (d64 != 30.0dd) + FAILURE + + df = -2.0; + d32 = df; + if (d32 != -2.0df) + FAILURE + + d64 = df; + if (d64 != -2.0dd) + FAILURE + + d128 = df; + if (d128 != -2.0dl) + FAILURE + + sf = 30.0f; + d128 = sf; + if (d128 != 30.0dl) + FAILURE + + if (skip_long_double == 0) + { + tf = -22.0l; + d32 = tf; + if (d32 != -22.0df) + FAILURE + + d64 = tf; + if (d64 != -22.0dd) + FAILURE + + d128 = tf; + if (d128 != -22.0dl) + FAILURE + } + + /* 2**(-11) = 0.00048828125. */ + d128 = 0.000488281251dl; + sf = d128; + if (sf != 0.00048828125f) + FAILURE + /* 2**(-25) = 0.298023223876953125E-7. */ + d128 = 2.98023223876953125E-8dl; + df = d128; + if (df < (2.9802322387695312e-08 - 0.00000000001) + || df > (2.9802322387695312e-08 + 0.00000000001)) + FAILURE + + FINISH +}
dfp/convert-bfp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-3.c =================================================================== --- dfp/convert-bfp-3.c (nonexistent) +++ dfp/convert-bfp-3.c (revision 338) @@ -0,0 +1,21 @@ +/* This test assumes IEEE float and double. It also tests long double + but makes no assumption about its size or range of values. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; /* might actually be df or xf, doesn't matter */ + +CONVERT_ZEROES_ALL (t); + +int +main () +{ + CALL_ZEROES_ALL (t) + + FINISH +}
dfp/convert-bfp-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr39035.c =================================================================== --- dfp/pr39035.c (nonexistent) +++ dfp/pr39035.c (revision 338) @@ -0,0 +1,71 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +/* DFP TR 24732 == WG14 / N1176, N1312 */ +/* Based on a test from Fred Tydeman. */ + +#include "dfp-dbg.h" + +/* Test runtime computations. */ + +void +runtime32 (void) +{ + volatile _Decimal32 d; + d = 0.0DF; + if (d) + FAILURE +} + +void +runtime64 (void) +{ + volatile _Decimal64 d; + d = 0.0DD; + if (d) + FAILURE +} + +void +runtime128 (void) +{ + volatile _Decimal128 d; + d = 0.0DL; + if (d) + FAILURE +} + +void +fold32 (void) +{ + if (0.0DF) + FAILURE +} + +void +fold64 (void) +{ + if (0.0DD) + FAILURE +} + +void +fold128 (void) +{ + if (0.0DL) + FAILURE +} + +int +main(void) +{ + runtime32 (); + runtime64 (); + runtime128 (); + + fold32 (); + fold64 (); + fold128 (); + + FINISH +}
dfp/pr39035.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/usual-arith-conv-const.c =================================================================== --- dfp/usual-arith-conv-const.c (nonexistent) +++ dfp/usual-arith-conv-const.c (revision 338) @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +/* Test various conversions involving decimal floating types. */ + +#include "dfp-dbg.h" + +/* Assertion that constant C is of type T. */ +#define ASSERT_CONST_TYPE(C, T) \ + do { \ + typedef T type; \ + typedef type **typepp; \ + typedef __typeof__((C)) ctype; \ + typedef ctype **ctypepp; \ + typepp x = 0; \ + ctypepp y = 0; \ + x = y; \ + y = x; \ + } while (0) + +int +main () +{ + ASSERT_CONST_TYPE (3 + 2.1df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (1.3df + 2, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (56U - 55.0dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (5 * .2DL, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (.88dl / 2L, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (.114df - 1.6dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */ + ASSERT_CONST_TYPE (3L - 1 + .55df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */ + + return 0; +}
dfp/usual-arith-conv-const.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-dfp.c =================================================================== --- dfp/convert-dfp.c (nonexistent) +++ dfp/convert-dfp.c (revision 338) @@ -0,0 +1,94 @@ +/* { dg-options "-O0" } */ + +/* N1150 5.2 Conversions among decimal floating types and between + decimal floating types and generic floating types. + C99 6.3.1.5(3) New. + + Test various conversions involving decimal floating types. */ + +#ifndef __STDC_WANT_DEC_FP__ +#define __STDC_WANT_DEC_FP__ 1 +#endif + +#include "dfp-dbg.h" +#include + +volatile _Decimal32 d32; +volatile _Decimal64 d64; +volatile _Decimal128 d128; + +int +main () +{ + /* Conversions to larger types. */ + d32 = 123.4df; + d64 = d32; + if (d64 != 123.4dd) + FAILURE + d128 = d32; + if (d128 != 123.4dl) + FAILURE + d64 = 345.678dd; + d128 = d64; + if (d128 != 345.678dl) + FAILURE + + /* Conversions to smaller types for which the value fits. */ + d64 = 3456.789dd; + d32 = d64; + if (d32 != 3456.789df) + FAILURE + d128 = 123.4567dl; + d32 = d128; + if (d32 != 123.4567df) + FAILURE + + d128 = 1234567890.123456dl; + d64 = d128; + if (d64 != 1234567890.123456dd) + FAILURE + + /* Test demotion to non-representable decimal floating type. */ + + /* Assumes a default rounding mode of 'near'. This uses the rules + describe in the 27 July 2005 draft of IEEE 754r, which are much + more clear that what's described in draft 5 of N1107. */ + + /* Rounds to what _Decimal32 can handle. */ + d64 = 9.99999949E96DD; + d32 = d64; + if (d32 != DEC32_MAX) + FAILURE + + /* Rounds to more than _Decimal32 can handle. */ + d64 = 9.9999995E96DD; + d32 = d64; + if (d32 != __builtin_infd32()) + FAILURE + + /* Rounds to what _Decimal32 can handle. */ + d128 = 9.99999949E96DD; + d32 = d128; + if (d32 != DEC32_MAX) + FAILURE + + /* Rounds to more than _Decimal32 can handle. */ + d128= 9.9999995E96DD; + d32 = d128; + if (d32 != __builtin_infd32()) + FAILURE + + /* Rounds to what _Decimal64 can handle. */ + d128 = 9.99999999999999949E384DL; + d64 = d128; + if (d64 != DEC64_MAX) + FAILURE + + /* Rounds to more than _Decimal64 can handle. */ + d128 = 9.9999999999999995E384DL; + d64 = d128; + if (d64 != __builtin_infd64()) + FAILURE + + FINISH +}
dfp/convert-dfp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-5.c =================================================================== --- dfp/convert-bfp-5.c (nonexistent) +++ dfp/convert-bfp-5.c (revision 338) @@ -0,0 +1,21 @@ +/* This test assumes IEEE float and double. It also tests long double + but makes no assumption about its size or range of values. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; /* might actually be df or xf, doesn't matter */ + +CONVERT_NAN_ALL (t); + +int +main () +{ + CALL_NAN_ALL (t) + + FINISH +}
dfp/convert-bfp-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-7.c =================================================================== --- dfp/convert-bfp-7.c (nonexistent) +++ dfp/convert-bfp-7.c (revision 338) @@ -0,0 +1,83 @@ +/* { dg-options "-w" } */ + +/* This test assumes IEEE float and double. */ + +#define __STDC_WANT_DEC_FP__ +#include + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; + +/* Check values that are too large for the result type. */ +CONVERT_TO_PINF (301, sd, sf, 4.e+38df, f) +CONVERT_TO_PINF (303, dd, sf, 4.e+38dd, f) +CONVERT_TO_PINF (302, sd, sf, 9.9e+384df, f) +CONVERT_TO_PINF (304, dd, sf, 9.9e+384dd, f) +CONVERT_TO_PINF (305, td, sf, 4.e+38dl, f) +CONVERT_TO_PINF (306, td, sf, 1.e+39dl, f) +CONVERT_TO_MINF (311, sd, sf, -4.e+38df, f) +CONVERT_TO_MINF (312, dd, sf, -4.e+38dd, f) +CONVERT_TO_MINF (313, sd, sf, -9.9e+384df, f) +CONVERT_TO_MINF (314, dd, sf, -9.9e+384dd, f) +CONVERT_TO_MINF (315, td, sf, -4.e+38dl, f) +CONVERT_TO_MINF (316, td, sf, -1.e+39dl, f) + +CONVERT_TO_PINF (321, dd, df, 1.8e+308dd,) +CONVERT_TO_PINF (322, dd, df, 9.9e+384dd,) +CONVERT_TO_PINF (323, td, df, 1.8e+308dl,) +CONVERT_TO_PINF (324, td, df, 9.9e+384dl,) +CONVERT_TO_PINF (325, dd, df, 1.e309dd,) +CONVERT_TO_PINF (326, td, df, 1.e309dl,) +CONVERT_TO_MINF (331, dd, df, -1.8e+308dd,) +CONVERT_TO_MINF (332, dd, df, -9.9e+384dd,) +CONVERT_TO_MINF (333, td, df, -1.8e+308dl,) +CONVERT_TO_MINF (334, td, df, -9.9e+384dl,) +CONVERT_TO_MINF (335, dd, df, -1.e309dd,) +CONVERT_TO_MINF (336, td, df, -1.e309dl,) + +CONVERT_TO_PINF (341, df, sd, 1.0e+97, d32) +CONVERT_TO_PINF (342, df, sd, 1.6e+308, d32) +CONVERT_TO_MINF (351, df, sd, -1.0e+97, d32) +CONVERT_TO_MINF (352, df, sd, -1.6e+308, d32) + +int +main () +{ + convert_301 (); + convert_302 (); + convert_303 (); + convert_304 (); + convert_305 (); + convert_306 (); + convert_311 (); + convert_312 (); + convert_313 (); + convert_314 (); + convert_315 (); + convert_316 (); + + convert_321 (); + convert_322 (); + convert_323 (); + convert_324 (); + convert_325 (); + convert_326 (); + convert_331 (); + convert_332 (); + convert_333 (); + convert_334 (); + convert_335 (); + convert_336 (); + + convert_341 (); + convert_342 (); + convert_351 (); + convert_352 (); + + FINISH +}
dfp/convert-bfp-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel-const.c =================================================================== --- dfp/compare-rel-const.c (nonexistent) +++ dfp/compare-rel-const.c (revision 338) @@ -0,0 +1,57 @@ +/* C99 6.5.8 Relational operators. + Compare decimal float constants against each other. */ + +extern void link_error (void); + +int +main () +{ + /* Compare like-typed negative constants. */ + if (-2.0dl < -2.0dl) + link_error (); + + /* Compare like-typed constants. */ + if (-2.0dl >= .01dl) + link_error (); + + /* Compare like-typed constants. */ + if (0.2dd > 0.02e1dd) + link_error (); + + /* Compare decimal float constants of different types. */ + if (-.000005dd >= -.0000049DL) + link_error(); + + /* Test use gcc builtins for comparisons. */ + if (__builtin_isless(-2.0dl,-2.0dl)) + link_error(); + + if (__builtin_isgreaterequal(-2.0dl,.01dl)) + link_error(); + + if (!(__builtin_islessequal(-2.0dl, -2.0dd))) + link_error(); + + if (!(__builtin_isgreater(2.0dl, -2.0dd))) + link_error(); + + if (__builtin_islessequal(2.0df, __builtin_nand64(""))) + link_error(); + + if (__builtin_islessgreater(2.0dd, __builtin_nand64(""))) + link_error(); + + if (!__builtin_islessgreater(2.0dd, -2.0dd)) + link_error(); + + if (!__builtin_islessgreater(-3.0dd, 2.0dd)) + link_error(); + + if (__builtin_isunordered(1.1df, 0.003dd)) + link_error(); + + if (!__builtin_isunordered(-3.1df, __builtin_nand32(""))) + link_error(); + + return 0; +}
dfp/compare-rel-const.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-int-fold.c =================================================================== --- dfp/convert-int-fold.c (nonexistent) +++ dfp/convert-int-fold.c (revision 338) @@ -0,0 +1,173 @@ +/* { dg-options "-O2" } */ + +/* N1150 5.1 Conversion between decimal floating integer. + C99 6.3.1.4(1a) New. + These should all be folded at compile time. */ + +#include "dfp-dbg.h" + +#ifdef __cplusplus +#define BOOL bool +#else +#define BOOL _Bool +#endif + +extern void link_error (void); + +int +main () +{ + _Decimal32 d32; + _Decimal64 d64; + _Decimal128 d128; + unsigned int ui; + unsigned long ul; + unsigned long long ull; + int si; + long sl; + long long sll; + BOOL b; + + /* C99 Section 6.7.2 Type specifiers. Type _Bool is + mentioned in this section. Conversions between + BOOL and DFP types. */ + + /* Decimal float to unsigned integer. */ + d32 = 456.789df; + d64 = 23.456789dd; + d128 = 1234.5678dl; + + ui = d32; + if (ui != 456U) + link_error (); + ul = d32; + if (ul != 456UL) + link_error (); + ull = d32; + if (ull != 456ULL) + link_error (); + + ui = d64; + if (ui != 23U) + link_error (); + ul = d64; + if (ul != 23UL) + link_error (); + ull = d64; + if (ull != 23ULL) + link_error (); + + ui = d128; + if (ui != 1234U) + link_error (); + ul = d128; + if (ul != 1234UL) + link_error (); + ull = d128; + if (ull != 1234ULL) + link_error (); + + /* Decimal float to signed integer. */ + + /* Decimal float to BOOL. */ + d32 = 1.23df; + d64 = -3.4dd; + d128 = 0.00003dl; + + b = d32; + if (!b) + link_error (); + b = d64; + if (!b) + link_error (); + b = d128; + if (!b) + link_error (); + + /* Unsigned integer to decimal float. */ + ui = 987U; + ul = 345678UL; + ull = 1234567ULL; + + d32 = ui; + if (d32 != 987.0df) + link_error (); + d32 = ul; + if (d32 != 345678.0df) + link_error (); + d32 = ull; + if (d32 != 1234567.df) + link_error (); + + d64 = ui; + if (d64 != 987.0dd) + link_error (); + d64 = ul; + if (d64 != 345678.0dd) + link_error (); + d64 = ull; + if (d64 != 1234567.dd) + link_error (); + + d128 = ui; + if (d128 != 987.0dl) + link_error (); + d128 = ul; + if (d128 != 345678.0dl) + link_error (); + d128 = ull; + if (d128 != 1234567.dl) + link_error (); + + /* Signed integer to decimal float. */ + si = -987; + sl = -345678; + sll = -1234567; + + d32 = si; + if (d32 != -987.0df) + link_error (); + d32 = sl; + if (d32 != -345678.0df) + link_error (); + d32 = sll; + if (d32 != -1234567.df) + link_error (); + + d64 = si; + if (d64 != -987.0dd) + link_error (); + d64 = sl; + if (d64 != -345678.0dd) + link_error (); + d64 = sll; + if (d64 != -1234567.dd) + link_error (); + + d128 = si; + if (d128 != -987.0dl) + link_error (); + d128 = sl; + if (d128 != -345678.0dl) + link_error (); + d128 = sll; + if (d128 != -1234567.dl) + link_error (); + + /* BOOL to decimal float. */ + d32 = 0.0DF; + d64 = 0.0DD; + d128 = 0.0DL; + + b = d32; + if (b) + link_error (); + b = d64; + if (b) + link_error (); + b = d128; + if (b) + link_error (); + + return 0; +}
dfp/convert-int-fold.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-9.c =================================================================== --- dfp/convert-bfp-9.c (nonexistent) +++ dfp/convert-bfp-9.c (revision 338) @@ -0,0 +1,192 @@ +/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */ +/* { dg-options "-w" } */ + +/* This test assumes IEEE float and double. */ + +#define __STDC_WANT_DEC_FP__ +#include + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; + +/* Exponent values that might cause problems with a particular + implementation. */ + +CONVERT_VALID (101, dd, df, 1.e309dd, 1.e309, 0.) +CONVERT_VALID (102, dd, df, 1.e308dd, 1.e308, 0.) +CONVERT_VALID (103, dd, df, 1.e307dd, 1.e307, 0.) +CONVERT_VALID (104, dd, df, 1.e306dd, 1.e306, 0.) +CONVERT_VALID (105, dd, df, 1.e305dd, 1.e305, 0.) +CONVERT_VALID (106, dd, df, 1.e304dd, 1.e304, 0.) +CONVERT_VALID (107, dd, df, 1.e303dd, 1.e303, 0.) +CONVERT_VALID (108, dd, df, 1.e302dd, 1.e302, 0.) +CONVERT_VALID (109, dd, df, 1.e301dd, 1.e301, 0.) +CONVERT_VALID (110, dd, df, 1.e300dd, 1.e300, 0.) +CONVERT_VALID (111, dd, df, 1.e299dd, 1.e299, 0.) +CONVERT_VALID (112, dd, df, 1.e298dd, 1.e298, 0.) +CONVERT_VALID (113, dd, df, 1.e297dd, 1.e297, 0.) +CONVERT_VALID (114, dd, df, 1.e296dd, 1.e296, 0.) +CONVERT_VALID (115, dd, df, 1.e295dd, 1.e295, 0.) +CONVERT_VALID (116, dd, df, 1.e294dd, 1.e294, 0.) +CONVERT_VALID (117, dd, df, 1.e293dd, 1.e293, 0.) +CONVERT_VALID (118, dd, df, 1.e292dd, 1.e292, 0.) +CONVERT_VALID (119, dd, df, 1.e291dd, 1.e291, 0.) +CONVERT_VALID (120, dd, df, 1.e290dd, 1.e290, 0.) + +CONVERT_VALID (201, dd, df, 1.e-309dd, 1.e-309, 0.) +CONVERT_VALID (202, dd, df, 1.e-308dd, 1.e-308, 0.) +CONVERT_VALID (203, dd, df, 1.e-307dd, 1.e-307, 0.) +CONVERT_VALID (204, dd, df, 1.e-306dd, 1.e-306, 0.) +CONVERT_VALID (205, dd, df, 1.e-305dd, 1.e-305, 0.) +CONVERT_VALID (206, dd, df, 1.e-304dd, 1.e-304, 0.) +CONVERT_VALID (207, dd, df, 1.e-303dd, 1.e-303, 0.) +CONVERT_VALID (208, dd, df, 1.e-302dd, 1.e-302, 0.) +CONVERT_VALID (209, dd, df, 1.e-301dd, 1.e-301, 0.) +CONVERT_VALID (210, dd, df, 1.e-300dd, 1.e-300, 0.) +CONVERT_VALID (211, dd, df, 1.e-299dd, 1.e-299, 0.) +CONVERT_VALID (212, dd, df, 1.e-298dd, 1.e-298, 0.) +CONVERT_VALID (213, dd, df, 1.e-297dd, 1.e-297, 0.) +CONVERT_VALID (214, dd, df, 1.e-296dd, 1.e-296, 0.) +CONVERT_VALID (215, dd, df, 1.e-295dd, 1.e-295, 0.) +CONVERT_VALID (216, dd, df, 1.e-294dd, 1.e-294, 0.) +CONVERT_VALID (217, dd, df, 1.e-293dd, 1.e-293, 0.) +CONVERT_VALID (218, dd, df, 1.e-292dd, 1.e-292, 0.) +CONVERT_VALID (219, dd, df, 1.e-291dd, 1.e-291, 0.) +CONVERT_VALID (220, dd, df, 1.e-290dd, 1.e-290, 0.) + +CONVERT_VALID (301, td, df, 1.e309dl, 1.e309, 0.) +CONVERT_VALID (302, td, df, 1.e308dl, 1.e308, 0.) +CONVERT_VALID (303, td, df, 1.e307dl, 1.e307, 0.) +CONVERT_VALID (304, td, df, 1.e306dl, 1.e306, 0.) +CONVERT_VALID (305, td, df, 1.e305dl, 1.e305, 0.) +CONVERT_VALID (306, td, df, 1.e304dl, 1.e304, 0.) +CONVERT_VALID (307, td, df, 1.e303dl, 1.e303, 0.) +CONVERT_VALID (308, td, df, 1.e302dl, 1.e302, 0.) +CONVERT_VALID (309, td, df, 1.e301dl, 1.e301, 0.) +CONVERT_VALID (310, td, df, 1.e300dl, 1.e300, 0.) +CONVERT_VALID (311, td, df, 1.e299dl, 1.e299, 0.) +CONVERT_VALID (312, td, df, 1.e298dl, 1.e298, 0.) +CONVERT_VALID (313, td, df, 1.e297dl, 1.e297, 0.) +CONVERT_VALID (314, td, df, 1.e296dl, 1.e296, 0.) +CONVERT_VALID (315, td, df, 1.e295dl, 1.e295, 0.) +CONVERT_VALID (316, td, df, 1.e294dl, 1.e294, 0.) +CONVERT_VALID (317, td, df, 1.e293dl, 1.e293, 0.) +CONVERT_VALID (318, td, df, 1.e292dl, 1.e292, 0.) +CONVERT_VALID (319, td, df, 1.e291dl, 1.e291, 0.) +CONVERT_VALID (320, td, df, 1.e290dl, 1.e290, 0.) + +CONVERT_VALID (401, td, df, 1.e-309dl, 1.e-309, 0.) +CONVERT_VALID (402, td, df, 1.e-308dl, 1.e-308, 0.) +CONVERT_VALID (403, td, df, 1.e-307dl, 1.e-307, 0.) +CONVERT_VALID (404, td, df, 1.e-306dl, 1.e-306, 0.) +CONVERT_VALID (405, td, df, 1.e-305dl, 1.e-305, 0.) +CONVERT_VALID (406, td, df, 1.e-304dl, 1.e-304, 0.) +CONVERT_VALID (407, td, df, 1.e-303dl, 1.e-303, 0.) +CONVERT_VALID (408, td, df, 1.e-302dl, 1.e-302, 0.) +CONVERT_VALID (409, td, df, 1.e-301dl, 1.e-301, 0.) +CONVERT_VALID (410, td, df, 1.e-300dl, 1.e-300, 0.) +CONVERT_VALID (411, td, df, 1.e-299dl, 1.e-299, 0.) +CONVERT_VALID (412, td, df, 1.e-298dl, 1.e-298, 0.) +CONVERT_VALID (413, td, df, 1.e-297dl, 1.e-297, 0.) +CONVERT_VALID (414, td, df, 1.e-296dl, 1.e-296, 0.) +CONVERT_VALID (415, td, df, 1.e-295dl, 1.e-295, 0.) +CONVERT_VALID (416, td, df, 1.e-294dl, 1.e-294, 0.) +CONVERT_VALID (417, td, df, 1.e-293dl, 1.e-293, 0.) +CONVERT_VALID (418, td, df, 1.e-292dl, 1.e-292, 0.) +CONVERT_VALID (419, td, df, 1.e-291dl, 1.e-291, 0.) +CONVERT_VALID (420, td, df, 1.e-290dl, 1.e-290, 0.) + +int +main () +{ + convert_101 (); + convert_102 (); + convert_103 (); + convert_104 (); + convert_105 (); + convert_106 (); + convert_107 (); + convert_108 (); + convert_109 (); + convert_110 (); + convert_111 (); + convert_112 (); + convert_113 (); + convert_114 (); + convert_115 (); + convert_116 (); + convert_117 (); + convert_118 (); + convert_119 (); + convert_120 (); + + convert_201 (); + convert_202 (); + convert_203 (); + convert_204 (); + convert_205 (); + convert_206 (); + convert_207 (); + convert_208 (); + convert_209 (); + convert_210 (); + convert_211 (); + convert_212 (); + convert_213 (); + convert_214 (); + convert_215 (); + convert_216 (); + convert_217 (); + convert_218 (); + convert_219 (); + convert_220 (); + + convert_301 (); + convert_302 (); + convert_303 (); + convert_304 (); + convert_305 (); + convert_306 (); + convert_307 (); + convert_308 (); + convert_309 (); + convert_310 (); + convert_311 (); + convert_312 (); + convert_313 (); + convert_314 (); + convert_315 (); + convert_316 (); + convert_317 (); + convert_318 (); + convert_319 (); + convert_320 (); + + convert_401 (); + convert_402 (); + convert_403 (); + convert_404 (); + convert_405 (); + convert_406 (); + convert_407 (); + convert_408 (); + convert_409 (); + convert_410 (); + convert_411 (); + convert_412 (); + convert_413 (); + convert_414 (); + convert_415 (); + convert_416 (); + convert_417 (); + convert_418 (); + convert_419 (); + convert_420 (); + + FINISH +}
dfp/convert-bfp-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-int-max.c =================================================================== --- dfp/convert-int-max.c (nonexistent) +++ dfp/convert-int-max.c (revision 338) @@ -0,0 +1,146 @@ +/* { dg-options "-O0 -w" } */ + +/* N1150 5.1 Conversions from decimal float to integer. */ + +/* Test decimal float to integer conversions for values at the limit of + what will fit into the destination type. This assumes 32-bit int and + 64-bit long long (there's a check for that below). */ + +#include "dfp-dbg.h" + +volatile _Decimal32 d32; +volatile _Decimal64 d64; +volatile _Decimal128 d128; +volatile int si; +volatile unsigned int ui; +volatile long long sll; +volatile unsigned long long ull; + +void +doit () +{ + /* _Decimal32 to int. */ + + d32 = 2147483.E3DF; + si = d32; + if (si != 2147483000) + FAILURE + + d32 = -2147483.E3DF; + si = d32; + if (si != -2147483000) + FAILURE + + /* _Decimal32 to unsigned int. */ + + d32 = 4.294967E9DF; + ui = d32; + if (ui != 4294967000U) + FAILURE + + /* _Decimal32 to long long. */ + + d32 = 922.3372E16DF; + sll = d32; + if (sll != 9223372000000000000LL) + FAILURE + + d32 = -92233.72E14DF; + sll = d32; + if (sll != -9223372000000000000LL) + FAILURE + + /* _Decimal32 to unsigned long long. */ + + d32 = .1844674E20DF; + ull = d32; + if (ull != 18446740000000000000ULL) + FAILURE + + /* _Decimal64 to int. */ + + d64 = 2.147483647E9DD; + si = d64; + if (si != 2147483647) + FAILURE + + d64 = -2147483648.DD; + si = d64; + if (si != -2147483648) + FAILURE + + /* _Decimal64 to unsigned int. */ + + d64 = 42949.67295E5DD; + ui = d64; + if (ui != 4294967295) + FAILURE + + /* _Decimal64 to long long. */ + + d64 = 9.223372036854775E18DD; + sll = d64; + if (sll != 9223372036854775000LL) + FAILURE + + d64 = -92233720.36854775E11DD; + sll = d64; + if (sll != -9223372036854775000LL) + FAILURE + + /* _Decimal64 to unsigned long long. */ + d64 = 1844674407370955.E4DD; + ull = d64; + if (ull != 18446744073709550000ULL) + FAILURE + + /* _Decimal128 to int. */ + + d128 = 2.147483647E9DL; + si = d128; + if (si != 2147483647) + FAILURE + + d128 = -2147483648.DL; + si = d128; + if (si != -2147483648) + FAILURE + + /* _Decimal128 to unsigned int. */ + + d128 = 4294.967295E6DL; + ui = d128; + if (ui != 4294967295) + FAILURE + + /* _Decimal128 to long long. */ + + d128 = 9223372036854775807.DL; + sll = d128; + if (sll != 9223372036854775807LL) + FAILURE + + d128 = -9.223372036854775808E19DL; + sll = d128; + if (sll != -9223372036854775807LL - 1LL) + FAILURE + + /* _Decimal128 to unsigned long long. */ + d128 = 18446744073709551615.DL; + ull = d128; + if (ull != 18446744073709551615ULL) + FAILURE +} + +int +main () +{ + /* This test assumes 32-bit int and 64-bit long long. */ + + if (sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + doit (); + + FINISH +}
dfp/convert-int-max.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel-d32.c =================================================================== --- dfp/compare-rel-d32.c (nonexistent) +++ dfp/compare-rel-d32.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 32 +#include "compare-rel.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-rel-d32.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/call-by-value.c =================================================================== --- dfp/call-by-value.c (nonexistent) +++ dfp/call-by-value.c (revision 338) @@ -0,0 +1,43 @@ +/* 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. */ + +#include "dfp-dbg.h" + +int foo32 (_Decimal32 z) +{ + z = z + 1.0df; +} + +int foo64 (_Decimal64 z) +{ + z = z + 1.0dd; +} + +int foo128 (_Decimal128 z) +{ + z = z + 1.0dl; +} + +int +main () +{ + _Decimal32 d32 = 1.1df; + _Decimal64 d64 = 1.2dd; + _Decimal128 d128 = 1.3dl; + + foo32 (d32); + if (d32 != 1.1df) + FAILURE + + foo64 (d64); + if (d64 != 1.2dd) + FAILURE + + foo128 (d128); + if (d128 != 1.3dl) + FAILURE + + FINISH +}
dfp/call-by-value.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/signbit-2.c =================================================================== --- dfp/signbit-2.c (nonexistent) +++ dfp/signbit-2.c (revision 338) @@ -0,0 +1,33 @@ +/* { dg-options "-O0" } */ + +/* Check that the compiler uses builtins for signbit; if not the link + will fail because library functions are in libm. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 sd = 2.3df; +volatile _Decimal64 dd = -4.5dd; +volatile _Decimal128 tf = 5.3dl; +volatile float f = 1.2f; +volatile double d = -7.8; +volatile long double ld = 3.4L; + +EXTERN int signbitf (float); +EXTERN int signbit (double); +EXTERN int signbitl (long double); +EXTERN int signbitd32 (_Decimal32); +EXTERN int signbitd64 (_Decimal64); +EXTERN int signbitd128 (_Decimal128); + +int +main () +{ + if (signbitf (f) != 0) FAILURE + if (signbit (d) == 0) FAILURE + if (signbitl (ld) != 0) FAILURE + if (signbitd32 (sd) != 0) FAILURE + if (signbitd64 (dd) == 0) FAILURE + if (signbitd128 (tf) != 0) FAILURE + + FINISH +}
dfp/signbit-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-scalar.c =================================================================== --- dfp/func-scalar.c (nonexistent) +++ dfp/func-scalar.c (revision 338) @@ -0,0 +1,192 @@ +/* C99 6.5.2.2 Function calls. + Test scalar passing and return values involving decimal floating + point types. */ + +#include "dfp-dbg.h" + +/* A handful of functions that return their Nth _Decimal32 + argument. */ + +_Decimal32 +arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg0; +} + +_Decimal32 +arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg1; +} + +_Decimal32 +arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg2; +} + +_Decimal32 +arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg3; +} + +_Decimal32 +arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg4; +} + +_Decimal32 +arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth _Decimal64 + argument. */ + +_Decimal64 +arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg0; +} + +_Decimal64 +arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg1; +} + +_Decimal64 +arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg2; +} + +_Decimal64 +arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg3; +} + +_Decimal64 +arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg4; +} + +_Decimal64 +arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth _Decimal128 + argument. */ + +_Decimal128 +arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg0; +} + +_Decimal128 +arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg1; +} + +_Decimal128 +arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg2; +} + +_Decimal128 +arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg3; +} + +_Decimal128 +arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg4; +} + +_Decimal128 +arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg5; +} + + + +int +main () +{ + /* _Decimal32 variants. */ + if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df) + FAILURE + if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df) + FAILURE + if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df) + FAILURE + if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df) + FAILURE + if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df) + FAILURE + if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df) + FAILURE + + /* _Decimal64 variants. */ + if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd) + FAILURE + if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd) + FAILURE + if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd) + FAILURE + if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd) + FAILURE + if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd) + FAILURE + if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd) + FAILURE + + /* _Decimal128 variants. */ + if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl) + FAILURE + if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl) + FAILURE + if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl) + FAILURE + if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl) + FAILURE + if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl) + FAILURE + if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl) + FAILURE + + FINISH +}
dfp/func-scalar.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/usual-arith-conv.c =================================================================== --- dfp/usual-arith-conv.c (nonexistent) +++ dfp/usual-arith-conv.c (revision 338) @@ -0,0 +1,117 @@ +/* { dg-options "-O0" } */ + +/* N1150 5.4: Usual arithmetic conversions. + C99 6.3.1.8[1] (New). + + Test arithmetic operators with different decimal float types, and + between decimal float types and integer types. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 d32a, d32b, d32c; +volatile _Decimal64 d64a, d64b, d64c; +volatile _Decimal128 d128a, d128b, d128c; +volatile int i; + +void +init () +{ + d32b = 123.456e94df; + d64b = 12.3456789012345e383dd; + d128b = 12345.6789012345678901e4000dl; + + d32c = 1.3df; + d64c = 1.2dd; + d128c = 1.1dl; + + i = 2; +} + +int +main () +{ + init (); + + /* Usual arithmetic conversions between decimal float types; addition. */ + d128a = d128b + d32b; + if (d128a < d128b) + FAILURE + d128a = d32b + d128b; + if (d128a < d128b) + FAILURE + d128a = d128b + d64b; + if (d128a < d128b) + FAILURE + d128a = d64b + d128b; + if (d128a < d128b) + FAILURE + d64a = d64b + d32b; + if (d64a < d64b) + FAILURE + d64a = d32b + d64b; + if (d64a < d64b) + FAILURE + + /* Usual arithmetic conversions between decimal float types; + multiplication. */ + d128a = d128b * d32c; + if (d128a < d128b) + FAILURE + d128a = d32c * d128b; + if (d128a < d128b) + FAILURE + d128a = d128b * d64c; + if (d128a < d128b) + FAILURE + d128a = d64c * d128b; + if (d128a < d128b) + FAILURE + d64a = d64b * d32c; + if (d64a < d64b) + FAILURE + d64a = d32c * d64b; + if (d64a < d64b) + FAILURE + + /* Usual arithmetic conversions between decimal float and integer types. */ + d32a = d32c + i; + if (d32a != d32c + 2.0df) + FAILURE + d32a = d32c - i; + if (d32a != d32c - 2.0df) + FAILURE + d32a = i * d32c; + if (d32a != d32c + d32c) + FAILURE + d32a = d32c / i; + if (d32a != d32c / 2.0df) + FAILURE + + d64a = i + d64c; + if (d64a != d64c + 2.0dd) + FAILURE + d64a = d64c - i; + if (d64a != d64c - 2.0dd) + FAILURE + d64a = d64c * i; + if (d64a != d64c + d64c) + FAILURE + d64a = d64c / i; + if (d64a != d64c / 2.0dd) + FAILURE + + d128a = d128c + i; + if (d128a != d128c + 2.0dl) + FAILURE + d128a = d128c - i; + if (d128a != d128c - 2.0dl) + FAILURE + d128a = i * d128c; + if (d128a != d128c + d128c) + FAILURE + d128a = d128c / i; + if (d128a != d128c / 2.0dl) + FAILURE + + FINISH +}
dfp/usual-arith-conv.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-logical.c =================================================================== --- dfp/operator-logical.c (nonexistent) +++ dfp/operator-logical.c (revision 338) @@ -0,0 +1,63 @@ +/* C99 Logical AND operator. + C99 Logical OR operator. + Test with decimal float operands. */ + +#include "dfp-dbg.h" + +#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ +do \ +{ \ + if (( (OPRD1) OPRT (OPRD2) )!= RLT) \ + __builtin_abort (); \ +} while (0) + +#define DECIMAL_LOGICAL_OR(OPRD) \ +do \ +{ \ + OPRD = 1.0; \ + OPERATE(1,||,OPRD,1); \ + OPERATE(0,||,OPRD,1); \ + OPERATE(OPRD,||,1,1); \ + OPERATE(OPRD,||,0,1); \ + OPRD = 0.0; \ + OPERATE(1,||,OPRD,1); \ + OPERATE(0,||,OPRD,0); \ + OPERATE(OPRD,||,1,1); \ + OPERATE(OPRD,||,0,0); \ +} while (0) + +#define DECIMAL_LOGICAL_AND(OPRD) \ +do \ +{ \ + OPRD = 1.0; \ + OPERATE(1,&&,OPRD,1); \ + OPERATE(0,&&,OPRD,0); \ + OPERATE(OPRD,&&,1,1); \ + OPERATE(OPRD,&&,0,0); \ + OPRD = 0.0; \ + OPERATE(1,&&,OPRD,0); \ + OPERATE(0,&&,OPRD,0); \ + OPERATE(OPRD,&&,1,0); \ + OPERATE(OPRD,&&,0,0); \ +} while (0) + +int +main () +{ + _Decimal32 d32; + _Decimal64 d64; + _Decimal128 d128; + + /* C99 Section 6.5.{13,14} Logical operator. Constraints Each of the + operands shall have scalar type. DFP types would obey this. */ + DECIMAL_LOGICAL_OR (d32); + DECIMAL_LOGICAL_AND (d32); + + DECIMAL_LOGICAL_OR (d64); + DECIMAL_LOGICAL_AND (d64); + + DECIMAL_LOGICAL_OR (d128); + DECIMAL_LOGICAL_AND (d128); + + return 0; +}
dfp/operator-logical.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq-d128.c =================================================================== --- dfp/compare-eq-d128.c (nonexistent) +++ dfp/compare-eq-d128.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.9 Equality operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 128 +#include "compare-eq.h" + +int main () +{ + test_compares (); + + FINISH +}
dfp/compare-eq-d128.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-fold.c =================================================================== --- dfp/convert-bfp-fold.c (nonexistent) +++ dfp/convert-bfp-fold.c (revision 338) @@ -0,0 +1,118 @@ +/* { dg-options "-O2" } */ + +/* N1150 5.2 Conversions among decimal floating types and between + decimal floating types and generic floating types. + C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */ + +#include "dfp-dbg.h" + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; +float sf; +double df; +long double tf; + +extern void link_error (void); + +int +main () +{ + /* Conversions from decimal float to binary float. */ + + /* Conversions from _Decimal32. */ + d32 = 2.0df; + sf = d32; + if (sf != 2.0f) + link_error (); + + df = d32; + if (df != 2.0) + link_error (); + + tf = d32; + if (tf != 2.0l) + link_error (); + + /* Conversions from _Decimal64. */ + d64 = -7.0dd; + sf = d64; + if (sf != -7.0f) + link_error (); + + df = d64; + if (df != -7.0) + link_error (); + + tf = d64; + if (tf != -7.0l) + link_error (); + + /* Conversions from _Decimal128. */ + d128 = 30.0dl; + sf = d128; + if (sf != 30.0f) + link_error (); + + df = d128; + if (df != 30.0) + link_error (); + + df = d128; + if (df != 30.0l) + link_error (); + + /* Conversions from binary float to decimal float. */ + sf = 30.0f; + d128 = sf; + if (d128 != 30.0dl) + link_error (); + + d64 = sf; + if (d64 != 30.0dd) + link_error (); + + d32 = sf; + if (d32 != 30.0df) + link_error (); + + df = -2.0; + d128 = df; + if (d128 != -2.0dl) + link_error (); + + d64 = df; + if (d64 != -2.0dd) + link_error (); + + d32 = df; + if (d32 != -2.0df) + link_error (); + + tf = -22.0l; + d128 = tf; + if (d128 != -22.0dl) + link_error (); + + d64 = tf; + if (d64 != -22.0dd) + link_error (); + + d32 = tf; + if (d32 != -22.0df) + link_error (); + + /* 2**(-11) = 0.00048828125. */ + d128 = 0.000488281251dl; + sf = d128; + if (sf != 0.00048828125f) + link_error (); + /* 2**(-25) = 0.298023223876953125E-7. */ + d128 = 2.98023223876953125E-8dl; + df = d128; + if (df < (2.9802322387695312e-08 - 0.00000000001) + || df > (2.9802322387695312e-08 + 0.00000000001)) + link_error (); + + return 0; +}
dfp/convert-bfp-fold.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-dfp-fold-2.c =================================================================== --- dfp/convert-dfp-fold-2.c (nonexistent) +++ dfp/convert-dfp-fold-2.c (revision 338) @@ -0,0 +1,15 @@ +/* Test for bug where fold narrowed decimal floating-point + operations. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 f = 1.23456DF; +volatile _Decimal64 d = 1.23456DD; + +int +main (void) +{ + if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d)) + FAILURE + FINISH +}
dfp/convert-dfp-fold-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-int.c =================================================================== --- dfp/convert-int.c (nonexistent) +++ dfp/convert-int.c (revision 338) @@ -0,0 +1,199 @@ +/* { dg-options "-O0" } */ + +/* N1150 5.1 Conversion between decimal floating types and integer. + C99 6.3.1.4(1a) New. */ + +#include "dfp-dbg.h" + +#ifdef __cplusplus +#define BOOL bool +#else +#define BOOL _Bool +#endif + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; +unsigned int ui; +unsigned long ul; +unsigned long long ull; +int si; +long sl; +long long sll; +BOOL b; + +void +init_dfp_1 (void) +{ + d32 = 456.789df; + d64 = 23.456789dd; + d128 = 1234.5678dl; +} +void +init_dfp_2 (void) +{ + d32 = 1.23df; + d64 = -3.4dd; + d128 = 0.00003dl; +} + +void +init_dfp_3 (void) +{ + d32 = 0.0DF; + d64 = 0.0DD; + d128 = 0.0DL; +} + +void +init_unsigned_int (void) +{ + ui = 987U; + ul = 345678UL; + ull = 1234567ULL; +} + +void +init_signed_int (void) +{ + si = -987; + sl = -345678; + sll = -1234567; +} + +int +main () +{ + /* C99 Section 6.7.2 Type specifiers. Type _Bool is + mentioned in this section. Conversions between + BOOL and DFP types. */ + + /* Decimal float to unsigned integer. */ + init_dfp_1 (); + + ui = d32; + if (ui != 456U) + FAILURE + ul = d32; + if (ul != 456UL) + FAILURE + ull = d32; + if (ull != 456ULL) + FAILURE + + ui = d64; + if (ui != 23U) + FAILURE + ul = d64; + if (ul != 23UL) + FAILURE + ull = d64; + if (ull != 23ULL) + FAILURE + + ui = d128; + if (ui != 1234U) + FAILURE + ul = d128; + if (ul != 1234UL) + FAILURE + ull = d128; + if (ull != 1234ULL) + FAILURE + + /* Decimal float to signed integer. */ + + /* Decimal float to BOOL. */ + init_dfp_2 (); + + b = d32; + if (!b) + FAILURE + b = d64; + if (!b) + FAILURE + b = d128; + if (!b) + FAILURE + + /* Unsigned integer to decimal float. */ + init_unsigned_int (); + + d32 = ui; + if (d32 != 987.0df) + FAILURE + d32 = ul; + if (d32 != 345678.0df) + FAILURE + d32 = ull; + if (d32 != 1234567.df) + FAILURE + + d64 = ui; + if (d64 != 987.0dd) + FAILURE + d64 = ul; + if (d64 != 345678.0dd) + FAILURE + d64 = ull; + if (d64 != 1234567.dd) + FAILURE + + d128 = ui; + if (d128 != 987.0dl) + FAILURE + d128 = ul; + if (d128 != 345678.0dl) + FAILURE + d128 = ull; + if (d128 != 1234567.dl) + FAILURE + + /* Signed integer to decimal float. */ + init_signed_int (); + + d32 = si; + if (d32 != -987.0df) + FAILURE + d32 = sl; + if (d32 != -345678.0df) + FAILURE + d32 = sll; + if (d32 != -1234567.df) + FAILURE + + d64 = si; + if (d64 != -987.0dd) + FAILURE + d64 = sl; + if (d64 != -345678.0dd) + FAILURE + d64 = sll; + if (d64 != -1234567.dd) + FAILURE + + d128 = si; + if (d128 != -987.0dl) + FAILURE + d128 = sl; + if (d128 != -345678.0dl) + FAILURE + d128 = sll; + if (d128 != -1234567.dl) + FAILURE + + /* BOOL to decimal float. */ + init_dfp_3 (); + + b = d32; + if (b) + FAILURE + b = d64; + if (b) + FAILURE + b = d128; + if (b) + FAILURE + + FINISH +}
dfp/convert-int.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/dfp-dbg.h =================================================================== --- dfp/dfp-dbg.h (nonexistent) +++ dfp/dfp-dbg.h (revision 338) @@ -0,0 +1,20 @@ +#ifdef __cplusplus +typedef float _Decimal32 __attribute__((mode(SD))); +typedef float _Decimal64 __attribute__((mode(DD))); +typedef float _Decimal128 __attribute__((mode(TD))); + +#define EXTERN extern "C" +#else +#define EXTERN extern +#endif + +int failures; + +#ifdef DBG +extern int printf (const char *, ...); +#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; } +#define FINISH if (failures != 0) __builtin_abort (); return 0; +#else +#define FAILURE __builtin_abort (); +#define FINISH return 0; +#endif
dfp/dfp-dbg.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-special.h =================================================================== --- dfp/compare-special.h (nonexistent) +++ dfp/compare-special.h (revision 338) @@ -0,0 +1,284 @@ +/* Basic test of runtime relational comparisons using NaNs and infinities. */ + +#include +#include "dfp-dbg.h" + +#define PASTE2(A,B) A ## B +#define PASTE(A,B) PASTE2(A,B) + +/* Override FAILURE from dfp-dbg.h with one that provides additional info. */ +#undef FAILURE +#ifdef DBG +#define FAILURE(OP,KIND) \ + { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ + failures++; } +#else +#define FAILURE(OP,KIND) __builtin_abort (); +#endif + +#ifndef WIDTH +#error define WIDTH as decimal float size in bytes +#endif + +#if WIDTH == 32 +#define DTYPE _Decimal32 +#define SUFFIX DF +#define SUFFIX2 d32 +#elif WIDTH == 64 +#define DTYPE _Decimal64 +#define SUFFIX DD +#define SUFFIX2 d64 +#elif WIDTH == 128 +#define DTYPE _Decimal128 +#define SUFFIX DL +#define SUFFIX2 d128 +#elif WIDTH == 0 +/* This is for testing the test using a type known to work. */ +#define DTYPE double +#define SUFFIX +#define SUFFIX2 +#else +#error invalid width for decimal float type +#endif + +DTYPE m_two = PASTE(-2.0, SUFFIX); +DTYPE m_one = PASTE(-1.0, SUFFIX); +DTYPE zero = PASTE(0.0, SUFFIX); +DTYPE one = PASTE(1.0, SUFFIX); +DTYPE two = PASTE(2.0, SUFFIX); + +volatile DTYPE x, y, z, _nan, inf, m_inf; + +void +test_compares (void) +{ + _nan = PASTE(__builtin_nan, SUFFIX2) (""); + inf = PASTE(__builtin_inf, SUFFIX2) (); + m_inf = - PASTE(__builtin_inf, SUFFIX2) (); + + x = PASTE(__builtin_nan, SUFFIX2) (""); + y = PASTE(__builtin_inf, SUFFIX2) (); + z = - PASTE(__builtin_inf, SUFFIX2) (); + + /* Less than or equal to with NaN. */ + + if (x <= two) FAILURE ("<=", "NaN") + if (x <= zero) FAILURE ("<=", "NaN") + if (x <= m_one) FAILURE ("<=", "NaN") + if (x <= _nan) FAILURE ("<=", "NaN") + if (x <= inf) FAILURE ("<=", "NaN") + if (x <= m_inf) FAILURE ("<=", "NaN") + + if (two <= x) FAILURE ("<=", "NaN") + if (zero <= x) FAILURE ("<=", "NaN") + if (m_one <= x) FAILURE ("<=", "NaN") + if (_nan <= x) FAILURE ("<=", "NaN") + if (inf <= x) FAILURE ("<=", "NaN") + if (m_inf <= x) FAILURE ("<=", "NaN") + + /* Less than or equal to with infinities, no NaNs. */ + + if (y <= two) FAILURE ("<=", "inf") + if (y <= zero) FAILURE ("<=", "inf") + if (y <= m_one) FAILURE ("<=", "inf") + if (!(two <= y)) FAILURE ("<=", "inf") + if (!(zero <= y)) FAILURE ("<=", "inf") + if (!(m_one <= y)) FAILURE ("<=", "inf") + + if (!(z <= two)) FAILURE ("<=", "-inf") + if (!(z <= zero)) FAILURE ("<=", "-inf") + if (!(z <= m_one)) FAILURE ("<=", "-inf") + if (two <= z) FAILURE ("<=", "-inf") + if (zero <= z) FAILURE ("<=", "-inf") + if (m_one <= z) FAILURE ("<=", "-inf") + + if (!(y <= inf)) FAILURE ("<=", "inf") + if (y <= m_inf) FAILURE ("<=", "inf") + if (!(z <= inf)) FAILURE ("<=", "inf") + if (!(z <= m_inf)) FAILURE ("<=", "inf") + + /* Less than with NaN. */ + + if (x < two) FAILURE ("<", "NaN") + if (x < zero) FAILURE ("<", "NaN") + if (x < m_one) FAILURE ("<", "NaN") + if (x < _nan) FAILURE ("<", "NaN") + if (x < inf) FAILURE ("<", "NaN") + if (x < m_inf) FAILURE ("<", "NaN") + + if (two < x) FAILURE ("<", "NaN") + if (zero < x) FAILURE ("<", "NaN") + if (m_one < x) FAILURE ("<", "NaN") + if (_nan < x) FAILURE ("<", "NaN") + if (inf < x) FAILURE ("<", "NaN") + if (m_inf < x) FAILURE ("<", "NaN") + + /* Less than with infinities, no NaNs. */ + + if (y < two) FAILURE ("<", "inf") + if (y < zero) FAILURE ("<", "inf") + if (y < m_one) FAILURE ("<", "inf") + if (!(two < y)) FAILURE ("<", "inf") + if (!(zero < y)) FAILURE ("<", "inf") + if (!(m_one < y)) FAILURE ("<", "inf") + + if (!(z < two)) FAILURE ("<", "-inf") + if (!(z < zero)) FAILURE ("<", "-inf") + if (!(z < m_one)) FAILURE ("<", "-inf") + if (two < z) FAILURE ("<", "-inf") + if (zero < z) FAILURE ("<", "-inf") + if (m_one < z) FAILURE ("<", "-inf") + + if (y < inf) FAILURE ("<=", "inf") + if (y < m_inf) FAILURE ("<=", "inf") + if (!(z < inf)) FAILURE ("<=", "inf") + if (z < m_inf) FAILURE ("<=", "inf") + + /* Greater than or equal to with NaN. */ + + if (x >= two) FAILURE (">=", "NaN") + if (x >= zero) FAILURE (">=", "NaN") + if (x >= m_one) FAILURE (">=", "NaN") + if (x >= _nan) FAILURE (">=", "NaN") + if (x >= inf) FAILURE (">=", "NaN") + if (x >= m_inf) FAILURE (">=", "NaN") + + if (two >= x) FAILURE (">=", "NaN") + if (zero >= x) FAILURE (">=", "NaN") + if (m_one >= x) FAILURE (">=", "NaN") + if (_nan >= x) FAILURE (">=", "NaN") + if (inf >= x) FAILURE (">=", "NaN") + if (m_inf >= x) FAILURE (">=", "NaN") + + /* Greater than or equal to with infinities, no NaNs. */ + + if (!(y >= two)) FAILURE (">=", "inf") + if (!(y >= zero)) FAILURE (">=", "inf") + if (!(y >= m_one)) FAILURE (">=", "inf") + if (two >= y) FAILURE (">=", "inf") + if (zero >= y) FAILURE (">=", "inf") + if (m_one >= y) FAILURE (">=", "inf") + + if (z >= two) FAILURE (">=", "-inf") + if (z >= zero) FAILURE (">=", "-inf") + if (z >= m_one) FAILURE (">=", "-inf") + if (!(two >= z)) FAILURE (">=", "-inf") + if (!(zero >= z)) FAILURE (">=", "-inf") + if (!(m_one >= z)) FAILURE (">=", "-inf") + + if (!(y >= inf)) FAILURE ("<=", "inf") + if (!(y >= m_inf)) FAILURE ("<=", "inf") + if (z >= inf) FAILURE ("<=", "inf") + if (!(z >= m_inf)) FAILURE ("<=", "inf") + + /* Greater than with NaN. */ + + if (x > two) FAILURE (">", "NaN") + if (x > zero) FAILURE (">", "NaN") + if (x > m_one) FAILURE (">", "NaN") + if (x > _nan) FAILURE (">", "NaN") + if (x > inf) FAILURE (">", "NaN") + if (x > m_inf) FAILURE (">", "NaN") + + if (two > x) FAILURE (">", "NaN") + if (zero > x) FAILURE (">", "NaN") + if (m_one > x) FAILURE (">", "NaN") + if (_nan > x) FAILURE (">", "NaN") + if (inf > x) FAILURE (">", "NaN") + if (m_inf > x) FAILURE (">", "NaN") + + /* Greater than with infinities, no NaNs. */ + + if (!(y > two)) FAILURE (">", "inf") + if (!(y > zero)) FAILURE (">", "inf") + if (!(y > m_one)) FAILURE (">", "inf") + if (two > y) FAILURE (">", "inf") + if (zero > y) FAILURE (">", "inf") + if (m_one > y) FAILURE (">", "inf") + + if (z > two) FAILURE (">", "-inf") + if (z > zero) FAILURE (">", "-inf") + if (z > m_one) FAILURE (">", "-inf") + if (!(two > z)) FAILURE (">", "-inf") + if (!(zero > z)) FAILURE (">", "-inf") + if (!(m_one > z)) FAILURE (">", "-inf") + + if (y > inf) FAILURE (">", "inf") + if (!(y > m_inf)) FAILURE (">", "inf") + if (z > inf) FAILURE (">", "inf") + if (z > m_inf) FAILURE (">", "inf") + + /* Equal with NaN. */ + + if (x == two) FAILURE ("==", "NaN") + if (x == zero) FAILURE ("==", "NaN") + if (x == m_one) FAILURE ("==", "NaN") + if (x == _nan) FAILURE ("==", "NaN") + if (x == inf) FAILURE ("==", "NaN") + if (x == m_inf) FAILURE ("==", "NaN") + + if (two == x) FAILURE ("==", "NaN") + if (zero == x) FAILURE ("==", "NaN") + if (m_one == x) FAILURE ("==", "NaN") + if (_nan == x) FAILURE ("==", "NaN") + if (inf == x) FAILURE ("==", "NaN") + if (m_inf == x) FAILURE ("==", "NaN") + + /* Equal with infinities, no NaNs. */ + + if (y == two) FAILURE ("==", "inf") + if (y == zero) FAILURE ("==", "inf") + if (y == m_one) FAILURE ("==", "inf") + if (two == y) FAILURE ("==", "inf") + if (zero == y) FAILURE ("==", "inf") + if (m_one == y) FAILURE ("==", "inf") + + if (z == two) FAILURE ("==", "-inf") + if (z == zero) FAILURE ("==", "-inf") + if (z == m_one) FAILURE ("==", "-inf") + if (two == z) FAILURE ("==", "-inf") + if (zero == z) FAILURE ("==", "-inf") + if (m_one == z) FAILURE ("==", "-inf") + + if (!(y == inf)) FAILURE ("==", "inf") + if (y == m_inf) FAILURE ("==", "inf") + if (z == inf) FAILURE ("==", "inf") + if (!(z == m_inf)) FAILURE ("==", "inf") + + /* Not equal with NaN. */ + + if (!(x != two)) FAILURE ("!=", "NaN") + if (!(x != zero)) FAILURE ("!=", "NaN") + if (!(x != m_one)) FAILURE ("!=", "NaN") + if (!(x != _nan)) FAILURE ("!=", "NaN") + if (!(x != inf)) FAILURE ("!=", "NaN") + if (!(x != m_inf)) FAILURE ("!=", "NaN") + + if (!(two != x)) FAILURE ("!=", "NaN") + if (!(zero != x)) FAILURE ("!=", "NaN") + if (!(m_one != x)) FAILURE ("!=", "NaN") + if (!(_nan != x)) FAILURE ("!=", "NaN") + if (!(inf != x)) FAILURE ("!=", "NaN") + if (!(m_inf != x)) FAILURE ("!=", "NaN") + + /* Not equal with infinities, no NaNs. */ + + if (!(y != two)) FAILURE ("!=", "inf") + if (!(y != zero)) FAILURE ("!=", "inf") + if (!(y != m_one)) FAILURE ("!=", "inf") + if (!(two != y)) FAILURE ("!=", "inf") + if (!(zero != y)) FAILURE ("!=", "inf") + if (!(m_one != y)) FAILURE ("!=", "inf") + + if (!(z != two)) FAILURE ("!=", "-inf") + if (!(z != zero)) FAILURE ("!=", "-inf") + if (!(z != m_one)) FAILURE ("!=", "-inf") + if (!(two != z)) FAILURE ("!=", "-inf") + if (!(zero != z)) FAILURE ("!=", "-inf") + if (!(m_one != z)) FAILURE ("!=", "-inf") + + if (y != inf) FAILURE ("!=", "inf") + if (!(y != m_inf)) FAILURE ("!=", "inf") + if (!(z != inf)) FAILURE ("!=", "inf") + if (z != m_inf) FAILURE ("!=", "inf") +}
dfp/compare-special.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq-const.c =================================================================== --- dfp/compare-eq-const.c (nonexistent) +++ dfp/compare-eq-const.c (revision 338) @@ -0,0 +1,28 @@ +/* C99 6.5.9 Equality operators. + Compare decimal float constants against each other. */ + +#include "dfp-dbg.h" + +extern void link_error (void); + +int +main () +{ + /* Compare like-typed positive constants. */ + if (2.0df != 2.0df) + link_error (); + + /* Compare decimal float constants of different types. */ + if (500e-2dl != 0.05e2df) + link_error (); + + /* Binary floating point introduces errors to decimal values. */ + if (1.4 + 1.4 + 1.4 == 4.2) + link_error (); + + /* But, this looks more like what one would expect. */ + if (1.4dd + 1.4dd + 1.4dd != 4.2dd) + link_error (); + + FINISH +}
dfp/compare-eq-const.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel-dfp.c =================================================================== --- dfp/compare-rel-dfp.c (nonexistent) +++ dfp/compare-rel-dfp.c (revision 338) @@ -0,0 +1,53 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + Compare decimal float values against variables of different types. */ + +#include "dfp-dbg.h" + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; + +/* Use some typedefs of decimal float types, too. */ +typedef _Decimal32 SDtype; +typedef _Decimal64 DDtype; +typedef _Decimal128 TDtype; + +SDtype d32b; +DDtype d64b; +TDtype d128b; + +void +inits (void) +{ + d32 = 1.0df; + d64 = 3.0dd; + d128 = 5.0dl; + d32b = -1.0df; + d64b = -4.0dd; + d128b = -6.0dl; +} + +void +compare_dfp (void) +{ + if ((d32 > d64) != 0) FAILURE + if ((d32 >= d128b) != 1) FAILURE + + if ((d64 < d32) != 0) FAILURE + if ((d64 <= d128) != 1) FAILURE + + if ((d128 > d32) != 1) FAILURE + if ((d128 >= d64) != 1) FAILURE +} + +int +main () +{ + inits (); + + compare_dfp (); + + FINISH +}
dfp/compare-rel-dfp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-deref.c =================================================================== --- dfp/func-deref.c (nonexistent) +++ dfp/func-deref.c (revision 338) @@ -0,0 +1,205 @@ +/* C99 6.5.2.2 Function calls. + Test scalar passing and return values involving decimal floating + point types and dereferenced pointers. */ + +#include "dfp-dbg.h" + +/* A handful of functions that return their Nth _Decimal32 + argument. */ + +_Decimal32 __attribute__((noinline)) +arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg0; +} + +_Decimal32 __attribute__((noinline)) +arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg1; +} + +_Decimal32 __attribute__((noinline)) +arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg2; +} + +_Decimal32 __attribute__((noinline)) +arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg3; +} + +_Decimal32 __attribute__((noinline)) +arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg4; +} + +_Decimal32 __attribute__((noinline)) +arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, + _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth _Decimal64 + argument. */ + +_Decimal64 __attribute__((noinline)) +arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg0; +} + +_Decimal64 __attribute__((noinline)) +arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg1; +} + +_Decimal64 __attribute__((noinline)) +arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg2; +} + +_Decimal64 __attribute__((noinline)) +arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg3; +} + +_Decimal64 __attribute__((noinline)) +arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg4; +} + +_Decimal64 __attribute__((noinline)) +arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, + _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) +{ + return arg5; +} + + +/* A handful of functions that return their Nth _Decimal128 + argument. */ + +_Decimal128 __attribute__((noinline)) +arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg0; +} + +_Decimal128 __attribute__((noinline)) +arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg1; +} + +_Decimal128 __attribute__((noinline)) +arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg2; +} + +_Decimal128 __attribute__((noinline)) +arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg3; +} + +_Decimal128 __attribute__((noinline)) +arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg4; +} + +_Decimal128 __attribute__((noinline)) +arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, + _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) +{ + return arg5; +} + + + +_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df, + df3 = 3.0df, df4 = 4.0df, df5 = 5.0df; +_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2, + *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5; +_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd, + dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd; +_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2, + *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5; +_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl, + dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl; +_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2, + *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5; + +int +main () +{ + /* _Decimal32 variants. */ + if (arg0_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 0.0df) + FAILURE + if (arg1_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 1.0df) + FAILURE + if (arg2_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 2.0df) + FAILURE + if (arg3_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 3.0df) + FAILURE + if (arg4_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 4.0df) + FAILURE + if (arg5_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 5.0df) + FAILURE + + /* _Decimal64 variants. */ + if (arg0_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 0.0dd) + FAILURE + if (arg1_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 1.0dd) + FAILURE + if (arg2_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 2.0dd) + FAILURE + if (arg3_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 3.0dd) + FAILURE + if (arg4_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 4.0dd) + FAILURE + if (arg5_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 5.0dd) + FAILURE + + /* _Decimal128 variants. */ + if (arg0_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 0.0dl) + FAILURE + if (arg1_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 1.0dl) + FAILURE + if (arg2_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 2.0dl) + FAILURE + if (arg3_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 3.0dl) + FAILURE + if (arg4_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 4.0dl) + FAILURE + if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl) + FAILURE + + FINISH +}
dfp/func-deref.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-alternate-d32.c =================================================================== --- dfp/func-vararg-alternate-d32.c (nonexistent) +++ dfp/func-vararg-alternate-d32.c (revision 338) @@ -0,0 +1,19 @@ +/* Simple test of vararg passing for problematic types with and without + double values passed between them. */ + +#define DTYPE _Decimal32 +#define ONE 1.0df +#define THREE 3.0df +#define SEVEN 7.0df +#define ELEVEN 11.0df +#define INTS 1 + +#include "func-vararg-alternate.h" + +int +main () +{ + doit (); + + FINISH +}
dfp/func-vararg-alternate-d32.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-mixed-2.c =================================================================== --- dfp/func-vararg-mixed-2.c (nonexistent) +++ dfp/func-vararg-mixed-2.c (revision 338) @@ -0,0 +1,105 @@ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-mpreferred-stack-boundary=2" } */ + +/* C99 6.5.2.2 Function calls. + Test passing varargs of the combination of decimal float types and + other types. */ + +#include +#include "dfp-dbg.h" + +/* Supposing the list of varying number of arguments is: + unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */ + +static _Decimal32 +vararg_d32 (unsigned arg, ...) +{ + va_list ap; + _Decimal32 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + result = va_arg (ap, _Decimal32); + + va_end (ap); + return result; +} + +static _Decimal32 +vararg_d64 (unsigned arg, ...) +{ + va_list ap; + _Decimal64 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + va_arg (ap, double); + va_arg (ap, _Decimal32); + result = va_arg (ap, _Decimal64); + + va_end (ap); + return result; +} + +static _Decimal128 +vararg_d128 (unsigned arg, ...) +{ + va_list ap; + _Decimal128 result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + result = va_arg (ap, _Decimal128); + + va_end (ap); + return result; +} + +static unsigned int +vararg_int (unsigned arg, ...) +{ + va_list ap; + unsigned int result; + + va_start (ap, arg); + + result = va_arg (ap, unsigned int); + + va_end (ap); + return result; +} + +static double +vararg_double (unsigned arg, ...) +{ + va_list ap; + float result; + + va_start (ap, arg); + + va_arg (ap, unsigned int); + va_arg (ap, _Decimal128); + result = va_arg (ap, double); + + va_end (ap); + return result; +} + + +int +main () +{ + if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE + if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE + if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE + if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE + if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE + + FINISH +}
dfp/func-vararg-mixed-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-arith-fold.c =================================================================== --- dfp/operator-arith-fold.c (nonexistent) +++ dfp/operator-arith-fold.c (revision 338) @@ -0,0 +1,45 @@ +/* { dg-options "-O2" } */ + +/* C99 6.5.5: Multiplicative operators. + C99 6.5.6: Additive operators. */ + +#include "dfp-dbg.h" + +extern void link_error (void); + +int +main () +{ + _Decimal32 d32_1, d32_2; + + /* Compare like-typed positive constants. */ + if (2.99df + 5.1df != 8.09df) + link_error (); + + if (5.77df - 2.22dd != 3.55df) + link_error (); + + if (2.0dl * 3.7dd * -2 != -14.8df) + link_error (); + + if (.18df / -.2df + 1 != 1.e-1dd) + link_error (); + + d32_1 = 3.0df; + d32_2 = 1.0df; + + if (!__builtin_constant_p (d32_1 + 0.2df)) + link_error (); + + if (!__builtin_constant_p (1.0df / 3.0df)) + link_error (); + + if (!__builtin_constant_p (d32_2 / d32_1)) + link_error (); + + d32_2 = 2.0df; + if (!__builtin_constant_p (d32_2 / d32_1)) + link_error (); + + return 0; +}
dfp/operator-arith-fold.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr33466.c =================================================================== --- dfp/pr33466.c (nonexistent) +++ dfp/pr33466.c (revision 338) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +/* The suffix for a decimal float constant must use a single case. + + These are invalid for all targets, not just those that support + decimal float. */ + +long double dF = 4.5dF; /* { dg-error "invalid suffix" } */ +long double Df = 4.5Df; /* { dg-error "invalid suffix" } */ +long double dD = 4.5dD; /* { dg-error "invalid suffix" } */ +long double Dd = 4.5Dd; /* { dg-error "invalid suffix" } */ +long double dL = 4.5dL; /* { dg-error "invalid suffix" } */ +long double Dl = 4.5Dl; /* { dg-error "invalid suffix" } */
dfp/pr33466.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr39902.c =================================================================== --- dfp/pr39902.c (nonexistent) +++ dfp/pr39902.c (revision 338) @@ -0,0 +1,226 @@ +/* Check that optimizations like (x * 1) to x, or (x * -1) to -x, + do not apply to decimal float computations where trailing zeroes + are significant. */ + +#include "dfp-dbg.h" + +#define COMPARE32(A,B) \ + A.i == B.i + +#define COMPARE64(A,B) \ + A.i[0] == B.i[0] && A.i[1] == B.i[1] + +#define COMPARE128(A,B) \ + A.i[0] == B.i[0] && A.i[1] == B.i[1] && A.i[2] == B.i[2] && A.i[3] == B.i[3] + +typedef union { + _Decimal32 d; + unsigned int i; +} u32; + +typedef union { + _Decimal64 d; + unsigned int i[2]; +} u64; + +typedef union { + _Decimal128 d; + unsigned int i[4]; +} u128; + +volatile u32 p32_1; +volatile u32 p32_1_0; +volatile u32 p32_2_0; +volatile u32 m32_1; +volatile u32 m32_1_0; +volatile u32 m32_2_0; +volatile u32 a32; + +volatile u64 p64_1; +volatile u64 p64_1_0; +volatile u64 p64_2_0; +volatile u64 m64_1; +volatile u64 m64_1_0; +volatile u64 m64_2_0; +volatile u64 a64; + +volatile u128 p128_1; +volatile u128 p128_1_0; +volatile u128 p128_2_0; +volatile u128 m128_1; +volatile u128 m128_1_0; +volatile u128 m128_2_0; +volatile u128 a128; + +void +init32 (void) +{ + p32_1.d = 1.DF; + p32_1_0.d = 1.0DF; + p32_2_0.d = 2.0DF; + m32_1.d = -1.DF; + m32_1_0.d = -1.0DF; + m32_2_0.d = -2.0DF; +} + +void +init64 (void) +{ + p64_1.d = 1.DD; + p64_1_0.d = 1.0DD; + p64_2_0.d = 2.0DD; + m64_1.d = -1.DD; + m64_1_0.d = -1.0DD; + m64_2_0.d = -2.0DD; +} + +void +init128 (void) +{ + p128_1.d = 1.DL; + p128_1_0.d = 1.0DL; + p128_2_0.d = 2.0DL; + m128_1.d = -1.DL; + m128_1_0.d = -1.0DL; + m128_2_0.d = -2.0DL; +} + +void +doit32 (void) +{ + /* Multiplying by a value with no trailing zero should not change the + quantum exponent. */ + + a32.d = p32_2_0.d * p32_1.d; + if (! (COMPARE32 (a32, p32_2_0))) + FAILURE + + a32.d = p32_2_0.d * 1.DF; + if (! (COMPARE32 (a32, p32_2_0))) + FAILURE + + a32.d = p32_2_0.d * m32_1.d; + if (! (COMPARE32 (a32, m32_2_0))) + FAILURE + + a32.d = p32_2_0.d * -1.DF; + if (! (COMPARE32 (a32, m32_2_0))) + FAILURE + + /* Multiplying by a value with a trailing zero should change the + quantum exponent. */ + + a32.d = p32_2_0.d * p32_1_0.d; + if (COMPARE32 (a32, p32_2_0)) + FAILURE + + a32.d = p32_2_0.d * 1.0DF; + if (COMPARE32 (a32, p32_2_0)) + FAILURE + + a32.d = p32_2_0.d * m32_1_0.d; + if (COMPARE32 (a32, m32_2_0)) + FAILURE + + a32.d = p32_2_0.d * -1.0DF; + if (COMPARE32 (a32, m32_2_0)) + FAILURE +} + +void +doit64 (void) +{ + /* Multiplying by a value with no trailing zero should not change the + quantum exponent. */ + + a64.d = p64_2_0.d * p64_1.d; + if (! (COMPARE64 (a64, p64_2_0))) + FAILURE + + a64.d = p64_2_0.d * 1.DD; + if (! (COMPARE64 (a64, p64_2_0))) + FAILURE + + a64.d = p64_2_0.d * m64_1.d; + if (! (COMPARE64 (a64, m64_2_0))) + FAILURE + + a64.d = p64_2_0.d * -1.DD; + if (! (COMPARE64 (a64, m64_2_0))) + FAILURE + + /* Multiplying by a value with a trailing zero should change the + quantum exponent. */ + + a64.d = p64_2_0.d * p64_1_0.d; + if (COMPARE64 (a64, p64_2_0)) + FAILURE + + a64.d = p64_2_0.d * 1.0DD; + if (COMPARE64 (a64, p64_2_0)) + FAILURE + + a64.d = p64_2_0.d * m64_1_0.d; + if (COMPARE64 (a64, m64_2_0)) + FAILURE + + a64.d = p64_2_0.d * -1.0DD; + if (COMPARE64 (a64, m64_2_0)) + FAILURE +} + +void +doit128 (void) +{ + /* Multiplying by a value with no trailing zero should not change the + quantum exponent. */ + + a128.d = p128_2_0.d * p128_1_0.d; + if (COMPARE128 (a128, p128_2_0)) + FAILURE + + a128.d = p128_2_0.d * 1.0DL; + if (COMPARE128 (a128, p128_2_0)) + FAILURE + + a128.d = p128_2_0.d * m128_1_0.d; + if (COMPARE128 (a128, m128_2_0)) + FAILURE + + a128.d = p128_2_0.d * -1.0DL; + if (COMPARE128 (a128, m128_2_0)) + FAILURE + + /* Multiplying by a value with a trailing zero should change the + quantum exponent. */ + + a128.d = p128_2_0.d * p128_1.d; + if (! (COMPARE128 (a128, p128_2_0))) + FAILURE + + a128.d = p128_2_0.d * 1.DL; + if (! (COMPARE128 (a128, p128_2_0))) + FAILURE + + a128.d = p128_2_0.d * m128_1.d; + if (! (COMPARE128 (a128, m128_2_0))) + FAILURE + + a128.d = p128_2_0.d * -1.DL; + if (! (COMPARE128 (a128, m128_2_0))) + FAILURE +} + +int +main (void) +{ + init32 (); + init64 (); + init128 (); + + doit32 (); + doit64 (); + doit128 (); + + FINISH +}
dfp/pr39902.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/constants-zero.c =================================================================== --- dfp/constants-zero.c (nonexistent) +++ dfp/constants-zero.c (revision 338) @@ -0,0 +1,159 @@ +/* { dg-options "-O0" } */ + +/* Decimal float values can have significant trailing zeroes. This is + true for zero values as well. Check that various representations of + zero are handled correctly when specified as literal constants. */ + +#include "dfp-dbg.h" + +int big_endian; + +typedef union U32 { + unsigned int i; + _Decimal32 d; + unsigned char b[4]; +} u32_t; + +typedef union U64 { + unsigned long long i; + _Decimal64 d; +} u64_t; + +typedef union U128 { + unsigned long long i[2]; + _Decimal128 d; +} u128_t; + +int +compare32 (_Decimal32 d, unsigned int i) +{ + u32_t u; + + u.d = d; + return (u.i == i); +} + +int +compare64 (_Decimal64 d, unsigned long long i) +{ + u64_t u; + + u.d = d; + return (u.i == i); +} + +int +compare128 (_Decimal64 d, unsigned long long i, unsigned long long j) +{ + u128_t u; + + u.d = d; + if (big_endian) + return (u.i[0] == i && u.i[1] == j); + else + return (u.i[1] == i && u.i[0] == j); +} + +void +dpd_tests (void) +{ + if (! compare32 (0.DF, 0x22500000U)) + FAILURE + if (! compare32 (-0.DF, 0xa2500000U)) + FAILURE + if (! compare32 (0.E-4DF, 0x22100000U)) + FAILURE + if (! compare32 (0.E-7DF, 0x21e00000U)) + FAILURE + if (! compare32 (0.E+3DF, 0x22800000U)) + FAILURE + + if (! compare64 (0.DD, 0x2238000000000000ULL)) + FAILURE + if (! compare64 (-0.DD, 0xa238000000000000ULL)) + FAILURE + if (! compare64 (0.E-6DD, 0x2220000000000000ULL)) + FAILURE + if (! compare64 (0.E-7DD, 0x221c000000000000ULL)) + FAILURE + if (! compare64 (0.E+2DD, 0x2240000000000000ULL)) + FAILURE + + if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL)) + FAILURE +} + +void +bid_tests (void) +{ + if (! compare32 (0.DF, 0x32800000U)) + FAILURE + if (! compare32 (-0.DF, 0xb2800000U)) + FAILURE + if (! compare32 (0.E-4DF, 0x30800000U)) + FAILURE + if (! compare32 (0.E-7DF, 0x2f000000U)) + FAILURE + if (! compare32 (0.E+3DF, 0x34000000U)) + FAILURE + + if (! compare64 (0.DD, 0x31c0000000000000ULL)) + FAILURE + if (! compare64 (-0.DD, 0xb1c0000000000000ULL)) + FAILURE + if (! compare64 (0.E-6DD, 0x3100000000000000ULL)) + FAILURE + if (! compare64 (0.E-7DD, 0x30e0000000000000ULL)) + FAILURE + if (! compare64 (0.E+2DD, 0x3200000000000000ULL)) + FAILURE + + if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL)) + FAILURE + if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL)) + FAILURE +} + +int +main () +{ + u32_t u32; + + /* These sizes are probably always true for targets that support decimal + float types, but check anyway. Abort so we can fix the test. */ + if ((sizeof (_Decimal64) != sizeof (long long)) + || (sizeof (_Decimal128) != 2 * sizeof (long long)) + || (sizeof (_Decimal32) != sizeof (_Decimal32))) + FAILURE + + u32.d = 1.DF; + + if (u32.i == 0x22500001) + { + big_endian = (u32.b[0] == 0x22); + dpd_tests (); + } + else if (u32.i == 0x32800001) + { + big_endian = (u32.b[0] == 0x32); + bid_tests (); + } + else + FAILURE /* unknown format; test problem */ + + FINISH +}
dfp/constants-zero.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/struct-layout-1.c =================================================================== --- dfp/struct-layout-1.c (nonexistent) +++ dfp/struct-layout-1.c (revision 338) @@ -0,0 +1,71 @@ +#include +#include "dfp-dbg.h" + +struct S1 +{ + _Decimal64 a[0]; +}; + +struct S2 +{ + struct + { + _Decimal64 e; + } b[0]; +}; + +struct S3 +{ + union + { + _Decimal64 c; + } a[0]; +}; + +struct S4 +{ + int a[0]; + _Decimal64 b[0]; +}; + +struct S5 +{ + union + { + _Decimal64 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) + FAILURE; + if (check_var (2, s2, 2LL) == 0) + FAILURE; + if (check_var (2, s3, 2LL) == 0) + FAILURE; + if (check_var (2, s4, 2LL) == 0) + FAILURE; + if (check_var (2, s5, 2LL) == 0) + FAILURE; + + FINISH +}
dfp/struct-layout-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-eq.h =================================================================== --- dfp/compare-eq.h (nonexistent) +++ dfp/compare-eq.h (revision 338) @@ -0,0 +1,92 @@ +/* Basic test of runtime equality comparisons using simple values that + are not affected by rounding. */ + +#include +#include "dfp-dbg.h" + +#define PASTE2(A,B) A ## B +#define PASTE(A,B) PASTE2(A,B) + +#undef FAILURE +#ifdef DBG +#define FAILURE(OP,KIND) \ + { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ + failures++; } +#else +#define FAILURE(OP,KIND) __builtin_abort (); +#endif + +#ifndef WIDTH +#error define WIDTH as decimal float size in bytes +#endif + +#if WIDTH == 32 +#define DTYPE _Decimal32 +#define SUFFIX DF +#elif WIDTH == 64 +#define DTYPE _Decimal64 +#define SUFFIX DD +#elif WIDTH == 128 +#define DTYPE _Decimal128 +#define SUFFIX DL +#elif WIDTH == 0 +/* This is for testing the test using a type known to work. */ +#define DTYPE double +#define SUFFIX +#else +#error invalid width for decimal float type +#endif + +DTYPE m_two = PASTE(-2.0, SUFFIX); +DTYPE m_one = PASTE(-1.0, SUFFIX); +DTYPE zero = PASTE(0.0, SUFFIX); +DTYPE one = PASTE(1.0, SUFFIX); +DTYPE two = PASTE(2.0, SUFFIX); + +void +test_compares (void) +{ + DTYPE x = one; + DTYPE y = zero; + DTYPE z = m_one; + + /* Equal to: comparisons against equal values. */ + + if (! (x == one)) FAILURE ("==", "equal") + if (! (y == zero)) FAILURE ("==", "equal") + if (! (z == m_one)) FAILURE ("==", "equal") + + /* Equal to: comparisons against lesser values. */ + + if (x == m_one) FAILURE ("==", "lesser") + if (x == zero) FAILURE ("==", "lesser") + if (y == m_one) FAILURE ("==", "lesser") + if (z == m_two) FAILURE ("==", "lesser") + + /* Equal to: comparisons against greater values. */ + + if (x == two) FAILURE ("==", "greater") + if (y == one) FAILURE ("==", "greater") + if (z == zero) FAILURE ("==", "greater") + if (z == one) FAILURE ("==", "greater") + + /* Not equal to: comparisons against equal values. */ + + if (x != one) FAILURE ("!=", "equal") + if (y != zero) FAILURE ("!=", "equal") + if (z != m_one) FAILURE ("!=", "equal") + + /* Not equal to: comparisons against lesser values. */ + + if (! (x != m_one)) FAILURE ("!=", "lesser") + if (! (x != zero)) FAILURE ("!=", "lesser") + if (! (y != m_one)) FAILURE ("!=", "lesser") + if (! (z != m_two)) FAILURE ("!=", "lesser") + + /* Not equal to: comparisons against greater values. */ + + if (! (x != m_one)) FAILURE ("!=", "greater") + if (! (x != zero)) FAILURE ("!=", "greater") + if (! (y != m_one)) FAILURE ("!=", "greater") + if (! (z != m_two)) FAILURE ("!=", "greater") +}
dfp/compare-eq.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-int-saturate.c =================================================================== --- dfp/convert-int-saturate.c (nonexistent) +++ dfp/convert-int-saturate.c (revision 338) @@ -0,0 +1,64 @@ +/* N1150 5.1 Conversion between decimal floating integer. + C99 6.3.1.4(1a) New. + Test integer saturation. */ + +#ifndef __STDC_WANT_DEC_FP__ +#define __STDC_WANT_DEC_FP__ 1 +#endif + +#include "dfp-dbg.h" +#include +#include + +volatile _Decimal32 d32; +volatile _Decimal64 d64; +volatile _Decimal128 d128; + +volatile signed int si; +volatile unsigned int usi; +volatile unsigned long long udi; + +int +main () +{ + + /* Unsigned. */ + usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (usi != UINT_MAX) + FAILURE + + usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (usi != UINT_MAX) + FAILURE + + usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (usi != UINT_MAX) + FAILURE + + /* Signed. */ + si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MAX) + FAILURE + + si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MAX) + FAILURE + + si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MAX) + FAILURE + + si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MIN) + FAILURE + + si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MIN) + FAILURE + + si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ + if (si != INT_MIN) + FAILURE + + FINISH +}
dfp/convert-int-saturate.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-rel-d64.c =================================================================== --- dfp/compare-rel-d64.c (nonexistent) +++ dfp/compare-rel-d64.c (revision 338) @@ -0,0 +1,14 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + Compare decimal float values against each other at runtime. */ + +#define WIDTH 64 +#include "compare-rel.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-rel-d64.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-10.c =================================================================== --- dfp/convert-bfp-10.c (nonexistent) +++ dfp/convert-bfp-10.c (revision 338) @@ -0,0 +1,107 @@ +/* This test assumes IEEE float and double. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; + +/* Conversions using denormalized float values. */ +CONVERT_VALID (111, sf, sd, 1.2e-38f, 1.2e-38df, 0.df) +CONVERT_VALID (112, sf, sd, 1.1e-38f, 1.1e-38df, 0.df) +CONVERT_VALID (113, sf, sd, 1.1e-40f, 1.1e-40df, 1.1e-45df) + +CONVERT_VALID (121, sd, sf, 1.2e-38df, 1.2e-38f, 0.f) +CONVERT_VALID (122, sd, sf, 1.1e-38df, 1.1e-38f, 0.f) + +CONVERT_VALID (131, sf, sd, -1.2e-38f, -1.2e-38df, 0.df) +CONVERT_VALID (132, sf, sd, -1.1e-38f, -1.1e-38df, 0.df) + +CONVERT_VALID (141, sd, sf, -1.2e-38df, -1.2e-38f, 0.f) +CONVERT_VALID (142, sd, sf, -1.1e-38df, -1.1e-38f, 0.f) + +/* Conversions using denormalized double values. */ +CONVERT_VALID (211, df, sd, 1.2e-38, 1.2e-38df, 0.df) +CONVERT_VALID (212, df, sd, 1.1e-38, 1.1e-38df, 0.df) +CONVERT_VALID (213, df, sd, 1.e-40, 1.e-40df, 0.df) +CONVERT_VALID (214, df, sd, 8.e-44, 8.e-44df, 0.df) +CONVERT_VALID (215, df, sd, 9.e-44, 9.e-44df, 0.df) +CONVERT_VALID (216, df, sd, 8.e-46, 8.e-46df, 0.df) +CONVERT_VALID (217, df, sd, 7.e-46, 7.e-46df, 0.df) + +CONVERT_VALID (221, sd, df, 1.2e-38df, 1.2e-38, 1.e-53) +CONVERT_VALID (222, sd, df, 1.1e-38df, 1.1e-38, 1.e-53) +CONVERT_VALID (223, sd, df, 1.e-40df, 1.e-40, 0.) +CONVERT_VALID (224, sd, df, 8.e-44df, 8.e-44, 0.) +CONVERT_VALID (225, sd, df, 9.e-44df, 9.e-44, 0.) +CONVERT_VALID (226, sd, df, 8.e-46df, 8.e-46, 0.) +CONVERT_VALID (227, sd, df, 7.e-46df, 7.e-46, 0.) + +CONVERT_VALID (231, df, sd, -1.2e-38, -1.2e-38df, 0.df) +CONVERT_VALID (232, df, sd, -1.1e-38f, -1.1e-38df, 0.df) +CONVERT_VALID (233, df, sd, -1.e-40, -1.e-40df, 0.df) +CONVERT_VALID (234, df, sd, -8.e-44, -8.e-44df, 0.df) +CONVERT_VALID (235, df, sd, -9.e-44, -9.e-44df, 0.df) +CONVERT_VALID (236, df, sd, -8.e-46, -8.e-46df, 0.df) +CONVERT_VALID (237, df, sd, -7.e-46, -7.e-46df, 0.df) + +CONVERT_VALID (241, sd, df, -1.2e-38df, -1.2e-38, 1.e-53) +CONVERT_VALID (242, sd, df, -1.1e-38df, -1.1e-38, 1.e-53) +CONVERT_VALID (243, sd, df, -1.e-40df, -1.e-40, 0.) +CONVERT_VALID (244, sd, df, -8.e-44df, -8.e-44, 0.) +CONVERT_VALID (245, sd, df, -9.e-44df, -9.e-44, 0.) +CONVERT_VALID (246, sd, df, -8.e-46df, -8.e-46, 0.) +CONVERT_VALID (247, sd, df, -7.e-46df, -7.e-46, 0.) + +int +main () +{ + convert_111 (); + convert_112 (); + convert_113 (); + + convert_121 (); + convert_122 (); + + convert_131 (); + convert_132 (); + + convert_141 (); + convert_142 (); + + convert_211 (); + convert_212 (); + convert_213 (); + convert_214 (); + convert_215 (); + convert_216 (); + convert_217 (); + + convert_221 (); + convert_222 (); + convert_223 (); + convert_224 (); + convert_225 (); + convert_226 (); + convert_227 (); + + convert_231 (); + convert_232 (); + convert_233 (); + convert_234 (); + convert_235 (); + convert_236 (); + convert_237 (); + + convert_241 (); + convert_242 (); + convert_243 (); + convert_244 (); + convert_245 (); + convert_246 (); + convert_247 (); + + FINISH +}
dfp/convert-bfp-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-alternate-d128-2.c =================================================================== --- dfp/func-vararg-alternate-d128-2.c (nonexistent) +++ dfp/func-vararg-alternate-d128-2.c (revision 338) @@ -0,0 +1,22 @@ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-mpreferred-stack-boundary=2" } */ + +/* Simple test of vararg passing for problematic types with and without + double values passed between them. */ + +#define DTYPE _Decimal128 +#define ONE 1.0dl +#define THREE 3.0dl +#define SEVEN 7.0dl +#define ELEVEN 11.0dl +#define INTS 4 + +#include "func-vararg-alternate.h" + +int +main () +{ + doit (); + + FINISH +}
dfp/func-vararg-alternate-d128-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-size0.c =================================================================== --- dfp/func-vararg-size0.c (nonexistent) +++ dfp/func-vararg-size0.c (revision 338) @@ -0,0 +1,41 @@ +/* C99 6.5.2.2 Function calls. */ + +#include +#include "dfp-dbg.h" + +struct S1 +{ + struct + { + _Decimal64 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) + FAILURE + + FINISH +}
dfp/func-vararg-size0.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-alternate-d128.c =================================================================== --- dfp/func-vararg-alternate-d128.c (nonexistent) +++ dfp/func-vararg-alternate-d128.c (revision 338) @@ -0,0 +1,19 @@ +/* Simple test of vararg passing for problematic types with and without + double values passed between them. */ + +#define DTYPE _Decimal128 +#define ONE 1.0dl +#define THREE 3.0dl +#define SEVEN 7.0dl +#define ELEVEN 11.0dl +#define INTS 4 + +#include "func-vararg-alternate.h" + +int +main () +{ + doit (); + + FINISH +}
dfp/func-vararg-alternate-d128.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr39986.c =================================================================== --- dfp/pr39986.c (nonexistent) +++ dfp/pr39986.c (revision 338) @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +#include "dfp-dbg.h" + +/* Check that the compiler generates the correct decimal float constants. */ + +_Decimal32 a = 100.223df; +_Decimal32 b = -2.3df; +_Decimal64 c = 3.4e-4dd; +_Decimal64 d = -4.500dd; +_Decimal128 e = 5678901234567.89e+200dl; +_Decimal128 f = -678901.234e-6dl; + +/* The first value is DPD, the second is BID. The order differs depending + on whether the target is big-endian or little-endian. */ + +/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */ + +/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */ + +/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */ +/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */ + +/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */ +/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */ + +/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */ +/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */ +/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */ + +/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */ +/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */
dfp/pr39986.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-12.c =================================================================== --- dfp/convert-bfp-12.c (nonexistent) +++ dfp/convert-bfp-12.c (revision 338) @@ -0,0 +1,16 @@ +/* Test for bug where fold wrongly removed conversions to double and + replaced them by conversions to float. */ + +#include "dfp-dbg.h" + +volatile float f = __builtin_inff (); +volatile _Decimal32 d32 = 1e40DF; + +int +main (void) +{ + if ((double) f == (double) d32) + FAILURE + + FINISH +}
dfp/convert-bfp-12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-14.c =================================================================== --- dfp/convert-bfp-14.c (nonexistent) +++ dfp/convert-bfp-14.c (revision 338) @@ -0,0 +1,15 @@ +/* Test for bug where fold narrowed decimal floating-point + operations. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 f = 1.23456DF; +volatile _Decimal64 d = 1.23456DD; + +int +main (void) +{ + if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d)) + FAILURE + FINISH +}
dfp/convert-bfp-14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/nan-2.c =================================================================== --- dfp/nan-2.c (nonexistent) +++ dfp/nan-2.c (revision 338) @@ -0,0 +1,53 @@ +/* N1150 4: Characteristics of decimal floating types (not explicit) + C99 5.2.4.2.2: Characteristics of floating types. + A few simple checks on arithmetic operations. Based on nan-1.c with + the consideration of negative zero. */ + +#include "dfp-dbg.h" + +int main() +{ + _Decimal32 d32; + _Decimal64 d64; + _Decimal128 d128; + + /* Verify that division by negative zero produces a negative infinity + result. */ + d32 = 123.45f; + if (d32/-0.0df != -__builtin_infd32()) + FAILURE + if (123.45df/-0.0df != -__builtin_infd32()) + FAILURE + + d64 = 123.45f; + if (d64/-0.0dd != -__builtin_infd64()) + FAILURE + if (123.45dd/-0.0dd != -__builtin_infd64()) + FAILURE + + d128 = 123.45f; + if (d128/-0.0dl != -__builtin_infd64()) + FAILURE + if (123.45dl/-0.0dl != -__builtin_infd128()) + FAILURE + + d32 = 0.0df; + if (!__builtin_isnand32(-(d32/-0.0df))) + FAILURE + if (!__builtin_isnand32(-(0.0df/-0.0df))) + FAILURE + + d64 = 0.0dd; + if (!__builtin_isnand64(-(d64/-0.0dd))) + FAILURE + if (!__builtin_isnand64(-(0.0dd/-0.0dd))) + FAILURE + + d128 = 0.0dl; + if (!__builtin_isnand128(-(d128/-0.0dl))) + FAILURE + if (!__builtin_isnand128(-(0.0dl/-0.0dl))) + FAILURE + + FINISH +}
dfp/nan-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-cond.c =================================================================== --- dfp/operator-cond.c (nonexistent) +++ dfp/operator-cond.c (revision 338) @@ -0,0 +1,57 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.15 Conditional operator. + Test with decimal float operands. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 d32a, d32b, d32c; +volatile _Decimal64 d64a, d64b, d64c; +volatile _Decimal128 d128a, d128b, d128c; +volatile int i, yes, no; + +void +init () +{ + d32b = 123.456e94df; + d64b = 12.3456789012345e383dd; + d128b = 12345.6789012345678901e4000dl; + + d32c = 1.3df; + d64c = 1.2dd; + d128c = 1.1dl; + + i = 2; + yes = 1; + no = 0; +} + +int +main () +{ + init (); + + /* Operands and the result are all the same decimal float type. */ + d32a = yes ? d32b : d32c; + if (d32a != d32b) + FAILURE + d64a = no ? d64b : d64c; + if (d64a != d64c) + FAILURE + d128a = yes ? d128b : d128c; + if (d128a != d128b) + FAILURE + + /* Operand types are different. */ + d128a = yes ? d32b : d64b; + if (d128a != d32b) + FAILURE + d128a = yes ? d128b : d64b; + if (d128a != d128b) + FAILURE + d128a = no ? d32b : d128b; + if (d128a != d128b) + FAILURE + + FINISH +}
dfp/operator-cond.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-dfp.c =================================================================== --- dfp/func-vararg-dfp.c (nonexistent) +++ dfp/func-vararg-dfp.c (revision 338) @@ -0,0 +1,95 @@ +/* C99 6.5.2.2 Function calls. + Test passing varargs of the decimal float types. */ + +#include +#include "dfp-dbg.h" + +static _Decimal32 +vararg32 (unsigned arg, ...) +{ + int i; + va_list ap; + _Decimal32 result; + + va_start (ap, arg); + for (i = 0; i <= arg; i++) + result = va_arg (ap, _Decimal32); + va_end (ap); + return result; +} + +static _Decimal64 +vararg64 (unsigned arg, ...) +{ + int i; + va_list ap; + _Decimal64 result; + + va_start (ap, arg); + for (i = 0; i <= arg; i++) + result = va_arg (ap, _Decimal64); + va_end (ap); + return result; +} + +static _Decimal128 +vararg128 (unsigned arg, ...) +{ + int i; + va_list ap; + _Decimal128 result; + + va_start (ap, arg); + for (i = 0; i <= arg; i++) + result = va_arg (ap, _Decimal128); + va_end (ap); + return result; +} + + +int main() +{ + /* _Decimal32 variants. */ + if (vararg32 (0, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df) + FAILURE + if (vararg32 (1, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df) + FAILURE + if (vararg32 (2, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df) + FAILURE + if (vararg32 (3, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df) + FAILURE + if (vararg32 (4, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df) + FAILURE + if (vararg32 (5, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df) + FAILURE + + /* _Decimal64 variants. */ + if (vararg64 (0, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd) + FAILURE + if (vararg64 (1, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd) + FAILURE + if (vararg64 (2, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd) + FAILURE + if (vararg64 (3, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd) + FAILURE + if (vararg64 (4, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd) + FAILURE + if (vararg64 (5, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd) + FAILURE + + /* _Decimal128 variants. */ + if (vararg128 (0, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl) + FAILURE + if (vararg128 (1, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl) + FAILURE + if (vararg128 (2, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl) + FAILURE + if (vararg128 (3, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl) + FAILURE + if (vararg128 (4, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl) + FAILURE + if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl) + FAILURE + + FINISH +}
dfp/func-vararg-dfp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr36800.c =================================================================== --- dfp/pr36800.c (nonexistent) +++ dfp/pr36800.c (revision 338) @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +#include +#include "dfp-dbg.h" + +void +f (int a, ...) +{ + va_list ap; + if (a != 0) + FAILURE + va_start (ap, a); + if (va_arg (ap, _Decimal128) != 1.2DL) + FAILURE + if (va_arg (ap, _Decimal128) != 2.34DL) + FAILURE + if (va_arg (ap, _Decimal128) != 3.456DL) + FAILURE + if (va_arg (ap, _Decimal128) != 4.567DL) + FAILURE + if (va_arg (ap, double) != 5.125) + FAILURE + va_end (ap); +} + +int +main (void) +{ + f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125); + + FINISH +}
dfp/pr36800.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/func-vararg-alternate-d64.c =================================================================== --- dfp/func-vararg-alternate-d64.c (nonexistent) +++ dfp/func-vararg-alternate-d64.c (revision 338) @@ -0,0 +1,19 @@ +/* Simple test of vararg passing for problematic types with and without + double values passed between them. */ + +#define DTYPE _Decimal64 +#define ONE 1.0dd +#define THREE 3.0dd +#define SEVEN 7.0dd +#define ELEVEN 11.0dd +#define INTS 2 + +#include "func-vararg-alternate.h" + +int +main () +{ + doit (); + + FINISH +}
dfp/func-vararg-alternate-d64.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-2.c =================================================================== --- dfp/convert-bfp-2.c (nonexistent) +++ dfp/convert-bfp-2.c (revision 338) @@ -0,0 +1,33 @@ +/* This test assumes IEEE float and double. It also tests long double + but makes no assumption about its size or range of values. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; /* might actually be df or xf, doesn't matter */ + +CONVERT_VALID_ALL (t1, 0.0, 0.) +CONVERT_VALID_ALL (t2, 1.0, 0.) +CONVERT_VALID_ALL (t3, -11.5, 0.) +CONVERT_VALID_ALL (t4, 7.0, 0.1e-14) +CONVERT_VALID_ALL (t5, -7.0, 0.1e-14) +CONVERT_VALID_ALL (t6, 999999., 0.) +CONVERT_VALID_ALL (t7, -999999., 0.) + +int +main () +{ + CALL_VALID_ALL (t1) + CALL_VALID_ALL (t2) + CALL_VALID_ALL (t3) + CALL_VALID_ALL (t4) + CALL_VALID_ALL (t5) + CALL_VALID_ALL (t6) + CALL_VALID_ALL (t7) + + FINISH +}
dfp/convert-bfp-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/pr39034.c =================================================================== --- dfp/pr39034.c (nonexistent) +++ dfp/pr39034.c (revision 338) @@ -0,0 +1,100 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +/* DFP TR 24732 == WG14 / N1176, N1312 */ +/* Based on a test from Fred Tydeman. */ + +#include "dfp-dbg.h" + +/* Test runtime computations. */ + +void +runtime32 (void) +{ + volatile float v1 = 28.f, v2 = 3.f, v3 = 9.f, v4 = 31.f, v5 = 3.f, v6 = 10.f; + float b32 = (float)((v1/v2-v3) - (v4/v5-v6)); + _Decimal32 d32 = (float)((v1/v2-v3) - (v4/v5-v6)); + + if (b32) + FAILURE + if (d32) + FAILURE +} + +void +runtime64 (void) +{ + volatile double v1 = 28., v2 = 3., v3 = 9., v4 = 31., v5 = 3., v6 = 10.; + double b64 = (double)((v1/v2-v3) - (v4/v5-v6)); + _Decimal64 d64 = (double)((v1/v2-v3) - (v4/v5-v6)); + + if (b64) + FAILURE + if (d64) + FAILURE +} + +void +runtime128 (void) +{ + volatile long double v1 = 28.l, v2 = 3.l, v3 = 9.l, + v4 = 31.l, v5 = 3.l, v6 = 10.l; + long double b128 = (long double)((v1/v2-v3) - (v4/v5-v6)); + _Decimal128 d128 = (long double)((v1/v2-v3) - (v4/v5-v6)); + + if (b128) + FAILURE + if (d128) + FAILURE +} + +/* Test constant folding. */ + +void +fold32 (void) +{ + double d32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f)); + _Decimal32 b32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f)); + + if (b32) + FAILURE + if (d32) + FAILURE +} + +void +fold64 (void) +{ + double b64 = (double)((28./3.-9.) - (31./3.-10.)); + _Decimal64 d64 = (double)((28./3.-9.) - (31./3.-10.)); + + if (b64) + FAILURE + if (d64) + FAILURE +} + +void +fold128 (void) +{ + long double b128 = (long double)((28./3.-9.) - (31./3.-10.)); + _Decimal128 d128 = (long double)((28./3.-9.) - (31./3.-10.)); + + if (b128) + FAILURE + if (d128) + FAILURE +} + +int +main () +{ + runtime32 (); + runtime64 (); + runtime128 (); + fold32 (); + fold64 (); + fold128 (); + + FINISH +}
dfp/pr39034.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert.h =================================================================== --- dfp/convert.h (nonexistent) +++ dfp/convert.h (revision 338) @@ -0,0 +1,462 @@ +#include "dfp-dbg.h" + +/* Macros are set up to skip using long double, which doesn't necessarily + map to TF mode. If there's a reason to skip those for a test, the + test itself can define USE_TF to be zero. */ +#ifndef USE_TF +#define USE_TF 1 +#endif + +/* Provide more information with FAILURE than what is available with + the version of that macro in dfp-dbg.h. */ + +#undef FAILURE +#if defined(DBG) || defined(DBG2) +#include +#define FAILURE(NUM) \ + { printf ("failed for test %s\n", NUM); failures++; } +#else +#define FAILURE(N) __builtin_abort (); +#endif + +/* This is useful when modifying the test to make sure that tests are + actually run. */ +#if defined(DBG2) +#define REPORT(NUM) \ + { printf ("%s\n", NUM); } +#else +#define REPORT(N) ; +#endif + +#define CONVERT_VALID(NUM,FROM,TO,FROMVAL,TOVAL,DIFF) \ +void \ +convert_##NUM (void) \ +{ \ + REPORT(#NUM " " #FROMVAL) \ + FROM = FROMVAL; \ + TO = FROM; \ + if (TO < (TOVAL - DIFF) || TO > (TOVAL + DIFF)) \ + FAILURE (#NUM); \ +} + +#define CONVERT_TO_PINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \ +void \ +convert_##NUM (void) \ +{ \ + REPORT(#NUM " " #FROMVAL) \ + FROM = FROMVAL; \ + TO = FROM; \ + if (__builtin_isinf##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " pinf: isinf"); \ + if (__builtin_signbit##TOSUFFIX (TO) != 0) \ + FAILURE (#NUM " pinf: sign"); \ +} + +#define CONVERT_TO_MINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \ +void \ +convert_##NUM (void) \ +{ \ + REPORT(#NUM " " #FROMVAL) \ + FROM = FROMVAL; \ + TO = FROM; \ + if (__builtin_isinf##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " pinf: isinf"); \ + if (__builtin_signbit##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " pinf: sign"); \ +} + +#define CONVERT_TO_PZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \ +void \ +convert_##NUM (void) \ +{ \ + REPORT(#NUM " " #FROMVAL) \ + FROM = FROMVAL; \ + TO = FROM; \ + if (TO != TOVAL) \ + FAILURE (#NUM "_pzero: zero") \ + if (__builtin_signbit##TOSUFFIX (TO) != 0) \ + FAILURE (#NUM " _pzero: sign"); \ +} + +#define CONVERT_TO_MZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \ +void \ +convert_##NUM (void) \ +{ \ + REPORT(#NUM " " #FROMVAL) \ + FROM = FROMVAL; \ + TO = FROM; \ + if (TO != TOVAL) \ + FAILURE (#NUM "_mzero: zero") \ + if (__builtin_signbit##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " _mzero: sign"); \ +} + +#define CONVERT_NAN(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \ +void \ +convert_##NUM##_nan (void) \ +{ \ + REPORT(#NUM "_nan") \ + FROM = __builtin_nan##FROMSUFFIX (""); \ + TO = FROM; \ + if (__builtin_isnan##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " nan"); \ +} + +#define CONVERT_PINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \ +void \ +convert_##NUM##_pinf (void) \ +{ \ + REPORT (#NUM "_pinf") \ + FROM = __builtin_inf##FROMSUFFIX (); \ + TO = FROM; \ + if (__builtin_isinf##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " pinf: isinf"); \ + if (__builtin_signbit##TOSUFFIX (TO) != 0) \ + FAILURE (#NUM " pinf: sign"); \ +} + +#define CONVERT_MINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \ +void \ +convert_##NUM##_minf (void) \ +{ \ + REPORT (#NUM "_minf") \ + FROM = -__builtin_inf##FROMSUFFIX (); \ + TO = FROM; \ + if (__builtin_isinf##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " minf: isinf"); \ + if (__builtin_signbit##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " minf: sign"); \ +} + +#define CONVERT_PZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \ +void \ +convert_##NUM##_pzero (void) \ +{ \ + REPORT (#NUM "_pzero") \ + FROM = FROMVALUE; \ + TO = FROM; \ + if (TO != TOVALUE) \ + FAILURE (#NUM "pzero: zero") \ + if (__builtin_signbit##TOSUFFIX (TO) != 0) \ + FAILURE (#NUM " pzero: sign"); \ +} + +#define CONVERT_MZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \ +void \ +convert_##NUM##_mzero (void) \ +{ \ + REPORT (#NUM "_mzero") \ + FROM = FROMVALUE; \ + TO = FROM; \ + if (TO != TOVALUE) \ + FAILURE (#NUM "mzero: zero") \ + if (__builtin_signbit##TOSUFFIX (TO) == 0) \ + FAILURE (#NUM " mzero: sign"); \ +} + +#define CONVERT_VALID_NOTF(NUM,VAL,DIFF) \ +CONVERT_VALID (NUM##_sdsf, sd, sf, VAL##df, VAL##f, DIFF##f) \ +CONVERT_VALID (NUM##_sddf, sd, df, VAL##df, VAL, DIFF) \ +CONVERT_VALID (NUM##_ddsf, dd, sf, VAL##dd, VAL##f, DIFF##f) \ +CONVERT_VALID (NUM##_dddf, dd, df, VAL##dd, VAL, DIFF) \ +CONVERT_VALID (NUM##_tdsf, td, sf, VAL##dl, VAL##f, DIFF##f) \ +CONVERT_VALID (NUM##_tddf, td, df, VAL##dl, VAL, DIFF) \ +CONVERT_VALID (NUM##_sfsd, sf, sd, VAL##f, VAL##df, DIFF##df) \ +CONVERT_VALID (NUM##_sfdd, sf, dd, VAL##f, VAL##dd, DIFF##dd) \ +CONVERT_VALID (NUM##_sftd, sf, td, VAL##f, VAL##dl, DIFF##dl) \ +CONVERT_VALID (NUM##_dfsd, df, sd, VAL, VAL##df, DIFF##df) \ +CONVERT_VALID (NUM##_dfdd, df, dd, VAL, VAL##dd, DIFF##dd) \ +CONVERT_VALID (NUM##_dftd, df, td, VAL, VAL##dl, DIFF##dl) \ +CONVERT_VALID (NUM##_sddd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \ +CONVERT_VALID (NUM##_sdtd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \ +CONVERT_VALID (NUM##_ddsd, dd, sd, VAL##dd, VAL##df, DIFF##dd) \ +CONVERT_VALID (NUM##_ddtd, dd, td, VAL##dd, VAL##dl, DIFF##dl) \ +CONVERT_VALID (NUM##_tdsd, td, sd, VAL##dl, VAL##df, DIFF##df) \ +CONVERT_VALID (NUM##_tddd, td, dd, VAL##dl, VAL##dd, DIFF##dd) + +#if USE_TF == 0 +#define CONVERT_VALID_TF(NUM,VAL,DIFF) +#else +#define CONVERT_VALID_TF(NUM,VAL,DIFF) \ +CONVERT_VALID (NUM##_sdtf, sd, tf, VAL##df, VAL##l, DIFF##l) \ +CONVERT_VALID (NUM##_tdtf, td, tf, VAL##dl, VAL##l, DIFF##l) \ +CONVERT_VALID (NUM##_ddtf, dd, tf, VAL##dd, VAL##l, DIFF##l) \ +CONVERT_VALID (NUM##_tfsd, tf, sd, VAL##l, VAL##df, DIFF##df) \ +CONVERT_VALID (NUM##_tfdd, tf, dd, VAL##l, VAL##dd, DIFF##dd) \ +CONVERT_VALID (NUM##_tftd, tf, td, VAL##l, VAL##dl, DIFF##dl) +#endif + +#define CONVERT_VALID_ALL(NUM,VAL,DIFF) \ + CONVERT_VALID_NOTF(NUM,VAL,DIFF) \ + CONVERT_VALID_TF(NUM,VAL,DIFF) + +#define CALL_VALID_NOTF(NUM) \ + convert_##NUM##_sdsf (); \ + convert_##NUM##_sddf (); \ + convert_##NUM##_ddsf (); \ + convert_##NUM##_dddf (); \ + convert_##NUM##_tdsf (); \ + convert_##NUM##_tddf (); \ + convert_##NUM##_sfsd (); \ + convert_##NUM##_sfdd (); \ + convert_##NUM##_sftd (); \ + convert_##NUM##_dfsd (); \ + convert_##NUM##_dfdd (); \ + convert_##NUM##_dftd (); \ + convert_##NUM##_sddd (); \ + convert_##NUM##_sdtd (); \ + convert_##NUM##_ddsd (); \ + convert_##NUM##_ddtd (); \ + convert_##NUM##_tdsd (); \ + convert_##NUM##_tddd (); + +#if USE_TF == 0 +#define CALL_VALID_TF(NUM) +#else +#define CALL_VALID_TF(NUM) \ + convert_##NUM##_sdtf (); \ + convert_##NUM##_ddtf (); \ + convert_##NUM##_tdtf (); \ + convert_##NUM##_tfsd (); \ + convert_##NUM##_tfdd (); \ + convert_##NUM##_tftd (); +#endif + +#define CALL_VALID_ALL(NUM) \ + CALL_VALID_NOTF(NUM) \ + CALL_VALID_TF(NUM) + +#define CONVERT_ZEROES(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \ +CONVERT_PZERO(NUM, FROM, TO, FROMVALUE, TOVALUE, TOSUFFIX) \ +CONVERT_MZERO(NUM, FROM, TO, -FROMVALUE, -TOVALUE, TOSUFFIX) + +#define CONVERT_ZEROES_NOTF(NUM) \ +CONVERT_ZEROES (NUM##_sdsf, sd, sf, 0.0df, 0.0f, f) \ +CONVERT_ZEROES (NUM##_sddf, sd, df, 0.0df, 0.0, ) \ +CONVERT_ZEROES (NUM##_ddsf, dd, sf, 0.0dd, 0.0f, f) \ +CONVERT_ZEROES (NUM##_dddf, dd, df, 0.0dd, 0.0, ) \ +CONVERT_ZEROES (NUM##_tdsf, td, sf, 0.0dl, 0.0f, f) \ +CONVERT_ZEROES (NUM##_tddf, td, df, 0.0dl, 0.0, ) \ +CONVERT_ZEROES (NUM##_sfsd, sf, sd, 0.0f, 0.0df, d32) \ +CONVERT_ZEROES (NUM##_sfdd, sf, dd, 0.0f, 0.0dd, d64) \ +CONVERT_ZEROES (NUM##_sftd, sf, td, 0.0f, 0.0dl, d128) \ +CONVERT_ZEROES (NUM##_dfsd, df, sd, 0.0, 0.0df, d32) \ +CONVERT_ZEROES (NUM##_dfdd, df, dd, 0.0, 0.0dd, d64) \ +CONVERT_ZEROES (NUM##_dftd, df, td, 0.0, 0.0dl, d128) \ +CONVERT_ZEROES (NUM##_sddd, sd, dd, 0.0df, 0.0dd, d64) \ +CONVERT_ZEROES (NUM##_sdtd, sd, td, 0.0dl, 0.0dl, d128) \ +CONVERT_ZEROES (NUM##_ddsd, dd, sd, 0.0dd, 0.0df, d32) \ +CONVERT_ZEROES (NUM##_ddtd, dd, td, 0.0dd, 0.0dl, d128) \ +CONVERT_ZEROES (NUM##_tdsd, td, sd, 0.0dl, 0.0df, d32) \ +CONVERT_ZEROES (NUM##_tddd, td, dd, 0.0dl, 0.0dd, d64) + +#if USE_TF == 0 +#define CONVERT_ZEROES_TF(NUM) +#else +#define CONVERT_ZEROES_TF(NUM) \ +CONVERT_ZEROES (NUM##_sdtf, sd, tf, 0.0df, 0.0l, l) \ +CONVERT_ZEROES (NUM##_ddtf, dd, tf, 0.0dd, 0.0l, l) \ +CONVERT_ZEROES (NUM##_tdtf, td, tf, 0.0dl, 0.0l, l) \ +CONVERT_ZEROES (NUM##_tfsd, tf, sd, 0.0l, 0.0df, d32) \ +CONVERT_ZEROES (NUM##_tfdd, tf, dd, 0.0l, 0.0dd, d64) \ +CONVERT_ZEROES (NUM##_tftd, tf, td, 0.0l, 0.0dl, d128) +#endif + +#define CONVERT_ZEROES_ALL(NUM) \ + CONVERT_ZEROES_NOTF(NUM) \ + CONVERT_ZEROES_TF(NUM) + +#define CALL_ZEROES(NUM) \ + convert_##NUM##_pzero (); \ + convert_##NUM##_mzero (); + +#define CALL_ZEROES_NOTF(NUM) \ + CALL_ZEROES (NUM##_sdsf) \ + CALL_ZEROES (NUM##_sddf) \ + CALL_ZEROES (NUM##_ddsf) \ + CALL_ZEROES (NUM##_dddf) \ + CALL_ZEROES (NUM##_tdsf) \ + CALL_ZEROES (NUM##_tddf) \ + CALL_ZEROES (NUM##_sfsd) \ + CALL_ZEROES (NUM##_sfdd) \ + CALL_ZEROES (NUM##_sftd) \ + CALL_ZEROES (NUM##_dfsd) \ + CALL_ZEROES (NUM##_dfdd) \ + CALL_ZEROES (NUM##_dftd) \ + CALL_ZEROES (NUM##_sddd) \ + CALL_ZEROES (NUM##_sdtd) \ + CALL_ZEROES (NUM##_ddsd) \ + CALL_ZEROES (NUM##_ddtd) \ + CALL_ZEROES (NUM##_tdsd) \ + CALL_ZEROES (NUM##_tddd) + +#if USE_TF == 0 +#define CALL_ZEROES_TF(NUM) +#else +#define CALL_ZEROES_TF(NUM) \ + CALL_ZEROES (NUM##_sdtf) \ + CALL_ZEROES (NUM##_ddtf) \ + CALL_ZEROES (NUM##_tdtf) \ + CALL_ZEROES (NUM##_tfsd) \ + CALL_ZEROES (NUM##_tfdd) \ + CALL_ZEROES (NUM##_tftd) +#endif + +#define CALL_ZEROES_ALL(NUM) \ + CALL_ZEROES_NOTF(NUM) \ + CALL_ZEROES_TF(NUM) + +#define CONVERT_INF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \ +CONVERT_PINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX) \ +CONVERT_MINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX) + +#define CONVERT_INF_NOTF(NUM) \ +CONVERT_INF (NUM##_sdsf, sd, sf, d32, f) \ +CONVERT_INF (NUM##_sddf, sd, df, d32, ) \ +CONVERT_INF (NUM##_ddsf, dd, sf, d64, f) \ +CONVERT_INF (NUM##_dddf, dd, df, d64, ) \ +CONVERT_INF (NUM##_tdsf, td, sf, d128, f) \ +CONVERT_INF (NUM##_tddf, td, df, d128, ) \ +CONVERT_INF (NUM##_sfsd, sf, sd, f, d32) \ +CONVERT_INF (NUM##_sfdd, sf, dd, f, d64) \ +CONVERT_INF (NUM##_sftd, sf, td, f, d128) \ +CONVERT_INF (NUM##_dfsd, df, sd, , d32) \ +CONVERT_INF (NUM##_dfdd, df, dd, , d64) \ +CONVERT_INF (NUM##_dftd, df, td, , d128) \ +CONVERT_INF (NUM##_sddd, sd, dd, d32, d64) \ +CONVERT_INF (NUM##_sdtd, sd, td, d32, d128) \ +CONVERT_INF (NUM##_ddsd, dd, sd, d64, d32) \ +CONVERT_INF (NUM##_ddtd, dd, td, d64, d128) \ +CONVERT_INF (NUM##_tdsd, td, sd, d128, d32) \ +CONVERT_INF (NUM##_tddd, td, dd, d128, d64) + +#if USE_TF == 0 +#define CONVERT_INF_TF(NUM) +#else +#define CONVERT_INF_TF(NUM) \ +CONVERT_INF (NUM##_sdtf, sd, tf, d32, l) \ +CONVERT_INF (NUM##_ddtf, dd, tf, d64, l) \ +CONVERT_INF (NUM##_tdtf, td, tf, d128, l) \ +CONVERT_INF (NUM##_tfsd, tf, sd, l, d32) \ +CONVERT_INF (NUM##_tfdd, tf, dd, l, d64) \ +CONVERT_INF (NUM##_tftd, tf, td, l, d128) +#endif + +#define CONVERT_INF_ALL(NUM) \ + CONVERT_INF_NOTF(NUM) \ + CONVERT_INF_TF(NUM) + +#define CALL_INF(NUM) \ + convert_##NUM##_pinf (); \ + convert_##NUM##_minf (); + +#define CALL_INF_NOTF(NUM) \ + CALL_INF (NUM##_sdsf) \ + CALL_INF (NUM##_sddf) \ + CALL_INF (NUM##_ddsf) \ + CALL_INF (NUM##_dddf) \ + CALL_INF (NUM##_tdsf) \ + CALL_INF (NUM##_tddf) \ + CALL_INF (NUM##_sfsd) \ + CALL_INF (NUM##_sfdd) \ + CALL_INF (NUM##_sftd) \ + CALL_INF (NUM##_dfsd) \ + CALL_INF (NUM##_dfdd) \ + CALL_INF (NUM##_dftd) \ + CALL_INF (NUM##_sddd) \ + CALL_INF (NUM##_sdtd) \ + CALL_INF (NUM##_ddsd) \ + CALL_INF (NUM##_ddtd) \ + CALL_INF (NUM##_tdsd) \ + CALL_INF (NUM##_tddd) + +#if USE_TF == 0 +#define CALL_INF_TF(NUM) +#else +#define CALL_INF_TF(NUM) \ + CALL_INF (NUM##_sdtf) \ + CALL_INF (NUM##_ddtf) \ + CALL_INF (NUM##_tdtf) \ + CALL_INF (NUM##_tfsd) \ + CALL_INF (NUM##_tfdd) \ + CALL_INF (NUM##_tftd) +#endif + +#define CALL_INF_ALL(NUM) \ + CALL_INF_NOTF(NUM) \ + CALL_INF_TF(NUM) + +#define CONVERT_NAN_NOTF(NUM) \ +CONVERT_NAN (NUM##_sdsf, sd, sf, d32, f) \ +CONVERT_NAN (NUM##_sddf, sd, df, d32, ) \ +CONVERT_NAN (NUM##_ddsf, dd, sf, d64, f) \ +CONVERT_NAN (NUM##_dddf, dd, df, d64, ) \ +CONVERT_NAN (NUM##_tdsf, td, sf, d128, f) \ +CONVERT_NAN (NUM##_tddf, td, df, d128, ) \ +CONVERT_NAN (NUM##_sfsd, sf, sd, f, d32) \ +CONVERT_NAN (NUM##_sfdd, sf, dd, f, d64) \ +CONVERT_NAN (NUM##_sftd, sf, td, f, d128) \ +CONVERT_NAN (NUM##_dfsd, df, sd, , d32) \ +CONVERT_NAN (NUM##_dfdd, df, dd, , d64) \ +CONVERT_NAN (NUM##_dftd, df, td, , d128) \ +CONVERT_NAN (NUM##_sddd, sd, dd, d32, d64) \ +CONVERT_NAN (NUM##_sdtd, sd, td, d32, d128) \ +CONVERT_NAN (NUM##_ddsd, dd, sd, d64, d32) \ +CONVERT_NAN (NUM##_ddtd, dd, td, d64, d128) \ +CONVERT_NAN (NUM##_tdsd, td, sd, d128, d32) \ +CONVERT_NAN (NUM##_tddd, td, dd, d128, d64) + +#if USE_TF == 0 +#define CONVERT_NAN_TF(NUM) +#else +#define CONVERT_NAN_TF(NUM) \ +CONVERT_NAN (NUM##_sdtf, sd, tf, d32, l) \ +CONVERT_NAN (NUM##_ddtf, dd, tf, d64, l) \ +CONVERT_NAN (NUM##_tdtf, td, tf, d128, l) \ +CONVERT_NAN (NUM##_tfsd, tf, sd, l, d32) \ +CONVERT_NAN (NUM##_tfdd, tf, dd, l, d64) \ +CONVERT_NAN (NUM##_tftd, tf, td, l, d128) +#endif + +#define CONVERT_NAN_ALL(NUM) \ + CONVERT_NAN_NOTF(NUM) \ + CONVERT_NAN_TF(NUM) + +#define CALL_NAN(NUM) \ + convert_##NUM##_nan (); + +#define CALL_NAN_NOTF(NUM) \ + CALL_NAN (NUM##_sdsf) \ + CALL_NAN (NUM##_sddf) \ + CALL_NAN (NUM##_ddsf) \ + CALL_NAN (NUM##_dddf) \ + CALL_NAN (NUM##_tdsf) \ + CALL_NAN (NUM##_tddf) \ + CALL_NAN (NUM##_sfsd) \ + CALL_NAN (NUM##_sfdd) \ + CALL_NAN (NUM##_sftd) \ + CALL_NAN (NUM##_dfsd) \ + CALL_NAN (NUM##_dfdd) \ + CALL_NAN (NUM##_dftd) \ + CALL_NAN (NUM##_sddd) \ + CALL_NAN (NUM##_sdtd) \ + CALL_NAN (NUM##_ddsd) \ + CALL_NAN (NUM##_ddtd) \ + CALL_NAN (NUM##_tdsd) \ + CALL_NAN (NUM##_tddd) + +#if USE_TF == 0 +#define CALL_NAN_TF(NUM) +#else +#define CALL_NAN_TF(NUM) \ + CALL_NAN (NUM##_sdtf) \ + CALL_NAN (NUM##_ddtf) \ + CALL_NAN (NUM##_tdtf) \ + CALL_NAN (NUM##_tfsd) \ + CALL_NAN (NUM##_tfdd) \ + CALL_NAN (NUM##_tftd) +#endif + +#define CALL_NAN_ALL(NUM) \ + CALL_NAN_NOTF(NUM) \ + CALL_NAN_TF(NUM)
dfp/convert.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-4.c =================================================================== --- dfp/convert-bfp-4.c (nonexistent) +++ dfp/convert-bfp-4.c (revision 338) @@ -0,0 +1,21 @@ +/* This test assumes IEEE float and double. It also tests long double + but makes no assumption about its size or range of values. */ + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; /* might actually be df or xf, doesn't matter */ + +CONVERT_INF_ALL (t); + +int +main () +{ + CALL_INF_ALL (t) + + FINISH +}
dfp/convert-bfp-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/operator-unary.c =================================================================== --- dfp/operator-unary.c (nonexistent) +++ dfp/operator-unary.c (revision 338) @@ -0,0 +1,52 @@ +/* C99 6.5.3 Unary operators. */ + +#include "dfp-dbg.h" + +#define AUTO_INCREASE_DECREASE(TYPE,SUFFIX) \ +do \ +{ \ + _Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX; \ + if (in_de_d##TYPE++) FAILURE \ + if (--in_de_d##TYPE) FAILURE \ + if (++in_de_d##TYPE == 0.0##SUFFIX) FAILURE \ + if (in_de_d##TYPE-- == 0.0##SUFFIX) FAILURE \ +} while(0) + +#define UNARY_OPERATOR(TYPE,SUFFIX) \ +do \ +{ \ + _Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX; \ + _Decimal##TYPE* unary_dp##TYPE; \ + /* & operator. */ \ + unary_dp##TYPE = &(unary_d##TYPE); \ + /* * operator. */ \ + unary_d##TYPE = *(unary_dp##TYPE); \ + /* - operator. */ \ + unary_d##TYPE = -unary_d##TYPE; \ + if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \ + /* + operator. */ \ + unary_d##TYPE = +unary_d##TYPE; \ + if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \ + if (!unary_d##TYPE) FAILURE /*! operator. */ \ +} while (0) + +int +main () +{ + /* C99 6.5.3.1 Prefix increment and decrement operators. */ + AUTO_INCREASE_DECREASE(32, DF); + AUTO_INCREASE_DECREASE(64, DD); + AUTO_INCREASE_DECREASE(128, DL); + + /* C99 6.5.3 Unary operators. */ + UNARY_OPERATOR(32, DF); + UNARY_OPERATOR(64, DD); + UNARY_OPERATOR(128, DL); + + /* C99 6.5.3 Unary operators for zero values. */ + if (- +0.df != -0.df) FAILURE + if (+ -0.df != -0.df) FAILURE + if (- -0.df != +0.df) FAILURE + + FINISH +}
dfp/operator-unary.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-6.c =================================================================== --- dfp/convert-bfp-6.c (nonexistent) +++ dfp/convert-bfp-6.c (revision 338) @@ -0,0 +1,178 @@ +/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */ +/* { dg-options "-w" } */ + +/* This test assumes IEEE float and double. */ + +#define __STDC_WANT_DEC_FP__ +#include + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; +volatile long double tf; + +CONVERT_VALID (101, td, sf, 0.000488281251dl, 0.00048828125f, 0.f) + +/* 2**(-25) = 0.298023223876953125E-7. */ +CONVERT_VALID (102, td, sf, 2.98023223876953125e-8dl, 2.9802322387695312e-08f, + 01.e-13f) + +/* Fractional part doesn't fit. */ +CONVERT_VALID (103, df, sd, 1.0e-20, 1.0e-20df, 0.df) + +/* Exact power of 2. */ +CONVERT_VALID (104, df, sd, 0.00048828125, 0.00048828125df, 0.df) +CONVERT_VALID (105, df, sd, 1.0e-96, 0.dd, DEC32_MIN) + +/* A value slightly less than FLT_MAX can be converted in both directions. */ +CONVERT_VALID (201, sf, sd, 3.402819e+38f, 3.402819e+38df, 0.df) +CONVERT_VALID (202, sd, sf, 3.402819e+38df, 3.402819e+38f, 0.f) +CONVERT_VALID (203, sf, dd, 3.402819e+38f, 3.402819e+38dd, 1.e+30dd) +CONVERT_VALID (204, dd, sf, 3.402819e+38dd, 3.402819e+38f, 0.f) +CONVERT_VALID (205, sf, td, 3.402819e+38f, 3.402819e+38dl, 1.e+30dl) +CONVERT_VALID (206, td, sf, 3.402819e+38dl, 3.402819e+38f, 0.f) + +/* A value slightly less than DEC32_MAX can be converted in both directions. */ +CONVERT_VALID (211, sd, df, 9.999998e96df, 9.999998e96, 0.) +CONVERT_VALID (212, df, sd, 9.999998e96, 9.999998e96df, 0.df) + +/* A value slightly less than DBL_MAX can be converted in both directions. */ +CONVERT_VALID (221, df, dd, 1.79768e+308, 1.79768e+308dd, 0.dd) +CONVERT_VALID (222, dd, df, 1.79768e+308dd, 1.79768e+308, 0.) +CONVERT_VALID (223, df, td, 1.79768e+308, 1.79768e+308dl, 1.e292dl) +CONVERT_VALID (224, td, df, 1.79768e+308dl, 1.79768e+308, 0.) + +/* An integral value with 6 digits (FLT_DIG) can be converted between float + and _Decimal32 in both directions. */ +CONVERT_VALID (301, sd, sf, 100000.DF, 100000.F, 0.F) +CONVERT_VALID (302, sf, sd, 100000.F, 100000.DF, 0.DF) +CONVERT_VALID (303, sd, sf, 999999.DF, 999999.F, 0.F) +CONVERT_VALID (304, sf, sd, 999999.F, 999999.DF, 0.DF) + +/* An integral value with 7 digits (DEC32_MANT_DIG) can be converted between + _Decimal32 and double in both directions. */ +CONVERT_VALID (311, sd, df, 1000000.DF, 1000000., 0.) +CONVERT_VALID (312, df, sd, 1000000., 1000000.DF, 0.DF) +CONVERT_VALID (313, sd, df, 9999999.DF, 9999999., 0.) +CONVERT_VALID (314, df, sd, 9999999., 9999999.DF, 0.DF) + +/* An integral value with 15 digits (DBL_DIG) can be converted between + double and _Decimal64 in both directions. */ +CONVERT_VALID (321, dd, df, 100000000000000.DD, 100000000000000., 0.) +CONVERT_VALID (322, df, dd, 100000000000000., 100000000000000.DD, 0.DD); +CONVERT_VALID (323, dd, df, 999999999999999.DD, 999999999999999., 0.); +CONVERT_VALID (324, df, dd, 999999999999999., 999999999999999.DD, 0.DD); + +/* If LDBL_DIG is at least 16, an integral value with 16 digits can be + converted between _Decimal64 and long double in both directions. */ +CONVERT_VALID (331, dd, tf, 1000000000000000.DD, 1000000000000000.L, 0.L) +CONVERT_VALID (332, td, dd, 1000000000000000.L, 1000000000000000.DD, 0.DD) +CONVERT_VALID (333, dd, tf, 9999999999999999.DD, 9999999999999999.L, 0.L) +CONVERT_VALID (334, td, dd, 9999999999999999.L, 9999999999999999.DD, 0.DD) + +/* If LDBL_DIG is at least 18, an integral value with 18 digits can be + converted between long double and _Decimal128 in both directions. */ +CONVERT_VALID (341, td, tf, 100000000000000000.DL, 100000000000000000.L, 0.L) +CONVERT_VALID (342, tf, td, 100000000000000000.L, 100000000000000000.DL, 0.DL) +CONVERT_VALID (343, td, tf, 999999999999999999.DL, 999999999999999999.L, 0.L) +CONVERT_VALID (344, tf, td, 999999999999999999.L, 999999999999999999.DL, 0.DL) + +/* If LDBL_DIG is at least 31, an integral value with 31 digits can be + converted between long double and _Decimal128 in both directions. */ +CONVERT_VALID (351, td, tf, 1000000000000000000000000000000.DL, + 1000000000000000000000000000000.L, 0.L) +CONVERT_VALID (352, tf, td, 1000000000000000000000000000000.L, + 1000000000000000000000000000000.DL, 0.DL) +CONVERT_VALID (353, td, tf, 9999999999999999999999999999999.DL, + 9999999999999999999999999999999.L, 0.L) +CONVERT_VALID (354, tf, td, 9999999999999999999999999999999.L, + 9999999999999999999999999999999.DL, 0.DL) + +/* If LDBL_DIG is at least 33, an integral value with 33 digits can be + converted between long double and _Decimal128 in both directions. */ +CONVERT_VALID (361, td, tf, 100000000000000000000000000000000.DL, + 100000000000000000000000000000000.L, 0.L) +CONVERT_VALID (362, tf, td, 100000000000000000000000000000000.L, + 100000000000000000000000000000000.DL, 0.DL) +CONVERT_VALID (363, td, tf, 999999999999999999999999999999999.DL, + 999999999999999999999999999999999.L, 0.L) +CONVERT_VALID (364, tf, td, 999999999999999999999999999999999.L, + 999999999999999999999999999999999.DL, 0.DL) + +int +main () +{ + convert_101 (); + convert_102 (); + convert_103 (); + convert_104 (); + convert_105 (); + + convert_201 (); + convert_202 (); + convert_203 (); + convert_204 (); + convert_205 (); + convert_206 (); + + convert_211 (); + convert_212 (); + + convert_221 (); + convert_222 (); + convert_223 (); + convert_224 (); + + convert_301 (); + convert_302 (); + convert_303 (); + convert_304 (); + + convert_311 (); + convert_312 (); + convert_313 (); + convert_314 (); + + convert_321 (); + convert_322 (); + convert_323 (); + convert_324 (); + + if (LDBL_DIG >= 16) + { + convert_331 (); + convert_332 (); + convert_333 (); + convert_334 (); + } + + if (LDBL_DIG >= 18) + { + convert_341 (); + convert_342 (); + convert_343 (); + convert_344 (); + } + + if (LDBL_DIG >= 31) + { + convert_351 (); + convert_352 (); + convert_353 (); + convert_354 (); + } + + if (LDBL_DIG >= 33) + { + convert_361 (); + convert_362 (); + convert_363 (); + convert_364 (); + } + + FINISH +}
dfp/convert-bfp-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/compare-special-d32.c =================================================================== --- dfp/compare-special-d32.c (nonexistent) +++ dfp/compare-special-d32.c (revision 338) @@ -0,0 +1,15 @@ +/* { dg-options "-O0" } */ + +/* C99 6.5.8 Relational operators. + C99 6.5.9 Equality operators. + Compare decimal float special values at runtime. */ + +#define WIDTH 32 +#include "compare-special.h" + +int +main () +{ + test_compares (); + FINISH +}
dfp/compare-special-d32.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/cast.c =================================================================== --- dfp/cast.c (nonexistent) +++ dfp/cast.c (revision 338) @@ -0,0 +1,75 @@ +/* C99 6.5.4 Cast operators. + Test valid casts involving decimal float. */ + +#include "dfp-dbg.h" + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; + +static float f = 2.f; +static double d = 2.l; + +int +main (void) +{ + /* Casts between DFP types. */ + d32 = 1.2df; + d64 = 1.2dd; + d128 = 1.2dl; + + if (d32 != (_Decimal32) d64) + FAILURE + if (d32 != (_Decimal32) d128) + FAILURE + + if (d64 != (_Decimal64) d32) + FAILURE + if (d64 != (_Decimal64) d128) + FAILURE + + if (d128 != (_Decimal128) d32) + FAILURE + if (d128 != (_Decimal128) d64) + FAILURE + + /* Casts between generic and decimal floating point types. Use a + value that we can assume can be represented exactly in all + representations. */ + + d32 = 2.0df; + d64 = 2.0dd; + d128 = 2.0dl; + + /* To generic floating types. */ + if ((float) d32 != 2.0f) + FAILURE + if ((double) d32 != 2.0l) + FAILURE + if ((float) d64 != 2.0f) + FAILURE + if ((double) d64 != 2.0l) + FAILURE + if ((float) d128 != 2.0f) + FAILURE + if ((double) d128 != 2.0l) + FAILURE + + /* float to decimal floating types. */ + if (d32 != (_Decimal32) f) + FAILURE + if (d64 != (_Decimal64) f) + FAILURE + if (d128 != (_Decimal128) f) + FAILURE + + /* double to decimal floating types. */ + if (d32 != (_Decimal32) d) + FAILURE + if (d64 != (_Decimal64) d) + FAILURE + if (d128 != (_Decimal128) d) + FAILURE + + FINISH +}
dfp/cast.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/convert-bfp-8.c =================================================================== --- dfp/convert-bfp-8.c (nonexistent) +++ dfp/convert-bfp-8.c (revision 338) @@ -0,0 +1,71 @@ +/* { dg-options "-w" } */ + +/* This test assumes IEEE float and double. */ + +#define __STDC_WANT_DEC_FP__ +#include + +#include "convert.h" + +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; +volatile float sf; +volatile double df; + +/* Values slightly smaller than minimum (closest to zero) for result type. */ +CONVERT_VALID (401, sd, sf, 1.e-39df, 0.f, FLT_MIN) +CONVERT_VALID (402, sd, sf, -1.e-39df, 0.f, FLT_MIN) +CONVERT_VALID (403, sd, sf, 1.1e-38df, 0.f, FLT_MIN) +CONVERT_VALID (404, sd, sf, -1.1e-38df, 0.f, FLT_MIN) + +CONVERT_VALID (411, dd, sf, 1.e-39dd, 0.f, FLT_MIN) +CONVERT_VALID (412, dd, sf, -1.e-39dd, 0.f, FLT_MIN) +CONVERT_VALID (413, dd, sf, 1.1e-38dd, 0.f, FLT_MIN) +CONVERT_VALID (414, dd, sf, -1.1e-38dd, 0.f, FLT_MIN) + +CONVERT_VALID (421, dd, df, 3.e-309dd, 0., DBL_MIN) +CONVERT_VALID (422, dd, df, -3.e-309dd, 0., DBL_MIN) +CONVERT_VALID (423, dd, df, 2.e-308dd, 0., DBL_MIN) +CONVERT_VALID (424, dd, df, -2.e-308dd, 0., DBL_MIN) + +CONVERT_VALID (431, td, sf, 1.e-39dl, 0.f, FLT_MIN) +CONVERT_VALID (432, td, sf, -1.e-39dl, 0.f, FLT_MIN) +CONVERT_VALID (433, td, sf, 1.1e-38dl, 0.f, FLT_MIN) +CONVERT_VALID (434, td, sf, -1.1e-38dl, 0.f, FLT_MIN) + +CONVERT_VALID (441, td, df, 3.e-309dl, 0., DBL_MIN) +CONVERT_VALID (442, td, df, -3.e-309dl, 0., DBL_MIN) +CONVERT_VALID (443, td, df, 2.e-308dl, 0., DBL_MIN) +CONVERT_VALID (444, td, df, -2.e-308dl, 0., DBL_MIN) + +int +main () +{ + convert_401 (); + convert_402 (); + convert_403 (); + convert_404 (); + + convert_411 (); + convert_412 (); + convert_413 (); + convert_414 (); + + convert_421 (); + convert_422 (); + convert_423 (); + convert_424 (); + + convert_431 (); + convert_432 (); + convert_433 (); + convert_434 (); + + convert_441 (); + convert_442 (); + convert_443 (); + convert_444 (); + + FINISH +}
dfp/convert-bfp-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dfp/signbit-1.c =================================================================== --- dfp/signbit-1.c (nonexistent) +++ dfp/signbit-1.c (revision 338) @@ -0,0 +1,40 @@ +/* { dg-options "-O0" } */ + +/* Decimal float versions of __builtin_signbit. */ + +#include "dfp-dbg.h" + +#define CHECK32(D,I) \ + if ((__builtin_signbitd32 (D) != 0) != I) FAILURE + +#define CHECK64(D,I) \ + if ((__builtin_signbitd64 (D) != 0) != I) FAILURE + +#define CHECK128(D,I) \ + if ((__builtin_signbitd128 (D) != 0) != I) FAILURE + +/* Prevent the compiler from folding the calls at compile time. */ +volatile _Decimal32 sd; +volatile _Decimal64 dd; +volatile _Decimal128 td; + +int +main () +{ + sd = 1.9df; CHECK32 (sd, 0) + sd = -5.3df; CHECK32 (sd, 1) + sd = 0.0df; CHECK32 (sd, 0) + sd = -0.0df; CHECK32 (sd, 1) + + dd = 1.9dd; CHECK64 (dd, 0) + dd = -5.3dd; CHECK64 (dd, 1) + dd = 0.0dd; CHECK64 (dd, 0) + dd = -0.0dd; CHECK64 (dd, 1) + + td = 1.9dl; CHECK128 (td, 0) + td = -5.3dl; CHECK128 (td, 1) + td = 0.0dl; CHECK128 (td, 0) + td = -0.0dl; CHECK128 (td, 1) + + FINISH +}
dfp/signbit-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-1.c =================================================================== --- raw-string-1.c (nonexistent) +++ raw-string-1.c (revision 338) @@ -0,0 +1,141 @@ +// { dg-do run } +// { dg-require-effective-target wchar } +// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +#ifndef __cplusplus +#include + +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; +#endif + +const char s0[] = R"(a\ +\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb +c)"; +const char s1[] = "a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; +const char s2[] = R"*|*(a\ +b +c)" +c)*|" +c)*|*"; +const char s3[] = "a\\\nb\nc)\"\nc)*|\"\nc"; +// The ) in ??) below is part of the raw string suffix )". +const char s4[] = R"(??/ +??/ +??(????)"; +const char s5[] = "?\?/\n?\?/\n?\?(?\??\?"; + +const char t0[] = u8R"(a\ +\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb +c)"; +const char t1[] = u8"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; +const char t2[] = u8R"*|*(a\ +b +c)" +c)*|" +c)*|*"; +const char t3[] = u8"a\\\nb\nc)\"\nc)*|\"\nc"; +const char t4[] = u8R"(??/ +??/ +??(????)"; +const char t5[] = u8"?\?/\n?\?/\n?\?(?\??\?"; + +const char16_t u0[] = uR"(a\ +\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb +c)"; +const char16_t u1[] = u"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; +const char16_t u2[] = uR"*|*(a\ +b +c)" +c)*|" +c)*|*"; +const char16_t u3[] = u"a\\\nb\nc)\"\nc)*|\"\nc"; +const char16_t u4[] = uR"(??/ +??/ +??(????)"; +const char16_t u5[] = u"?\?/\n?\?/\n?\?(?\??\?"; + +const char32_t U0[] = UR"(a\ +\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb +c)"; +const char32_t U1[] = U"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; +const char32_t U2[] = UR"*|*(a\ +b +c)" +c)*|" +c)*|*"; +const char32_t U3[] = U"a\\\nb\nc)\"\nc)*|\"\nc"; +const char32_t U4[] = UR"(??/ +??/ +??(????)"; +const char32_t U5[] = U"?\?/\n?\?/\n?\?(?\??\?"; + +const wchar_t L0[] = LR"(a\ +\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb +c)"; +const wchar_t L1[] = L"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc"; +const wchar_t L2[] = LR"*|*(a\ +b +c)" +c)*|" +c)*|*"; +const wchar_t L3[] = L"a\\\nb\nc)\"\nc)*|\"\nc"; +const wchar_t L4[] = LR"(??/ +??/ +??(????)"; +const wchar_t L5[] = L"?\?/\n?\?/\n?\?(?\??\?"; + +int +main (void) +{ + if (sizeof (s0) != sizeof (s1) + || __builtin_memcmp (s0, s1, sizeof (s0)) != 0) + __builtin_abort (); + if (sizeof (s2) != sizeof (s3) + || __builtin_memcmp (s2, s3, sizeof (s2)) != 0) + __builtin_abort (); + if (sizeof (s4) != sizeof (s5) + || __builtin_memcmp (s4, s5, sizeof (s4)) != 0) + __builtin_abort (); + if (sizeof (t0) != sizeof (t1) + || __builtin_memcmp (t0, t1, sizeof (t0)) != 0) + __builtin_abort (); + if (sizeof (t2) != sizeof (t3) + || __builtin_memcmp (t2, t3, sizeof (t2)) != 0) + __builtin_abort (); + if (sizeof (t4) != sizeof (t5) + || __builtin_memcmp (t4, t5, sizeof (t4)) != 0) + __builtin_abort (); + if (sizeof (u0) != sizeof (u1) + || __builtin_memcmp (u0, u1, sizeof (u0)) != 0) + __builtin_abort (); + if (sizeof (u2) != sizeof (u3) + || __builtin_memcmp (u2, u3, sizeof (u2)) != 0) + __builtin_abort (); + if (sizeof (u4) != sizeof (u5) + || __builtin_memcmp (u4, u5, sizeof (u4)) != 0) + __builtin_abort (); + if (sizeof (U0) != sizeof (U1) + || __builtin_memcmp (U0, U1, sizeof (U0)) != 0) + __builtin_abort (); + if (sizeof (U2) != sizeof (U3) + || __builtin_memcmp (U2, U3, sizeof (U2)) != 0) + __builtin_abort (); + if (sizeof (U4) != sizeof (U5) + || __builtin_memcmp (U4, U5, sizeof (U4)) != 0) + __builtin_abort (); + if (sizeof (L0) != sizeof (L1) + || __builtin_memcmp (L0, L1, sizeof (L0)) != 0) + __builtin_abort (); + if (sizeof (L2) != sizeof (L3) + || __builtin_memcmp (L2, L3, sizeof (L2)) != 0) + __builtin_abort (); + if (sizeof (L4) != sizeof (L5) + || __builtin_memcmp (L4, L5, sizeof (L4)) != 0) + __builtin_abort (); + if (sizeof (R"*()*") != 1 + || __builtin_memcmp (R"*()*", "", 1) != 0) + __builtin_abort (); + return 0; +}
raw-string-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-2.c =================================================================== --- raw-string-2.c (nonexistent) +++ raw-string-2.c (revision 338) @@ -0,0 +1,125 @@ +// { dg-do run } +// { dg-require-effective-target wchar } +// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } } +// { dg-options "-std=c++0x" { target c++ } } + +#ifndef __cplusplus +#include + +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; +#endif + +#define R +#define u +#define uR +#define U +#define UR +#define u8 +#define u8R +#define L +#define LR + +const char s00[] = R"(a)" "(b)"; +const char s01[] = "(a)" R"*(b)*"; +const char s02[] = R"(a)" R"(b)"; +const char s03[] = R"-(a)-" u8"(b)"; +const char s04[] = "(a)" u8R"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ"; +const char s05[] = R"(a)" u8R"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL"; +const char s06[] = u8R";[(a);[" "(b)"; +const char s07[] = u8"(a)" R"(b)"; +const char s08[] = u8R"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-"; +const char s09[] = u8R"/^&|~!=,"'(a)/^&|~!=,"'" u8"(b)"; +const char s10[] = u8"(a)" u8R"0123456789abcdef(b)0123456789abcdef"; +const char s11[] = u8R"ghijklmnopqrstuv(a)ghijklmnopqrstuv" u8R"w(b)w"; +const char s12[] = R"??=??(????)??'??!??-\ +(a)#[{}]^|~"; + +const char16_t u03[] = R"-(a)-" u"(b)"; +const char16_t u04[] = "(a)" uR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ"; +const char16_t u05[] = R"(a)" uR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL"; +const char16_t u06[] = uR";[(a);[" "(b)"; +const char16_t u07[] = u"(a)" R"(b)"; +const char16_t u08[] = uR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-"; +const char16_t u09[] = uR"/^&|~!=,"'(a)/^&|~!=,"'" u"(b)"; +const char16_t u10[] = u"(a)" uR"0123456789abcdef(b)0123456789abcdef"; +const char16_t u11[] = uR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" uR"w(b)w"; +const char16_t u12[] = uR"??=??(????)??'??!??-\ +(a)#[{}]^|~"; + +const char32_t U03[] = R"-(a)-" U"(b)"; +const char32_t U04[] = "(a)" UR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ"; +const char32_t U05[] = R"(a)" UR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL"; +const char32_t U06[] = UR";[(a);[" "(b)"; +const char32_t U07[] = U"(a)" R"(b)"; +const char32_t U08[] = UR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-"; +const char32_t U09[] = UR"/^&|~!=,"'(a)/^&|~!=,"'" U"(b)"; +const char32_t U10[] = U"(a)" UR"0123456789abcdef(b)0123456789abcdef"; +const char32_t U11[] = UR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" UR"w(b)w"; +const char32_t U12[] = UR"??=??(????)??'??!??-\ +(a)#[{}]^|~"; + +const wchar_t L03[] = R"-(a)-" L"(b)"; +const wchar_t L04[] = "(a)" LR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ"; +const wchar_t L05[] = R"(a)" LR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL"; +const wchar_t L06[] = LR";[(a);[" "(b)"; +const wchar_t L07[] = L"(a)" R"(b)"; +const wchar_t L08[] = LR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-"; +const wchar_t L09[] = LR"/^&|~!=,"'(a)/^&|~!=,"'" L"(b)"; +const wchar_t L10[] = L"(a)" LR"0123456789abcdef(b)0123456789abcdef"; +const wchar_t L11[] = LR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" LR"w(b)w"; +const wchar_t L12[] = LR"??=??(????)??'??!??-\ +(a)#[{}]^|~"; + +int +main (void) +{ +#define TEST(str, val) \ + if (sizeof (str) != sizeof (val) \ + || __builtin_memcmp (str, val, sizeof (str)) != 0) \ + __builtin_abort () + TEST (s00, "a(b)"); + TEST (s01, "(a)b"); + TEST (s02, "ab"); + TEST (s03, "a(b)"); + TEST (s04, "(a)b"); + TEST (s05, "ab"); + TEST (s06, "a(b)"); + TEST (s07, "(a)b"); + TEST (s08, "ab"); + TEST (s09, "a(b)"); + TEST (s10, "(a)b"); + TEST (s11, "ab"); + TEST (s12, "a"); + TEST (u03, u"a(b)"); + TEST (u04, u"(a)b"); + TEST (u05, u"ab"); + TEST (u06, u"a(b)"); + TEST (u07, u"(a)b"); + TEST (u08, u"ab"); + TEST (u09, u"a(b)"); + TEST (u10, u"(a)b"); + TEST (u11, u"ab"); + TEST (u12, u"a"); + TEST (U03, U"a(b)"); + TEST (U04, U"(a)b"); + TEST (U05, U"ab"); + TEST (U06, U"a(b)"); + TEST (U07, U"(a)b"); + TEST (U08, U"ab"); + TEST (U09, U"a(b)"); + TEST (U10, U"(a)b"); + TEST (U11, U"ab"); + TEST (U12, U"a"); + TEST (L03, L"a(b)"); + TEST (L04, L"(a)b"); + TEST (L05, L"ab"); + TEST (L06, L"a(b)"); + TEST (L07, L"(a)b"); + TEST (L08, L"ab"); + TEST (L09, L"a(b)"); + TEST (L10, L"(a)b"); + TEST (L11, L"ab"); + TEST (L12, L"a"); + return 0; +}
raw-string-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr41779.c =================================================================== --- pr41779.c (nonexistent) +++ pr41779.c (revision 338) @@ -0,0 +1,56 @@ +/* PR41779: Wconversion cannot see throught real*integer promotions. */ +/* { dg-do compile } */ +/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-options "-std=c99 -Wconversion" { target c } } */ +/* { dg-options "-Wconversion" { target c++ } } */ +/* { dg-require-effective-target large_double } */ + +float f1(float x, unsigned short y) +{ + return x * y; +} + +float f2(float x, short y) +{ + return x * y; +} + +float f3(float x, char y) +{ + return x * y; +} + +float f4(float x, unsigned char y) +{ + return x * y; +} + +float f5(float x, int y) +{ + return x * y; /* { dg-warning "conversion" } */ +} + +double c1(float x, unsigned short y, int z) +{ + return z ? x + x : y; +} + +double c2(float x, short y, int z) +{ + return z ? x + x : y; +} + +double c3(float x, char y, int z) +{ + return z ? x + x : y; +} + +double c4(float x, unsigned char y, int z) +{ + return z ? x + x : y; +} + +double c5(float x, int y, int z) +{ + return z ? x + x : y; /* { dg-warning "conversion" } */ +}
pr41779.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wconversion-real.c =================================================================== --- Wconversion-real.c (nonexistent) +++ Wconversion-real.c (revision 338) @@ -0,0 +1,85 @@ +/* Test for diagnostics for Wconversion for floating-point. */ + +/* { dg-do compile } */ +/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-options "-std=c99 -Wconversion" { target c } } */ +/* { dg-options "-Wconversion" { target c++ } } */ +/* { dg-require-effective-target large_double } */ + +float vfloat; +double vdouble; +long double vlongdouble; + +void ffloat (float f); +void fdouble (double d); +void flongdouble (long double ld); + +void h (void) +{ + float f = 0; + double d = 0; + long double ld = 0; + + ffloat (3.1); /* { dg-warning "conversion" } */ + vfloat = 3.1; /* { dg-warning "conversion" } */ + ffloat (3.1L); /* { dg-warning "conversion" } */ + vfloat = 3.1L; /* { dg-warning "conversion" } */ + fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */ + vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */ + ffloat (vdouble); /* { dg-warning "conversion" } */ + vfloat = vdouble; /* { dg-warning "conversion" } */ + ffloat (vlongdouble); /* { dg-warning "conversion" } */ + vfloat = vlongdouble; /* { dg-warning "conversion" } */ + fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */ + vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */ + + + ffloat ((float) 3.1); + vfloat = (float) 3.1; + ffloat ((float) 3.1L); + vfloat = (float) 3.1L; + fdouble ((double) 3.1L); + vdouble = (double) 3.1L; + ffloat ((float) vdouble); + vfloat = (float) vdouble; + ffloat ((float) vlongdouble); + vfloat = (float) vlongdouble; + fdouble ((double) vlongdouble); + vdouble = (double) vlongdouble; + + + ffloat (3.0); + vfloat = 3.0; + ffloat (3.1f); + vfloat = 3.1f; + ffloat (0.25L); + vfloat = 0.25L; + + + fdouble (3.0); + vdouble = 3.0; + fdouble (3.1f); + vdouble = 3.1f; + fdouble (0.25L); + vdouble = 0.25L; + + flongdouble (3.0); + vlongdouble = 3.0; + flongdouble (3.1f); + vlongdouble = 3.1f; + flongdouble (0.25L); + vlongdouble = 0.25L; + + ffloat (f); + vfloat = f; + fdouble (f); + vdouble = f; + fdouble (d); + vdouble = d; + flongdouble (f); + vlongdouble = f; + flongdouble (d); + vlongdouble = d; + flongdouble (ld); + vlongdouble = ld; +}
Wconversion-real.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: raw-string-3.c =================================================================== --- raw-string-3.c (nonexistent) +++ raw-string-3.c (revision 338) @@ -0,0 +1,59 @@ +// If not c++0x/gnu99, the {,u,u8,U,L}R prefix should be parsed as separate +// token. +// { dg-do compile } +// { dg-options "" { target c } } +// { dg-options "-std=c++98" { target c++ } } + +const void *s0 = R"(a)"; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 7 } +const void *s1 = uR"(a)"; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 9 } +const void *s2 = UR"(a)"; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 11 } +const void *s3 = u8R"(a)"; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 13 } +const void *s4 = LR"(a)"; // { dg-error "was not declared|undeclared" } + // { dg-error "expected ',' or ';'" "" { target *-*-* } 15 } + +const int i0 = R'a'; // { dg-error "expected ',' or ';'" } + // { dg-error "was not declared" "" { target c++ } 18 } +const int i1 = uR'a'; // { dg-error "expected ',' or ';'" } + // { dg-error "was not declared" "" { target c++ } 20 } +const int i2 = UR'a'; // { dg-error "expected ',' or ';'" } + // { dg-error "was not declared" "" { target c++ } 22 } +const int i3 = u8R'a'; // { dg-error "expected ',' or ';'" } + // { dg-error "was not declared" "" { target c++ } 24 } +const int i4 = LR'a'; // { dg-error "expected ',' or ';'" } + // { dg-error "was not declared" "" { target c++ } 26 } + +#define R "a" +#define uR "b" +#define UR "c" +#define u8R "d" +#define LR "e" + +const void *s5 = R"(a)"; +const void *s6 = uR"(a)"; +const void *s7 = UR"(a)"; +const void *s8 = u8R"(a)"; +const void *s9 = LR"(a)"; + +#undef R +#undef uR +#undef UR +#undef u8R +#undef LR + +#define R 1 + +#define uR 2 + +#define UR 3 + +#define u8R 4 + +#define LR 5 + + +const int i5 = R'a'; +const int i6 = uR'a'; +const int i7 = UR'a'; +const int i8 = u8R'a'; +const int i9 = LR'a'; + +int main () {}
raw-string-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: restrict-1.c =================================================================== --- restrict-1.c (nonexistent) +++ restrict-1.c (revision 338) @@ -0,0 +1,20 @@ +/* { dg-do link } */ +/* { dg-options "-O -fno-strict-aliasing -fdump-tree-optimized" } */ + +extern void link_error (void); + +void bar0 (int * __restrict__ arr1, int * __restrict__ arr2) +{ + arr1[0] = 1; + arr2[0] = 1; + if (arr1[0] != 1) + link_error (); +} + +int main() +{ + return 0; +} + +/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
restrict-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.