From 8fa477f7d5f7ecfc1337351251531c695a900786 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 15 May 2008 13:25:26 +0000 Subject: [PATCH] bfin.md (loadbytes): New pattern. * config/bfin/bfin.md (loadbytes): New pattern. * config/bfin/bfin.c (enum bfin_builtins): Add BFIN_BUILTIN_LOADBYTES. (bfin_init_builtins): Initialize it. (bdesc_1arg): Add it. From-SVN: r135351 --- gcc/ChangeLog | 7 +++++++ gcc/config/bfin/bfin.c | 15 ++++++++++++++- gcc/config/bfin/bfin.md | 10 ++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e0912dbb81..3135d2cffd4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-05-15 Bernd Schmidt + + * config/bfin/bfin.md (loadbytes): New pattern. + * config/bfin/bfin.c (enum bfin_builtins): Add BFIN_BUILTIN_LOADBYTES. + (bfin_init_builtins): Initialize it. + (bdesc_1arg): Add it. + 2008-05-15 Sa Liu * testsuite/gfortran.dg/c_kind_int128_test1.f03: New. diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index f48ab0f264b..933b12bdab8 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -5228,6 +5228,8 @@ enum bfin_builtins BFIN_BUILTIN_CPLX_SQU, + BFIN_BUILTIN_LOADBYTES, + BFIN_BUILTIN_MAX }; @@ -5282,7 +5284,11 @@ bfin_init_builtins (void) tree short_ftype_v2hi = build_function_type_list (short_integer_type_node, V2HI_type_node, NULL_TREE); - + tree int_ftype_pint + = build_function_type_list (integer_type_node, + build_pointer_type (integer_type_node), + NULL_TREE); + /* 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); @@ -5409,6 +5415,11 @@ bfin_init_builtins (void) BFIN_BUILTIN_CPLX_MSU_16_S40); def_builtin ("__builtin_bfin_csqu_fr16", v2hi_ftype_v2hi, BFIN_BUILTIN_CPLX_SQU); + + /* "Unaligned" load. */ + def_builtin ("__builtin_bfin_loadbytes", int_ftype_pint, + BFIN_BUILTIN_LOADBYTES); + } @@ -5456,6 +5467,8 @@ static const struct builtin_description bdesc_2arg[] = static const struct builtin_description bdesc_1arg[] = { + { CODE_FOR_loadbytes, "__builtin_bfin_loadbytes", BFIN_BUILTIN_LOADBYTES, 0 }, + { CODE_FOR_ones, "__builtin_bfin_ones", BFIN_BUILTIN_ONES, 0 }, { CODE_FOR_signbitshi2, "__builtin_bfin_norm_fr1x16", BFIN_BUILTIN_NORM_1X16, 0 }, diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md index f535799b624..6b1c1e8e981 100644 --- a/gcc/config/bfin/bfin.md +++ b/gcc/config/bfin/bfin.md @@ -4253,3 +4253,13 @@ %0 = %1 >> %N2 (V)%!" [(set_attr "type" "dsp32")]) +;; Load without alignment exception (masking off low bits) + +(define_insn "loadbytes" + [(set (match_operand:SI 0 "register_operand" "=d") + (mem:SI (and:SI (match_operand:SI 1 "register_operand" "b") + (const_int -4))))] + "" + "DISALGNEXCPT || %0 = [%1];" + [(set_attr "type" "mcld") + (set_attr "length" "8")]) -- 2.30.2