summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bfin/mul-combine.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/bfin/mul-combine.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/bfin/mul-combine.c')
-rw-r--r--gcc/testsuite/gcc.target/bfin/mul-combine.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/bfin/mul-combine.c b/gcc/testsuite/gcc.target/bfin/mul-combine.c
new file mode 100644
index 000000000..2a811b332
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bfin/mul-combine.c
@@ -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 short __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)