diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2005-06-08 09:25:11 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2005-06-08 09:25:11 +0000 |
commit | 5fcead21e3149f03714d2558b96a0a4427d2971c (patch) | |
tree | 6df5c1ba26314bce93bd1bea9d3de03588e00c06 | |
parent | 71bc2a839d86fed2c23c105c8661248cf7579b92 (diff) | |
download | gcc-5fcead21e3149f03714d2558b96a0a4427d2971c.zip gcc-5fcead21e3149f03714d2558b96a0a4427d2971c.tar.gz gcc-5fcead21e3149f03714d2558b96a0a4427d2971c.tar.bz2 |
bfin.h (enum bfin_builtins): New.
* config/bfin/bfin.h (enum bfin_builtins): New.
* config/bfin/bfin.md (UNSPEC_VOLATILE_CSYNC, UNSPEC_VOLATILE_SSYNC):
New constants.
(csync, ssync): New insn patterns.
* config/bfin/bfin.c (bfin_init_builtins, bfin_expand_builtin):
New functions.
(def_builtin): New macro.
(TARGET_INIT_BUILTINS, TARGET_EXPAND_BUILTIN): Define.
From-SVN: r100752
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 53 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.h | 8 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.md | 16 |
4 files changed, 85 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b23611b..e069b08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,15 @@ * config/bfin/bfin.c (bfin_return_in_memory): Simplify; return everything larger than 8 bytes in memory. + * config/bfin/bfin.h (enum bfin_builtins): New. + * config/bfin/bfin.md (UNSPEC_VOLATILE_CSYNC, UNSPEC_VOLATILE_SSYNC): + New constants. + (csync, ssync): New insn patterns. + * config/bfin/bfin.c (bfin_init_builtins, bfin_expand_builtin): + New functions. + (def_builtin): New macro. + (TARGET_INIT_BUILTINS, TARGET_EXPAND_BUILTIN): Define. + 2005-06-08 Sebastian Pop <pop@cri.ensmp.fr> * tree-data-ref.c (compute_estimated_nb_iterations, diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 7f99de7..36a9499 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -2671,6 +2671,59 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED, output_asm_insn ("jump.l\t%P0", xops); } +#define def_builtin(NAME, TYPE, CODE) \ +do { \ + builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \ + NULL, NULL_TREE); \ +} while (0) + +/* Set up all builtin functions for this target. */ +static void +bfin_init_builtins (void) +{ + tree void_ftype_void + = build_function_type (void_type_node, void_list_node); + + /* Add the remaining MMX insns with somewhat more complicated types. */ + def_builtin ("__builtin_bfin_csync", void_ftype_void, BFIN_BUILTIN_CSYNC); + def_builtin ("__builtin_bfin_ssync", void_ftype_void, BFIN_BUILTIN_SSYNC); +} + +/* Expand an expression EXP that calls a built-in function, + with result going to TARGET if that's convenient + (and in mode MODE if that's convenient). + SUBTARGET may be used as the target for computing one of EXP's operands. + IGNORE is nonzero if the value is to be ignored. */ + +static rtx +bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, + rtx subtarget ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + int ignore ATTRIBUTE_UNUSED) +{ + tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + unsigned int fcode = DECL_FUNCTION_CODE (fndecl); + + switch (fcode) + { + case BFIN_BUILTIN_CSYNC: + emit_insn (gen_csync ()); + return 0; + case BFIN_BUILTIN_SSYNC: + emit_insn (gen_ssync ()); + return 0; + + default: + gcc_unreachable (); + } +} + +#undef TARGET_INIT_BUILTINS +#define TARGET_INIT_BUILTINS bfin_init_builtins + +#undef TARGET_EXPAND_BUILTIN +#define TARGET_EXPAND_BUILTIN bfin_expand_builtin + #undef TARGET_ASM_GLOBALIZE_LABEL #define TARGET_ASM_GLOBALIZE_LABEL bfin_globalize_label diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 608188a..82702f9 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -989,6 +989,14 @@ do { \ #define EXTRA_CONSTRAINT(VALUE, D) \ ((D) == 'Q' ? GET_CODE (VALUE) == SYMBOL_REF : 0) +/* Codes for all the Blackfin builtins. */ +enum bfin_builtins +{ + BFIN_BUILTIN_CSYNC, + BFIN_BUILTIN_SSYNC, + BFIN_BUILTIN_MAX +}; + /* `FINALIZE_PIC' By generating position-independent code, when two different programs (A and B) share a common library (libC.a), the text of diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md index 986e649e..1fc015e 100644 --- a/gcc/config/bfin/bfin.md +++ b/gcc/config/bfin/bfin.md @@ -120,7 +120,9 @@ (UNSPEC_PUSH_MULTIPLE 5)]) (define_constants - [(UNSPEC_VOLATILE_EH_RETURN 0)]) + [(UNSPEC_VOLATILE_EH_RETURN 0) + (UNSPEC_VOLATILE_CSYNC 1) + (UNSPEC_VOLATILE_SSYNC 2)]) (define_attr "type" "move,mvi,mcld,mcst,dsp32,mult,alu0,shft,brcc,br,call,misc,compare,dummy" @@ -1838,6 +1840,18 @@ gcc_unreachable (); }) +(define_insn "csync" + [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_CSYNC)] + "" + "csync;" + [(set_attr "type" "misc")]) + +(define_insn "ssync" + [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_SSYNC)] + "" + "ssync;" + [(set_attr "type" "misc")]) + ;;; Vector instructions (define_insn "addv2hi" |