summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-27 16:00:26 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-27 16:00:26 +0000
commitab6086903894a9ce72ebda737e6067771a62a4e3 (patch)
tree0fffda932600cccb90f66739f0c0ad7403474356 /gcc/expr.c
parente918bc2e4425c0921b230f36990dbab3e0f54dce (diff)
downloadgcc-ab6086903894a9ce72ebda737e6067771a62a4e3.tar.gz
* expr.c (emit_block_move_via_libcall): Export.
(clear_storage_via_libcall): Rename to ... (set_storage_via_libcall): ... this one; handle arbitrary value to set. (clear_storage): Update to set_storage_via_libcall. * expr.h (emit_block_move_via_libcall): Declare * config/i386/i386.h (stringop_alg): New enum. (MAX_STRINGOP_ALGS): New constant. (stringop_algs): New struct. (processor_costs): Add memcpy/memset descriptors. (TARGET_REP_MOVEL_OPTIMAL): Remove. * config/i386/i386.md (movsi_insv_1_rex64): New pattern. (strmovsi, strmovdi, strsetsi, strsetdi): Update; accept all operands for memset. * config/i386/i386.opt (minline-stringops-dynamically, mstringop-strategy): New parameters. * config/i386/i386-prostos.h (ix86_expand_movmem): Update prototype. (ix86_expand-clrmem): Rename to ... (ix86_expand_setmem): ... this one; update prototype. * config/i386/i386.c (DUMMY_STRINGOP_ALGS): New constant. (size_cost, i386_cost, i486_cost, pentium_cost, pentiumpro_cost, geode_cost, k6_cost, athlon_cost, k8_cost, pentium4_cost, nocona_cost, core2_cost, generic_cost, generic64_cost, generic32_cost): Add memcpy/memset descriptors. (x86_rep_movl_optimal): Remove. (stringop_alg): New static variable. (ix86_expand_aligntest): Handle predictions. (override_options): Add strgop_alg handling. (predict_jump): New function. (scale_counter): New function. (expand_set_or_movmem_via_loop): New function. (expand_movmem_via_rep_mov): New function. (expand_setmem_via_rep_stots): New function. (emit_strmov): New function. (expand_movmem_epilogue): New function. (expand_setmem_epilogue_via_loop): New function. (expand_setmem_epilogue): New function. (expand_movmem_prologue): New function. (expand_setmem_prologue): New function. (decide_alg): New function. (decide_alignment): New function. (ix86_exand_movmem): Rewrite. (promote_duplicated_reg): New function. (ix86_expand_clrmem): Rename to ... (ix86_expand_setmem): ... this one. Rewrite. * invoke.texi (minline-stringops-dynamically): New command line option. (mstringop-strategy): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119252 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index f3372333cf0..7182b574423 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -127,7 +127,6 @@ static void move_by_pieces_1 (rtx (*) (rtx, ...), enum machine_mode,
struct move_by_pieces *);
static bool block_move_libcall_safe_for_call_parm (void);
static bool emit_block_move_via_movmem (rtx, rtx, rtx, unsigned);
-static rtx emit_block_move_via_libcall (rtx, rtx, rtx, bool);
static tree emit_block_move_libcall_fn (int);
static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned);
static rtx clear_by_pieces_1 (void *, HOST_WIDE_INT, enum machine_mode);
@@ -135,7 +134,6 @@ static void clear_by_pieces (rtx, unsigned HOST_WIDE_INT, unsigned int);
static void store_by_pieces_1 (struct store_by_pieces *, unsigned int);
static void store_by_pieces_2 (rtx (*) (rtx, ...), enum machine_mode,
struct store_by_pieces *);
-static rtx clear_storage_via_libcall (rtx, rtx, bool);
static tree clear_storage_libcall_fn (int);
static rtx compress_float_constant (rtx, rtx);
static rtx get_subtarget (rtx);
@@ -1336,7 +1334,7 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align)
/* A subroutine of emit_block_move. Expand a call to memcpy.
Return the return value from memcpy, 0 otherwise. */
-static rtx
+rtx
emit_block_move_via_libcall (rtx dst, rtx src, rtx size, bool tailcall)
{
rtx dst_addr, src_addr;
@@ -2540,8 +2538,8 @@ clear_storage (rtx object, rtx size, enum block_op_methods method)
else if (set_storage_via_setmem (object, size, const0_rtx, align))
;
else
- return clear_storage_via_libcall (object, size,
- method == BLOCK_OP_TAILCALL);
+ return set_storage_via_libcall (object, size, const0_rtx,
+ method == BLOCK_OP_TAILCALL);
return NULL;
}
@@ -2549,10 +2547,10 @@ clear_storage (rtx object, rtx size, enum block_op_methods method)
/* A subroutine of clear_storage. Expand a call to memset.
Return the return value of memset, 0 otherwise. */
-static rtx
-clear_storage_via_libcall (rtx object, rtx size, bool tailcall)
+rtx
+set_storage_via_libcall (rtx object, rtx size, rtx val, bool tailcall)
{
- tree call_expr, arg_list, fn, object_tree, size_tree;
+ tree call_expr, arg_list, fn, object_tree, size_tree, val_tree;
enum machine_mode size_mode;
rtx retval;
@@ -2572,11 +2570,14 @@ clear_storage_via_libcall (rtx object, rtx size, bool tailcall)
for returning pointers, we could end up generating incorrect code. */
object_tree = make_tree (ptr_type_node, object);
+ if (GET_CODE (val) != CONST_INT)
+ val = convert_to_mode (TYPE_MODE (integer_type_node), val, 1);
size_tree = make_tree (sizetype, size);
+ val_tree = make_tree (integer_type_node, val);
fn = clear_storage_libcall_fn (true);
arg_list = tree_cons (NULL_TREE, size_tree, NULL_TREE);
- arg_list = tree_cons (NULL_TREE, integer_zero_node, arg_list);
+ arg_list = tree_cons (NULL_TREE, val_tree, arg_list);
arg_list = tree_cons (NULL_TREE, object_tree, arg_list);
/* Now we have to build up the CALL_EXPR itself. */
@@ -2590,7 +2591,7 @@ clear_storage_via_libcall (rtx object, rtx size, bool tailcall)
return retval;
}
-/* A subroutine of clear_storage_via_libcall. Create the tree node
+/* A subroutine of set_storage_via_libcall. Create the tree node
for the function we use for block clears. The first time FOR_CALL
is true, we call assemble_external. */