diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2008-10-22 22:47:05 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2008-10-22 22:47:05 +0000 |
commit | 2aca912d657a18f70c1eb03181fb8921828c7829 (patch) | |
tree | 61ea2c232e09b5fd6ea9cd9b24ac7e91285b8ab0 | |
parent | 23cf1526e3cc3fd35b1c3584e52e62f9b7183a2b (diff) | |
download | gcc-2aca912d657a18f70c1eb03181fb8921828c7829.zip gcc-2aca912d657a18f70c1eb03181fb8921828c7829.tar.gz gcc-2aca912d657a18f70c1eb03181fb8921828c7829.tar.bz2 |
bfin.c (bdesc_2arg): Add mulhisill, mulhisilh, mulhisihl and mulhisihh builtins.
gcc/:
* config/bfin/bfin.c (bdesc_2arg): Add mulhisill, mulhisilh,
mulhisihl and mulhisihh builtins.
gcc/testsuite/:
* gcc.target/bfin/hisilh.c: New file.
* gcc.target/bfin/hisilh-O0.c: New file.
From-SVN: r141312
-rw-r--r-- | gcc/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/bfin/hisilh-O0.c | 46 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/bfin/hisilh.c | 46 |
5 files changed, 105 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a221b47..bd8ba33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index ccdd5bc..3421dd0 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -5669,7 +5669,13 @@ static const struct builtin_description bdesc_2arg[] = { 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[] = diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c82eab5..583ddbc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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+. diff --git a/gcc/testsuite/gcc.target/bfin/hisilh-O0.c b/gcc/testsuite/gcc.target/bfin/hisilh-O0.c new file mode 100644 index 0000000..50786b8 --- /dev/null +++ b/gcc/testsuite/gcc.target/bfin/hisilh-O0.c @@ -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; +} diff --git a/gcc/testsuite/gcc.target/bfin/hisilh.c b/gcc/testsuite/gcc.target/bfin/hisilh.c new file mode 100644 index 0000000..4efbfd4 --- /dev/null +++ b/gcc/testsuite/gcc.target/bfin/hisilh.c @@ -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; +} |