summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-18 22:50:29 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-18 22:50:29 +0000
commit156f6115e16e3bb7fd16e1bac57f88b16ebdbad5 (patch)
tree2c5a4fef2fea4ee8851e816f5d8c43eaad5e04f9 /gcc/builtins.c
parent104e421a5ed9b0397de53e97e29515be2eadcc86 (diff)
downloadgcc-156f6115e16e3bb7fd16e1bac57f88b16ebdbad5.tar.gz
PR middle-end/10472
* builtins.c (expand_builtin_memcpy): Call force_operand on expressions and use simplify_gen_binary to create the addition. * gcc.c-torture/compile/20030518-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66941 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index c3965e927ec..c3cb06dba3d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2311,10 +2311,15 @@ expand_builtin_memcpy (arglist, target, mode, endp)
#endif
if (endp)
{
- rtx result = gen_rtx_PLUS (GET_MODE (dest_mem), dest_mem, len_rtx);
+ rtx result;
+ rtx delta = len_rtx;
+
if (endp == 2)
- result = simplify_gen_binary (MINUS, GET_MODE (result), result, const1_rtx);
- return result;
+ delta = GEN_INT (INTVAL (delta) - 1);
+
+ result = simplify_gen_binary (PLUS, GET_MODE (dest_mem),
+ dest_mem, delta);
+ return force_operand (result, NULL_RTX);
}
else
return dest_mem;
@@ -2338,10 +2343,18 @@ expand_builtin_memcpy (arglist, target, mode, endp)
if (endp)
{
- rtx result = gen_rtx_PLUS (GET_MODE (dest_addr), dest_addr, len_rtx);
+ rtx result = force_operand (len_rtx, NULL_RTX);
+
if (endp == 2)
- result = simplify_gen_binary (MINUS, GET_MODE (result), result, const1_rtx);
- return result;
+ {
+ result = simplify_gen_binary (MINUS, GET_MODE (result),
+ result, const1_rtx);
+ result = force_operand (result, NULL_RTX);
+ }
+
+ result = simplify_gen_binary (PLUS, GET_MODE (dest_addr),
+ dest_addr, result);
+ return force_operand (result, NULL_RTX);
}
else
return dest_addr;