summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-12 14:18:56 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-12 14:18:56 +0000
commit0cd832f07426f9b494317f30a430fb30182fb743 (patch)
tree45c7057fb9d4c1fc610166788acd0e6469c79af9 /gcc/builtins.c
parentfa4f1f09902e75f0d09d58d0c6bdf45e3bb73fef (diff)
downloadgcc-0cd832f07426f9b494317f30a430fb30182fb743.tar.gz
* builtins.c (expand_builtin_memcmp): Do expansion even with
!HAVE_cmpstrsi, do libcall when gen_strcmpsi fails. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33107 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1590d38c873..9159a1b2c8f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1628,15 +1628,15 @@ expand_builtin_memcmp (exp, arglist, target)
|| TREE_CHAIN (TREE_CHAIN (arglist)) == 0
|| TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
return 0;
- else if (!HAVE_cmpstrsi)
- return 0;
{
enum machine_mode mode;
tree arg1 = TREE_VALUE (arglist);
tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+ rtx arg1_rtx, arg2_rtx, arg3_rtx;
rtx result;
+ rtx insn;
int arg1_align
= get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
@@ -1656,10 +1656,25 @@ expand_builtin_memcmp (exp, arglist, target)
&& REGNO (result) >= FIRST_PSEUDO_REGISTER))
result = gen_reg_rtx (insn_mode);
- emit_insn (gen_cmpstrsi (result, get_memory_rtx (arg1),
- get_memory_rtx (arg2),
- expand_expr (len, NULL_RTX, VOIDmode, 0),
- GEN_INT (MIN (arg1_align, arg2_align))));
+ arg1_rtx = get_memory_rtx (arg1);
+ arg2_rtx = get_memory_rtx (arg2);
+ arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0);
+ if (!HAVE_cmpstrsi)
+ insn = NULL_RTX;
+ else
+ insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx,
+ GEN_INT (MIN (arg1_align, arg2_align)));
+
+ if (insn)
+ emit_insn (insn);
+ else
+ emit_library_call_value (memcmp_libfunc, result, 2,
+ TYPE_MODE (integer_type_node), 3,
+ XEXP (arg1_rtx, 0), Pmode,
+ XEXP (arg2_rtx, 0), Pmode,
+ convert_to_mode (TYPE_MODE (sizetype), arg3_rtx,
+ TREE_UNSIGNED (sizetype)),
+ TYPE_MODE (sizetype));
/* Return the value in the proper mode for this function. */
mode = TYPE_MODE (TREE_TYPE (exp));