PATCH, new complex number tests

Tom Rix trix@redhat.com
Mon Dec 31 09:23:00 GMT 2001


Here are a new batch of tests for passing and returning complex floats
and doubles.

Tom

--
Tom Rix
GCC Engineer
trix@redhat.com


-------------- next part --------------
2001-12-31  Tom Rix <trix@redhat.com>
	
	* gcc.c-torture/execute/complex-6.c : New.
	* gcc.c-torture/execute/complex-7.c : New.
	* gcc.c-torture/execute/complex-8.c : New.
	* gcc.c-torture/execute/complex-9.c : New.
	* gcc.c-torture/execute/complex-10.c : New.
	* gcc.c-torture/execute/complex-11.c : New.
	* gcc.c-torture/execute/complex-12.c : New.
	* gcc.c-torture/execute/complex-13.c : New.
 
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-10.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-10.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-10.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-10.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,55 ----
+ float __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ float __complex__ a0 = 12.0 + 18.0 * (1.0fi);
+ float __complex__ a1 = 4.0 + 4.0 * (1.0fi);
+ float __complex__ a2 = 8.0 + 2.0 * (1.0fi);
+ float __complex__ a3 = 16.0 + 1.0 * (1.0fi);
+ float __complex__ a4 = 32.0 + 0.5 * (1.0fi);
+ float __complex__ a5 = 64.0 + 0.250 * (1.0fi);
+ float __complex__ a6 = 128.0 + 0.1250 * (1.0fi);
+ 
+ __complex__ float 
+ foo(__complex__ float x0, 
+     __complex__ float x1,
+     __complex__ float x2,
+     __complex__ float x3, 
+     __complex__ float x4,
+     __complex__ float x5,
+     __complex__ float x6
+     )
+ {
+   return a + x6;
+ }
+ 
+ int 
+ main()
+ {
+   __complex__ float c; 
+   
+   float ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+   abort();
+ 
+   if (__real__ a6 != 128.0)
+     abort();
+   if (__imag__ a6 != 0.125)
+     abort();
+ 
+   c = foo(a0, a1, a2, a3, a4, a5, a6); 
+ 
+   if (__real__ c > (130.0 + ep) ||
+       __real__ c < (130.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (8.125 + ep) ||
+       __imag__ c < (8.125 - ep))
+     abort();
+ 
+   return 0;
+ }
+ 
+ 
+ 
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-11.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-11.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-11.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-11.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,52 ----
+ double __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ double __complex__ a0 = 12.0 + 18.0 * (1.0fi);
+ double __complex__ a1 = 4.0 + 4.0 * (1.0fi);
+ double __complex__ a2 = 8.0 + 2.0 * (1.0fi);
+ double __complex__ a3 = 16.0 + 1.0 * (1.0fi);
+ double __complex__ a4 = 32.0 + 0.5 * (1.0fi);
+ double __complex__ a5 = 64.0 + 0.250 * (1.0fi);
+ double __complex__ a6 = 128.0 + 0.1250 * (1.0fi);
+ 
+ __complex__ double 
+ foo(__complex__ double x0, 
+     __complex__ double x1,
+     __complex__ double x2,
+     __complex__ double x3, 
+     __complex__ double x4,
+     __complex__ double x5,
+     __complex__ double x6
+     )
+ {
+   return a + x6;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ double c;
+   
+   double ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   if (__real__ a6 != 128.0)
+     abort();
+   if (__imag__ a6 != 0.125)
+     abort();
+ 
+   c = foo(a0, a1, a2, a3, a4, a5, a6);
+ 
+   if (__real__ c > (130.0 + ep) ||
+       __real__ c < (130.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (8.125 + ep) ||
+       __imag__ c < (8.125 - ep))
+     abort();
+ 
+   return 0;
+ }
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-12.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-12.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-12.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-12.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,54 ----
+ float __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ float __complex__ a0 = 12.0 + 18.0 * (1.0fi);
+ float __complex__ a1 = 4.0 + 4.0 * (1.0fi);
+ float __complex__ a2 = 8.0 + 2.0 * (1.0fi);
+ float __complex__ a3 = 16.0 + 1.0 * (1.0fi);
+ float __complex__ a4 = 32.0 + 0.5 * (1.0fi);
+ float __complex__ a5 = 64.0 + 0.250 * (1.0fi);
+ float __complex__ a6 = 12.0 + 0.50 * (1.0fi);
+ float __complex__ a7 = 128.0 + 0.1250 * (1.0fi);
+ 
+ __complex__ float 
+ foo(__complex__ float x0, 
+     __complex__ float x1,
+     __complex__ float x2,
+     __complex__ float x3, 
+     __complex__ float x4,
+     __complex__ float x5,
+     __complex__ float x6,
+     __complex__ float x7
+     )
+ {
+   return a + x7;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ float c;
+   
+   float ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   if (__real__ a7 != 128.0)
+     abort();
+   if (__imag__ a7 != 0.125)
+     abort();
+ 
+   c = foo(a0, a1, a2, a3, a4, a5, a6, a7);
+ 
+   if (__real__ c > (130.0 + ep) ||
+       __real__ c < (130.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (8.125 + ep) ||
+       __imag__ c < (8.125 - ep))
+     abort();
+ 
+   return 0;
+ }
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-13.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-13.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-13.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-13.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,54 ----
+ double __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ double __complex__ a0 = 12.0 + 18.0 * (1.0fi);
+ double __complex__ a1 = 4.0 + 4.0 * (1.0fi);
+ double __complex__ a2 = 8.0 + 2.0 * (1.0fi);
+ double __complex__ a3 = 16.0 + 1.0 * (1.0fi);
+ double __complex__ a4 = 32.0 + 0.5 * (1.0fi);
+ double __complex__ a5 = 64.0 + 0.250 * (1.0fi);
+ double __complex__ a6 = 12.0 + 0.50 * (1.0fi);
+ double __complex__ a7 = 128.0 + 0.1250 * (1.0fi);
+ 
+ __complex__ double 
+ foo(__complex__ double x0, 
+     __complex__ double x1,
+     __complex__ double x2,
+     __complex__ double x3, 
+     __complex__ double x4,
+     __complex__ double x5,
+     __complex__ double x6,
+     __complex__ double x7
+     )
+ {
+   return a + x7;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ double c;
+   
+   double ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   if (__real__ a7 != 128.0)
+     abort();
+   if (__imag__ a7 != 0.125)
+     abort();
+ 
+   c = foo(a0, a1, a2, a3, a4, a5, a6, a7);
+ 
+   if (__real__ c > (130.0 + ep) ||
+       __real__ c < (130.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (8.125 + ep) ||
+       __imag__ c < (8.125 - ep))
+     abort();
+ 
+   return 0;
+ }
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-6.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-6.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-6.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-6.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,28 ----
+ float __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ __complex__ float 
+ foo()
+ {
+   return a;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ float b;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   b = foo() + foo();
+ 
+   if (__real__ b != 4.0)
+     abort();
+   if (__imag__ b != 16.0)
+     abort();
+ 
+   return 0;
+ }
+ 
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-7.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-7.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-7.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-7.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,28 ----
+ double __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ __complex__ double 
+ foo()
+ {
+   return a;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ double b;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   b = foo() + foo();
+ 
+   if (__real__ b != 4.0)
+     abort();
+   if (__imag__ b != 16.0)
+     abort();
+ 
+   return 0;
+ }
+ 
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-8.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-8.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-8.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-8.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,39 ----
+ float __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ __complex__ float 
+ foo(__complex__ float x)
+ {
+   return a + x;
+ }
+ 
+ int
+ main()
+ {
+   __complex__ float c;
+   __complex__ float b = 2.0 + 4.0 * (1.0fi);
+   
+   float ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   if (__real__ b != 2.0)
+     abort();
+   if (__imag__ b != 4.0)
+     abort();
+ 
+   c = foo(b);
+ 
+   if (__real__ c > (4.0 + ep) ||
+       __real__ c < (4.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (12.0 + ep) ||
+       __imag__ c < (12.0 - ep))
+     abort();
+ 
+   return 0;
+ }
+ 
diff -rcp -N gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-9.c gcc/gcc/testsuite/gcc.c-torture/execute/complex-9.c
*** gcc-old/gcc/testsuite/gcc.c-torture/execute/complex-9.c	Wed Dec 31 18:00:00 1969
--- gcc/gcc/testsuite/gcc.c-torture/execute/complex-9.c	Mon Dec 31 11:22:02 2001
***************
*** 0 ****
--- 1,39 ----
+ double __complex__ a = 2.0 + 8.0 * (1.0fi);
+ 
+ __complex__ double 
+ foo(__complex__ double x)
+ {
+   return a + x;
+ }
+ 
+ int 
+ main()
+ {
+   __complex__ double c;
+   __complex__ double b = 2.0 + 4.0 * (1.0fi);
+   
+   double ep = 0.01;
+ 
+   if (__real__ a != 2.0)
+     abort();
+   if (__imag__ a != 8.0)
+     abort();
+ 
+   if (__real__ b != 2.0)
+     abort();
+   if (__imag__ b != 4.0)
+     abort();
+ 
+   c = foo(b);
+ 
+   if (__real__ c > (4.0 + ep) ||
+       __real__ c < (4.0 - ep))
+     abort();
+ 
+   if (__imag__ c > (12.0 + ep) ||
+       __imag__ c < (12.0 - ep))
+     abort();
+ 
+   return 0;
+ }
+ 


More information about the Gcc-patches mailing list