URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/gcc.target/bfin
- from Rev 149 to Rev 154
- ↔ Reverse comparison
Rev 149 → Rev 154
/frmul.c
0,0 → 1,149
extern void abort (void); |
extern void exit (int); |
|
typedef int __v2hi __attribute ((vector_size(4))); |
typedef __v2hi fract2x16; |
typedef short fract16; |
|
#define GETVECT(HILO1,HILO2,IN1,IN2) \ |
__builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \ |
(HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2)) |
#define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4) \ |
__builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \ |
GETVECT (HL3, HL4, IN2, IN2)) |
|
#define FUNC(HL1, HL2, HL3, HL4) \ |
fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\ |
{ \ |
return DOTEST(a, b, HL1, HL2, HL3, HL4);\ |
} |
|
FUNC (0, 0, 0, 0) |
FUNC (1, 0, 0, 0) |
FUNC (0, 1, 0, 0) |
FUNC (1, 1, 0, 0) |
FUNC (0, 0, 1, 0) |
FUNC (1, 0, 1, 0) |
FUNC (0, 1, 1, 0) |
FUNC (1, 1, 1, 0) |
FUNC (0, 0, 0, 1) |
FUNC (1, 0, 0, 1) |
FUNC (0, 1, 0, 1) |
FUNC (1, 1, 0, 1) |
FUNC (0, 0, 1, 1) |
FUNC (1, 0, 1, 1) |
FUNC (0, 1, 1, 1) |
FUNC (1, 1, 1, 1) |
|
#define RES1 0x1400 |
#define RES2 0x1e00 |
#define RES3 0x1c00 |
#define RES4 0x2a00 |
|
|
int main () |
{ |
fract2x16 a, b, c; |
fract16 t1, t2; |
a = __builtin_bfin_compose_2x16 (0x3000, 0x2000); |
b = __builtin_bfin_compose_2x16 (0x7000, 0x5000); |
|
c = foo0000 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES1 || t2 != RES1) |
abort (); |
|
c = foo1000 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES2 || t2 != RES1) |
abort (); |
|
c = foo0100 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES1 || t2 != RES2) |
abort (); |
|
c = foo1100 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES2 || t2 != RES2) |
abort (); |
|
c = foo0010 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES3 || t2 != RES1) |
abort (); |
|
c = foo1010 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES4 || t2 != RES1) |
abort (); |
|
c = foo0110 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES3 || t2 != RES2) |
abort (); |
|
c = foo1110 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES4 || t2 != RES2) |
abort (); |
|
c = foo0001 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES1 || t2 != RES3) |
abort (); |
|
c = foo1001 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES2 || t2 != RES3) |
abort (); |
|
c = foo0101 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES1 || t2 != RES4) |
abort (); |
|
c = foo1101 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES2 || t2 != RES4) |
abort (); |
|
c = foo0011 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES3 || t2 != RES3) |
abort (); |
|
c = foo1011 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES4 || t2 != RES3) |
abort (); |
|
c = foo0111 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES3 || t2 != RES4) |
abort (); |
|
c = foo1111 (a, b); |
t1 = __builtin_bfin_extract_lo (c); |
t2 = __builtin_bfin_extract_hi (c); |
if (t1 != RES4 || t2 != RES4) |
abort (); |
|
exit (0); |
} |
|
frmul.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: arith.c
===================================================================
--- arith.c (nonexistent)
+++ arith.c (revision 154)
@@ -0,0 +1,48 @@
+extern void abort (void);
+extern void exit (int);
+
+typedef int __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, c, d;
+ fract16 t1, t2;
+ a = __builtin_bfin_compose_2x16 (0x3000, 0x2000);
+ b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
+ c = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
+
+ d = __builtin_bfin_add_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x7000 || t2 != 0x7fff)
+ abort ();
+
+ d = __builtin_bfin_sub_fr2x16 (a, b);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != -0x3000 || t2 != -0x4000)
+ abort ();
+
+ d = __builtin_bfin_negate_fr2x16 (c);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x4000 || t2 != -0x7000)
+ abort ();
+
+ if (__builtin_bfin_add_fr1x32 (0x7fffffff, 1) != 0x7fffffff)
+ abort ();
+
+ if (__builtin_bfin_add_fr1x32 (0x80000000, -1) != 0x80000000)
+ abort ();
+
+ if (__builtin_bfin_add_fr1x32 (0x80000001, -1) != 0x80000000)
+ abort ();
+
+ if (__builtin_bfin_add_fr1x32 (0xFEDCBA98, 0x11111111) != 0x0FEDCBA9)
+ abort ();
+
+ exit (0);
+}
+
arith.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: mul-combine.c
===================================================================
--- mul-combine.c (nonexistent)
+++ mul-combine.c (revision 154)
@@ -0,0 +1,45 @@
+/* Make sure combine eliminates all unnecessary instructions for the
+ sixteen cases of hi/lo multiplications. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-not "<<" } } */
+/* { dg-final { scan-assembler-not "PACK" } } */
+
+extern void abort (void);
+extern void exit (int);
+
+typedef int __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+#define GETVECT(HILO1,HILO2,IN1,IN2) \
+ __builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \
+ (HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2))
+#define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4) \
+ __builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \
+ GETVECT (HL3, HL4, IN2, IN2))
+
+#define FUNC(HL1, HL2, HL3, HL4) \
+ fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\
+ { \
+ return DOTEST(a, b, HL1, HL2, HL3, HL4);\
+ }
+
+FUNC (0, 0, 0, 0)
+FUNC (1, 0, 0, 0)
+FUNC (0, 1, 0, 0)
+FUNC (1, 1, 0, 0)
+FUNC (0, 0, 1, 0)
+FUNC (1, 0, 1, 0)
+FUNC (0, 1, 1, 0)
+FUNC (1, 1, 1, 0)
+FUNC (0, 0, 0, 1)
+FUNC (1, 0, 0, 1)
+FUNC (0, 1, 0, 1)
+FUNC (1, 1, 0, 1)
+FUNC (0, 0, 1, 1)
+FUNC (1, 0, 1, 1)
+FUNC (0, 1, 1, 1)
+FUNC (1, 1, 1, 1)
mul-combine.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: bfin.exp
===================================================================
--- bfin.exp (nonexistent)
+++ bfin.exp (revision 154)
@@ -0,0 +1,23 @@
+# Tests for the Blackfin
+
+if {![istarget bfin-*]} {
+ return 0
+}
+
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
Index: shift.c
===================================================================
--- shift.c (nonexistent)
+++ shift.c (revision 154)
@@ -0,0 +1,73 @@
+extern void abort (void);
+extern void exit (int);
+
+typedef int __v2hi __attribute ((vector_size(4)));
+typedef __v2hi fract2x16;
+typedef short fract16;
+
+int main ()
+{
+ fract2x16 a, b, c, d;
+ fract16 t1, t2;
+ a = __builtin_bfin_compose_2x16 (0xe005, 0x1000);
+ b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
+ c = __builtin_bfin_compose_2x16 (0x7000, 0xc000);
+
+ d = __builtin_bfin_shl_fr2x16 (c, 2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if ((unsigned short)t1 != 0x8000 || t2 != 0x7fff)
+ abort ();
+
+ d = __builtin_bfin_shl_fr2x16 (c, -2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if ((unsigned short)t1 != 0xf000 || t2 != 0x1c00)
+ abort ();
+
+ d = __builtin_bfin_shl_fr2x16 (a, 2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x4000 || (unsigned short)t2 != 0x8014)
+ abort ();
+
+ d = __builtin_bfin_shl_fr2x16 (c, -4);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if ((unsigned short)t1 != 0xfc00 || t2 != 0x0700)
+ abort ();
+
+ d = __builtin_bfin_shl_fr2x16 (c, 2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if ((unsigned short)t1 != 0x8000 || t2 != 0x7fff)
+ abort ();
+
+ d = __builtin_bfin_shl_fr2x16 (a, -2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x0400 || (unsigned short)t2 != 0xf801)
+ abort ();
+
+ /* lsh */
+ d = __builtin_bfin_lshl_fr2x16 (c, -4);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x0c00 || t2 != 0x0700)
+ abort ();
+
+ d = __builtin_bfin_lshl_fr2x16 (c, 2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x0000 || t2 != -0x4000)
+ abort ();
+
+ d = __builtin_bfin_lshl_fr2x16 (a, -2);
+ t1 = __builtin_bfin_extract_lo (d);
+ t2 = __builtin_bfin_extract_hi (d);
+ if (t1 != 0x0400 || (unsigned short)t2 != 0x3801)
+ abort ();
+
+ exit (0);
+}
+
shift.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