From: Bernd Schmidt <bernds_cb1@t-online.de>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Blackfin: code to expand additional builtins
Date: Thu, 23 Oct 2008 00:57:00 -0000 [thread overview]
Message-ID: <48FFADC6.2040309@t-online.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
This adds four more builtins. Most of the code was there already, but
there was no entry in the bdesc_2arg table so we couldn't expand them.
There's also a new testcase (duplicated since it tests different things
at -O0 and -O2).
Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
[-- Attachment #2: mulhisi.diff --]
[-- Type: text/plain, Size: 4341 bytes --]
Index: ChangeLog
===================================================================
--- ChangeLog (revision 141311)
+++ ChangeLog (working copy)
@@ -1,5 +1,8 @@
2008-10-23 Bernd Schmidt <bernd.schmidt@analog.com>
+ * config/bfin/bfin.c (bdesc_2arg): Add mulhisill, mulhisilh,
+ mulhisihl and mulhisihh builtins.
+
From Jie Zhang <jie.zhang@analog.com>
* config/bfin/bfin.md (composev2hi): Put operands into vector
with correct order.
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 141311)
+++ testsuite/ChangeLog (working copy)
@@ -1,5 +1,8 @@
2008-10-22 Bernd Schmidt <bernd.schmidt@analog.com>
+ * gcc.target/bfin/hisilh.c: New file.
+ * gcc.target/bfin/hisilh-O0.c: New file.
+
From Mike Frysinger <michael.frysinger@analog.com>
* gcc.target/bfin/mcpu-bf522.c: Check SILICON_REVISION is 0x0002. Invert
check for __WORKAROUND_RETS when SILICON_REVISION is 0x0002+.
Index: config/bfin/bfin.c
===================================================================
--- config/bfin/bfin.c (revision 141305)
+++ config/bfin/bfin.c (working copy)
@@ -5669,7 +5669,13 @@ static const struct builtin_description
{ CODE_FOR_flag_mulhi, "__builtin_bfin_mult_fr1x16", BFIN_BUILTIN_MULT_1X16, MACFLAG_T },
{ CODE_FOR_flag_mulhi, "__builtin_bfin_multr_fr1x16", BFIN_BUILTIN_MULTR_1X16, MACFLAG_NONE },
{ CODE_FOR_flag_mulv2hi, "__builtin_bfin_mult_fr2x16", BFIN_BUILTIN_MULT_2X16, MACFLAG_T },
- { CODE_FOR_flag_mulv2hi, "__builtin_bfin_multr_fr2x16", BFIN_BUILTIN_MULTR_2X16, MACFLAG_NONE }
+ { CODE_FOR_flag_mulv2hi, "__builtin_bfin_multr_fr2x16", BFIN_BUILTIN_MULTR_2X16, MACFLAG_NONE },
+
+ { CODE_FOR_mulhisi_ll, "__builtin_bfin_mulhisill", BFIN_BUILTIN_MULHISILL, -1 },
+ { CODE_FOR_mulhisi_lh, "__builtin_bfin_mulhisilh", BFIN_BUILTIN_MULHISILH, -1 },
+ { CODE_FOR_mulhisi_hl, "__builtin_bfin_mulhisihl", BFIN_BUILTIN_MULHISIHL, -1 },
+ { CODE_FOR_mulhisi_hh, "__builtin_bfin_mulhisihh", BFIN_BUILTIN_MULHISIHH, -1 }
+
};
static const struct builtin_description bdesc_1arg[] =
Index: testsuite/gcc.target/bfin/hisilh-O0.c
===================================================================
--- testsuite/gcc.target/bfin/hisilh-O0.c (revision 0)
+++ testsuite/gcc.target/bfin/hisilh-O0.c (revision 0)
@@ -0,0 +1,46 @@
+/* { dg-do run { target bfin*-*-* } } */
+/* { dg-options "-O0" } */
+#include <stdlib.h>
+typedef short raw2x16 __attribute__ ((vector_size(4)));
+
+int x;
+
+int ll(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisill(a, b);
+ return x;
+}
+
+int lh(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisilh(a, b);
+ return x;
+}
+
+int hl(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisihl(a, b);
+ return x;
+}
+
+int hh(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisihh(a, b);
+ return x;
+}
+
+int main ()
+{
+ raw2x16 a = __builtin_bfin_compose_2x16 (0x1234, 0x5678);
+ raw2x16 b = __builtin_bfin_compose_2x16 (0xFEDC, 0xBA98);
+ if (ll (a, b) != 0xe88e8740)
+ abort ();
+ if (lh (a, b) != 0xff9d5f20)
+ abort ();
+ if (hl (a, b) != 0xfb1096e0)
+ abort ();
+ if (hh (a, b) != 0xffeb3cb0)
+ abort ();
+
+ return 0;
+}
Index: testsuite/gcc.target/bfin/hisilh.c
===================================================================
--- testsuite/gcc.target/bfin/hisilh.c (revision 0)
+++ testsuite/gcc.target/bfin/hisilh.c (revision 0)
@@ -0,0 +1,46 @@
+/* { dg-do run { target bfin*-*-* } } */
+/* { dg-options "-O2" } */
+#include <stdlib.h>
+typedef short raw2x16 __attribute__ ((vector_size(4)));
+
+int x;
+
+int ll(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisill(a, b);
+ return x;
+}
+
+int lh(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisilh(a, b);
+ return x;
+}
+
+int hl(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisihl(a, b);
+ return x;
+}
+
+int hh(raw2x16 a, raw2x16 b)
+{
+ x = __builtin_bfin_mulhisihh(a, b);
+ return x;
+}
+
+int main ()
+{
+ raw2x16 a = __builtin_bfin_compose_2x16 (0x1234, 0x5678);
+ raw2x16 b = __builtin_bfin_compose_2x16 (0xFEDC, 0xBA98);
+ if (ll (a, b) != 0xe88e8740)
+ abort ();
+ if (lh (a, b) != 0xff9d5f20)
+ abort ();
+ if (hl (a, b) != 0xfb1096e0)
+ abort ();
+ if (hh (a, b) != 0xffeb3cb0)
+ abort ();
+
+ return 0;
+}
reply other threads:[~2008-10-22 22:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48FFADC6.2040309@t-online.de \
--to=bernds_cb1@t-online.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).