Jie Zhang wrote:
Hi Grace,
Thanks for your work!
Pan, Grace wrote:
Hi,all,
Based on the description of blackfin builtin functions in wiki,
I have written serveral testcases to use these functions.
There are in three c files, for fract16,fract32,fract2x16
respectively.
I suggest one file for one builtin test. It will make our lives easier.
This way you don't need printfs to distinguish them.
The files had been put in gcc/testsuite/gcc.target/bfin on my
side and when running it, find some issue that is reported in bug
5599, 5606,5615.
It will be better to put them in the gcc.target/bfin/builtins.
The printf info is still on for the moment. If it is not
allowed, it could be deleted when checked in.
I told you the reason why printf cannot be used here. For the record,
printf cannot be used in GCC testcase otherwise it cannot be used for
testing on bare hardware.
Please have a check on these files.
/* { dg-do compile } */
/* { dg-do run { target bfin*-*-* } } */
/* { dg-do run } */
should be enough, since those files will be put in a bfin target
subdirectory.
#include <stdlib.h>
#include <stdio.h>
//extern void abort (void);
//extern void exit (int);
The following two lines are enough:
extern void abort (void);
extern void exit (int);
If you use "return 0;" instead of "exit (0);", you only need to declare
the abort ().
t1 = __builtin_bfin_add_fr1x16 (0x3000,0x2000);
A white space is required after ",".
Grace is busy on other task. And I need those test cases eagerly. After
discussing with her, I took this task over. I committed the attached
patch. The two cases for fr1x32x32NS are not included since it's still
under discussion with VDSP guys.
All test cases are passed now except the following two:
FAIL: gcc.target/bfin/builtins/shl_fr1x32-2.c execution, -O2
FAIL: gcc.target/bfin/builtins/shl_fr1x32-4.c execution, -O2
Committed for gcc-4.1 and gcc-4.3.
Jie
* gcc.target/bfin/builtins/abs_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/abs_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/abs_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/abs_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/abs_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/abs_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/add_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/add_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/add_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/add_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/add_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/add_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/diff_hl_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/diff_hl_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/diff_lh_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/diff_lh_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/max_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/max_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/max_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/max_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/max_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/max_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/min_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/min_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/min_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/min_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/min_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/min_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/mult_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/mult_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/mult_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/mult_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/mult_fr1x32x32-1.c: New test.
* gcc.target/bfin/builtins/mult_fr1x32x32-2.c: New test.
* gcc.target/bfin/builtins/mult_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/mult_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/multr_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/multr_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/multr_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/multr_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/negate_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/negate_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/negate_fr1x16-3.c: New test.
* gcc.target/bfin/builtins/negate_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/negate_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/negate_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/negate_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/norm_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/norm_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/norm_fr1x16-3.c: New test.
* gcc.target/bfin/builtins/norm_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/norm_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/shl_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/shl_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/shl_fr1x16-3.c: New test.
* gcc.target/bfin/builtins/shl_fr1x16-4.c: New test.
* gcc.target/bfin/builtins/shl_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/shl_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/shl_fr1x32-3.c: New test.
* gcc.target/bfin/builtins/shl_fr1x32-4.c: New test.
* gcc.target/bfin/builtins/shl_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/shl_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/shl_fr2x16-3.c: New test.
* gcc.target/bfin/builtins/shl_fr2x16-4.c: New test.
* gcc.target/bfin/builtins/sub_fr1x16-1.c: New test.
* gcc.target/bfin/builtins/sub_fr1x16-2.c: New test.
* gcc.target/bfin/builtins/sub_fr1x32-1.c: New test.
* gcc.target/bfin/builtins/sub_fr1x32-2.c: New test.
* gcc.target/bfin/builtins/sub_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/sub_fr2x16-2.c: New test.
* gcc.target/bfin/builtins/sum_fr2x16-1.c: New test.
* gcc.target/bfin/builtins/sum_fr2x16-2.c: New test.
Index: gcc.target/bfin/builtins/shl_fr1x16-4.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x16-4.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x16-4.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_shl_fr1x16 (0xd004, -4);
+ if (t1 != 0xfffffd00)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr1x16-1.c (revision 0)
@@ -0,0 +1,14 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_sub_fr1x16 (0x3000, 0x2000);
+ if (t1 != 0x1000)
+ abort ();
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/add_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr2x16-2.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
+ b = __builtin_bfin_compose_2x16 (0x8000, 0xc000);
+
+ t = __builtin_bfin_add_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xfffff000 || t2 != 0xffff8000)
+ abort ();
+
+ return 0;
+}
Index: gcc.target/bfin/builtins/negate_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr2x16-1.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+
+ t = __builtin_bfin_negate_fr2x16 (a);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != -0x5fff || t2 != 0x1)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_abs_fr1x32 (0x80000000);
+ if (t != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/multr_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/multr_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/multr_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+ b = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_multr_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xc01 || t2 != 0x0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_abs_fr1x16 (0x7777);
+ if (t1 != 0x7777)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sum_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/sum_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/sum_fr2x16-1.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+
+ t = __builtin_bfin_sum_fr2x16 (a);
+ if (t != 0x5ffe)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/norm_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/norm_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/norm_fr1x32-2.c (revision 0)
@@ -0,0 +1,13 @@
+extern void abort (void);
+
+int main ()
+{
+ int m;
+
+ m = __builtin_bfin_norm_fr1x32 (0x0000eff1);
+ if (m != 15)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/norm_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/norm_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/norm_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ int m;
+
+ m = __builtin_bfin_norm_fr1x16 (0x1000);
+ if (m != 2)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/norm_fr1x16-3.c
===================================================================
--- gcc.target/bfin/builtins/norm_fr1x16-3.c (revision 0)
+++ gcc.target/bfin/builtins/norm_fr1x16-3.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ int m;
+
+ m = __builtin_bfin_norm_fr1x16 (0xe000);
+ if (m != 2)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x32x32-2.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x32x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x32x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_mult_fr1x32x32 (0x7fff0000, 0x00000007);
+ if (t != 0x6)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+ b = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_mult_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x0c00 || t2 != 0xffffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/min_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+ b = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_min_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x1001 || t2 != 0xffffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/add_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_add_fr1x32 (0x40003000, 0x50002000);
+ if (t != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/max_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr2x16-2.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5000, 0xd000);
+ b = __builtin_bfin_compose_2x16 (0xc000, 0x2000);
+
+ t = __builtin_bfin_max_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x5000 || t2 != 0x2000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr2x16-1.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0xcfff, 0xffff);
+
+ t = __builtin_bfin_shl_fr2x16 (a, 4);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xffff8000 || t2 != 0xfffffff0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/add_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr1x16-2.c (revision 0)
@@ -0,0 +1,14 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_add_fr1x16 (0x3000, 0xd000);
+ if (t1 != 0x0)
+ abort ();
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr2x16-3.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr2x16-3.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr2x16-3.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_shl_fr2x16 (a, 4);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x7fff || t2 != 0x10)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr2x16-2.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
+ b = __builtin_bfin_compose_2x16 (0xc000, 0xd000);
+
+ t = __builtin_bfin_sub_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x7fff || t2 != -0x1000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/diff_lh_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/diff_lh_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/diff_lh_fr2x16-2.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_diff_lh_fr2x16 (a);
+ if (t != -0x1000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/diff_hl_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/diff_hl_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/diff_hl_fr2x16-2.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_diff_hl_fr2x16 (a);
+ if (t != 0x1000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_negate_fr1x32 (0x80000000);
+ if (t != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_negate_fr1x16 (0x7fff);
+ if (t1 != -0x7fff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/multr_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/multr_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/multr_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_multr_fr1x16 (0x7777, 0x0007);
+ if (t1 != 0x0007)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr1x16-3.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr1x16-3.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr1x16-3.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_negate_fr1x16 (0xc000);
+ if (t1 != 0x4000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr2x16-2.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_abs_fr2x16 (a);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x1001 || t2 != 0x0001)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_mult_fr1x32 (0x0002, 0x0001);
+ if (t != 0x0004)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_mult_fr1x16 (0x7777, 0x0007);
+ if (t1 != 0x0006)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/min_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_min_fr1x32 (0x70007000, 0xc000c000);
+ if (t != 0xc000c000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/min_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_min_fr1x16 (0x7777, 0x7000);
+ if (t1 != 0x7000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/max_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_max_fr1x32 (0x77777777, 0x70007000);
+ if (t != 0x77777777)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_shl_fr1x32 (0x7feff4ff, -4);
+ if (t != 0x7feff4f)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/max_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_max_fr1x16 (0x8000, 0xc000);
+ if (t1 != -0x4000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_shl_fr1x16 (0x1101, 4);
+ if (t1 != 0x7fff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x32-4.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x32-4.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x32-4.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_shl_fr1x32 (0xc000e4ff, -4);
+ if (t != 0xfc000e4f)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t1;
+
+ t1 = __builtin_bfin_sub_fr1x32 (0x40003000, 0xc0003000);
+ if (t1 != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x16-3.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x16-3.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x16-3.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_shl_fr1x16 (0xc101, 4);
+ if (t1 != 0xffff8000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/add_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x4000, 0x2000);
+ b = __builtin_bfin_compose_2x16 (0x8000, 0x5000);
+
+ t = __builtin_bfin_add_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xffffc000 || t2 != 0x7000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr1x16-2.c (revision 0)
@@ -0,0 +1,14 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_sub_fr1x16 (0x3000, 0x4000);
+ if (t1 != -0x1000)
+ abort ();
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_abs_fr1x32 (0x77777777);
+ if (t != 0x77777777)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/multr_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/multr_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/multr_fr2x16-2.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5000, 0xd000);
+ b = __builtin_bfin_compose_2x16 (0xc000, 0x2000);
+
+ t = __builtin_bfin_multr_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xffffd800 || t2 != 0xfffff400)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr2x16-2.c (revision 0)
@@ -0,0 +1,21 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+ t = __builtin_bfin_negate_fr2x16 (a);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != -0x1001 || t2 != -0x1)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sum_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/sum_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/sum_fr2x16-2.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_sum_fr2x16 (a);
+ if (t != 0x1002)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_abs_fr1x16 (0x8000);
+ if (t1 != 0x7fff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/norm_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/norm_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/norm_fr1x32-1.c (revision 0)
@@ -0,0 +1,13 @@
+extern void abort (void);
+
+int main ()
+{
+ int m;
+
+ m = __builtin_bfin_norm_fr1x32 (0xefffeff1);
+ if (m != 2)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x32x32-1.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x32x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x32x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_mult_fr1x32x32 (0x80000000, 0x80000000);
+ if (t != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/norm_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/norm_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/norm_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ int m;
+
+ m = __builtin_bfin_norm_fr1x16 (0x4000);
+ if (m != 0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr2x16-2.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5000, 0xd000);
+ b = __builtin_bfin_compose_2x16 (0xc000, 0x2000);
+
+ t = __builtin_bfin_mult_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xffffd800 || t2 != 0xfffff400)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/min_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr2x16-2.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5000, 0xd000);
+ b = __builtin_bfin_compose_2x16 (0xc000, 0x2000);
+
+ t = __builtin_bfin_min_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xffffc000 || t2 != 0xffffd000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/max_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+ b = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_max_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x5fff || t2 != 0x0001)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/add_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_add_fr1x32 (0x40003000, 0xc000d000);
+ if (t != 0x00010000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/add_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/add_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/add_fr1x16-1.c (revision 0)
@@ -0,0 +1,14 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_add_fr1x16 (0x3000, 0x2000);
+ if (t1 != 0x5000)
+ abort ();
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr2x16-2.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr2x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr2x16-2.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0xcfff, 0xffff);
+
+ t = __builtin_bfin_shl_fr2x16 (a, -4);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0xfffffcff || t2 != 0xffffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr2x16-4.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr2x16-4.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr2x16-4.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x1001, 0x0001);
+
+ t = __builtin_bfin_shl_fr2x16 (a, -4);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x100 || t2 != 0x0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr2x16-1.c (revision 0)
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x4000, 0x2000);
+ b = __builtin_bfin_compose_2x16 (0x8000, 0x5000);
+
+ t = __builtin_bfin_sub_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x7fff || t2 != -0x3000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/diff_lh_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/diff_lh_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/diff_lh_fr2x16-1.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+
+ t = __builtin_bfin_diff_lh_fr2x16 (a);
+ if (t != 0xffffa000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/diff_hl_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/diff_hl_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/diff_hl_fr2x16-1.c (revision 0)
@@ -0,0 +1,20 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a;
+ fract16 t;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+
+ t = __builtin_bfin_diff_hl_fr2x16 (a);
+ if (t != 0x6000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_negate_fr1x32 (0x7fffffff);
+ if (t != -0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/negate_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/negate_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/negate_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_negate_fr1x16 (0x8000);
+ if (t1 != 0x7fff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/multr_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/multr_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/multr_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_multr_fr1x16 (0x0002, 0x0001);
+ if (t1 != 0x0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/abs_fr2x16-1.c
===================================================================
--- gcc.target/bfin/builtins/abs_fr2x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/abs_fr2x16-1.c (revision 0)
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+typedef short __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, t;
+ fract16 t1, t2;
+
+ a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff);
+
+ t = __builtin_bfin_abs_fr2x16 (a);
+ t1 = __builtin_bfin_extract_hi (t);
+ t2 = __builtin_bfin_extract_lo (t);
+ if (t1 != 0x5fff || t2 != 0x1)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_mult_fr1x32 (0x7777, 0x0001);
+ if (t != 0x0000eeee)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/min_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_min_fr1x32 (0x77777777, 0x70007000);
+ if (t != 0x70007000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/mult_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/mult_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/mult_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_mult_fr1x16 (0x0002, 0x0001);
+ if (t1 != 0x0)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/max_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_max_fr1x32 (0x80000000, 0xc0000000);
+ if (t != 0xc0000000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/min_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/min_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/min_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_min_fr1x16 (0x7000, 0xc001);
+ if (t1 != -0x3fff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x32-1.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x32-1.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x32-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_shl_fr1x32 (0x7feff4ff, 4);
+ if (t != 0x7fffffff)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/max_fr1x16-1.c
===================================================================
--- gcc.target/bfin/builtins/max_fr1x16-1.c (revision 0)
+++ gcc.target/bfin/builtins/max_fr1x16-1.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_max_fr1x16 (0x7777, 0x7000);
+ if (t1 != 0x7777)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x32-3.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x32-3.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x32-3.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_shl_fr1x32 (0xc000e4ff, 4);
+ if (t != 0x80000000)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/shl_fr1x16-2.c
===================================================================
--- gcc.target/bfin/builtins/shl_fr1x16-2.c (revision 0)
+++ gcc.target/bfin/builtins/shl_fr1x16-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef short fract16;
+
+int main ()
+{
+ fract16 t1;
+
+ t1 = __builtin_bfin_shl_fr1x16 (0x4004, -4);
+ if (t1 != 0x0400)
+ abort ();
+
+ return 0;
+}
+
Index: gcc.target/bfin/builtins/sub_fr1x32-2.c
===================================================================
--- gcc.target/bfin/builtins/sub_fr1x32-2.c (revision 0)
+++ gcc.target/bfin/builtins/sub_fr1x32-2.c (revision 0)
@@ -0,0 +1,15 @@
+extern void abort (void);
+
+typedef long fract32;
+
+int main ()
+{
+ fract32 t;
+
+ t = __builtin_bfin_sub_fr1x32 (0x40003000, 0x70002000);
+ if (t != 0xd0001000)
+ abort ();
+
+ return 0;
+}
+
_______________________________________________
Toolchain-devel mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/toolchain-devel