diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2005-01-28 13:57:29 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2005-01-28 13:57:29 +0000 |
commit | a738d8481d6446d53863ecb8ce399c2df74ec45c (patch) | |
tree | bae69aa080719321b1e8cc17167680244499c1ca /gcc | |
parent | f8023b78462af97c3fe7a6b7786a9c19c82107d9 (diff) | |
download | gcc-a738d8481d6446d53863ecb8ce399c2df74ec45c.zip gcc-a738d8481d6446d53863ecb8ce399c2df74ec45c.tar.gz gcc-a738d8481d6446d53863ecb8ce399c2df74ec45c.tar.bz2 |
frv.c (bdesc_2arg): Remove __MDPACKH.
* config/frv/frv.c (bdesc_2arg): Remove __MDPACKH.
(frv_init_builtins): Change its prototype to take 4 uhalf arguments.
(frv_expand_mdpackh_builtin): New function.
(frv_expand_builtin): Use it to expand __MDPACKH.
* config/frv/media.h (__MDPACKH): Update prototype.
* doc/extend.texi (__MDPACKH): Update documentation.
From-SVN: r94371
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/frv/frv.c | 52 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/frv/all-mdpackh-1.c | 16 |
4 files changed, 79 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cee8bc8..326c860 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2005-01-28 Richard Sandiford <rsandifo@redhat.com> + + * config/frv/frv.c (bdesc_2arg): Remove __MDPACKH. + (frv_init_builtins): Change its prototype to take 4 uhalf arguments. + (frv_expand_mdpackh_builtin): New function. + (frv_expand_builtin): Use it to expand __MDPACKH. + * config/frv/media.h (__MDPACKH): Update prototype. + * doc/extend.texi (__MDPACKH): Update documentation. + 2005-01-28 Uros Bizjak <uros@kss-loka.si> * config/i386/i386.c (ix86_expand_fp_absneg_operator): Use diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 8dd08ab..da3266a 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -9349,7 +9349,6 @@ static struct builtin_description bdesc_2arg[] = { CODE_FOR_mqsubhss, "__MQSUBHSS", FRV_BUILTIN_MQSUBHSS, 0, 0 }, { CODE_FOR_mqsubhus, "__MQSUBHUS", FRV_BUILTIN_MQSUBHUS, 0, 0 }, { CODE_FOR_mpackh, "__MPACKH", FRV_BUILTIN_MPACKH, 0, 0 }, - { CODE_FOR_mdpackh, "__MDPACKH", FRV_BUILTIN_MDPACKH, 0, 0 }, { CODE_FOR_mcop1, "__Mcop1", FRV_BUILTIN_MCOP1, 0, 0 }, { CODE_FOR_mcop2, "__Mcop2", FRV_BUILTIN_MCOP2, 0, 0 }, { CODE_FOR_mwcut, "__MWCUT", FRV_BUILTIN_MWCUT, 0, 0 }, @@ -9494,6 +9493,12 @@ frv_init_builtins (void) tree_cons (NULL_TREE, T2, \ tree_cons (NULL_TREE, T3, endlink)))) +#define QUAD(RET, T1, T2, T3, T4) \ + build_function_type (RET, tree_cons (NULL_TREE, T1, \ + tree_cons (NULL_TREE, T2, \ + tree_cons (NULL_TREE, T3, \ + tree_cons (NULL_TREE, T4, endlink))))) + tree void_ftype_void = build_function_type (voidt, endlink); tree void_ftype_acc = UNARY (voidt, accumulator); @@ -9527,6 +9532,7 @@ frv_init_builtins (void) tree uw2_ftype_uw2_uw2 = BINARY (uword2, uword2, uword2); tree uw2_ftype_uw2_int = BINARY (uword2, uword2, integer); tree uw2_ftype_acc_int = BINARY (uword2, accumulator, integer); + tree uw2_ftype_uh_uh_uh_uh = QUAD (uword2, uhalf, uhalf, uhalf, uhalf); tree sw2_ftype_sw2_sw2 = BINARY (sword2, sword2, sword2); tree sw2_ftype_sw2_int = BINARY (sword2, sword2, integer); @@ -9589,7 +9595,7 @@ frv_init_builtins (void) def_builtin ("__MEXPDHD", uw2_ftype_uw1_int, FRV_BUILTIN_MEXPDHD); def_builtin ("__MPACKH", uw1_ftype_uh_uh, FRV_BUILTIN_MPACKH); def_builtin ("__MUNPACKH", uw2_ftype_uw1, FRV_BUILTIN_MUNPACKH); - def_builtin ("__MDPACKH", uw2_ftype_uw2_uw2, FRV_BUILTIN_MDPACKH); + def_builtin ("__MDPACKH", uw2_ftype_uh_uh_uh_uh, FRV_BUILTIN_MDPACKH); def_builtin ("__MDUNPACKH", void_ftype_uw4_uw2, FRV_BUILTIN_MDUNPACKH); def_builtin ("__MBTOH", uw2_ftype_uw1, FRV_BUILTIN_MBTOH); def_builtin ("__MHTOB", uw1_ftype_uw2, FRV_BUILTIN_MHTOB); @@ -9648,6 +9654,7 @@ frv_init_builtins (void) #undef UNARY #undef BINARY #undef TRINARY +#undef QUAD } /* Set the names for various arithmetic operations according to the @@ -10116,6 +10123,44 @@ frv_expand_voidaccop_builtin (enum insn_code icode, tree arglist) return NULL_RTX; } +/* Expand the MDPACKH builtin. It takes four unsigned short arguments and + each argument forms one word of the two double-word input registers. + ARGLIST is a TREE_LIST of the arguments and TARGET, if nonnull, + suggests a good place to put the return value. */ + +static rtx +frv_expand_mdpackh_builtin (tree arglist, rtx target) +{ + enum insn_code icode = CODE_FOR_mdpackh; + rtx pat, op0, op1; + rtx arg1 = frv_read_argument (&arglist); + rtx arg2 = frv_read_argument (&arglist); + rtx arg3 = frv_read_argument (&arglist); + rtx arg4 = frv_read_argument (&arglist); + + target = frv_legitimize_target (icode, target); + op0 = gen_reg_rtx (DImode); + op1 = gen_reg_rtx (DImode); + + /* The high half of each word is not explicitly initialised, so indicate + that the input operands are not live before this point. */ + emit_insn (gen_rtx_CLOBBER (DImode, op0)); + emit_insn (gen_rtx_CLOBBER (DImode, op1)); + + /* Move each argument into the low half of its associated input word. */ + emit_move_insn (simplify_gen_subreg (HImode, op0, DImode, 2), arg1); + emit_move_insn (simplify_gen_subreg (HImode, op0, DImode, 6), arg2); + emit_move_insn (simplify_gen_subreg (HImode, op1, DImode, 2), arg3); + emit_move_insn (simplify_gen_subreg (HImode, op1, DImode, 6), arg4); + + pat = GEN_FCN (icode) (target, op0, op1); + if (! pat) + return NULL_RTX; + + emit_insn (pat); + return target; +} + /* Expand the MCLRACC builtin. This builtin takes a single accumulator number as argument. */ @@ -10343,6 +10388,9 @@ frv_expand_builtin (tree exp, case FRV_BUILTIN_MWTACCG: return frv_expand_mwtacc_builtin (CODE_FOR_mwtaccg, arglist); + case FRV_BUILTIN_MDPACKH: + return frv_expand_mdpackh_builtin (arglist, target); + case FRV_BUILTIN_IACCreadll: { rtx src = frv_read_iacc_argument (DImode, &arglist); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e88427e..fb96e26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-01-28 Richard Sandiford <rsandifo@redhat.com> + + * gcc.target/frv/all-mdpackh-1.c: New test. + 2005-01-26 Steven Bosscher <stevenb@suse.de> * gcc.dg/tree-ssa/20030711-2.c: Run at -O2, not -O1. diff --git a/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c b/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c new file mode 100644 index 0000000..8374237 --- /dev/null +++ b/gcc/testsuite/gcc.target/frv/all-mdpackh-1.c @@ -0,0 +1,16 @@ +/* Test the new (Fujitsu-compatible) __MDPACKH() interface. */ +/* { dg-do run } */ +extern void exit (int); +extern void abort (void); + +unsigned short x[] = { 0x8765, 0x1234, 0x2222, 0xeeee }; + +int +main () +{ + if (__MDPACKH (x[0], x[1], x[2], x[3]) != 0x876522221234eeeeULL) + abort (); + if (__MDPACKH (0x1111, 0x8001, 0xeeee, 0x7002) != 0x1111eeee80017002ULL) + abort (); + exit (0); +} |