builtins.c (expand_builtin_memset_args): Use gen_int_mode instead of GEN_INT.

gcc/
2011-03-28  Richard Sandiford  <richard.sandiford@linaro.org>

	* builtins.c (expand_builtin_memset_args): Use gen_int_mode
	instead of GEN_INT.

From-SVN: r171632
This commit is contained in:
Richard Sandiford 2011-03-28 21:22:58 +00:00 committed by Richard Sandiford
parent 8060754453
commit 8a44512917
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2011-03-28 Richard Sandiford <richard.sandiford@linaro.org>
* builtins.c (expand_builtin_memset_args): Use gen_int_mode
instead of GEN_INT.
2011-03-28 Eric Botcazou <ebotcazou@adacore.com> 2011-03-28 Eric Botcazou <ebotcazou@adacore.com>
* cfgexpand.c (expand_gimple_cond): Always set the source location and * cfgexpand.c (expand_gimple_cond): Always set the source location and

View File

@ -3935,6 +3935,7 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
{ {
tree fndecl, fn; tree fndecl, fn;
enum built_in_function fcode; enum built_in_function fcode;
enum machine_mode val_mode;
char c; char c;
unsigned int dest_align; unsigned int dest_align;
rtx dest_mem, dest_addr, len_rtx; rtx dest_mem, dest_addr, len_rtx;
@ -3969,14 +3970,14 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
len_rtx = expand_normal (len); len_rtx = expand_normal (len);
dest_mem = get_memory_rtx (dest, len); dest_mem = get_memory_rtx (dest, len);
val_mode = TYPE_MODE (unsigned_char_type_node);
if (TREE_CODE (val) != INTEGER_CST) if (TREE_CODE (val) != INTEGER_CST)
{ {
rtx val_rtx; rtx val_rtx;
val_rtx = expand_normal (val); val_rtx = expand_normal (val);
val_rtx = convert_to_mode (TYPE_MODE (unsigned_char_type_node), val_rtx = convert_to_mode (val_mode, val_rtx, 0);
val_rtx, 0);
/* Assume that we can memset by pieces if we can store /* Assume that we can memset by pieces if we can store
* the coefficients by pieces (in the required modes). * the coefficients by pieces (in the required modes).
@ -3987,8 +3988,7 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
builtin_memset_read_str, &c, dest_align, builtin_memset_read_str, &c, dest_align,
true)) true))
{ {
val_rtx = force_reg (TYPE_MODE (unsigned_char_type_node), val_rtx = force_reg (val_mode, val_rtx);
val_rtx);
store_by_pieces (dest_mem, tree_low_cst (len, 1), store_by_pieces (dest_mem, tree_low_cst (len, 1),
builtin_memset_gen_str, val_rtx, dest_align, builtin_memset_gen_str, val_rtx, dest_align,
true, 0); true, 0);
@ -4014,7 +4014,8 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
true)) true))
store_by_pieces (dest_mem, tree_low_cst (len, 1), store_by_pieces (dest_mem, tree_low_cst (len, 1),
builtin_memset_read_str, &c, dest_align, true, 0); builtin_memset_read_str, &c, dest_align, true, 0);
else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c), else if (!set_storage_via_setmem (dest_mem, len_rtx,
gen_int_mode (c, val_mode),
dest_align, expected_align, dest_align, expected_align,
expected_size)) expected_size))
goto do_libcall; goto do_libcall;