diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-11 21:04:56 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-11 21:04:56 +0000 |
commit | b428c0a5b1207b78f8352f4445b8de457d8dcb85 (patch) | |
tree | a3656da4466c54cd571525ec90e2a1bf57bccbda /gcc/builtins.c | |
parent | 8cf040ee54d48347a24eba958965b775c01285cf (diff) | |
download | gcc-b428c0a5b1207b78f8352f4445b8de457d8dcb85.tar.gz |
* optabs.c (prepare_cmp_insn): Try cmpmemM first if it exists,
then fall back to cmpstrM.
* builtins.c (expand_builtin_memcmp): Likewise.
* config/s390/s390-protos.h (s390_expand_cmpstr): Rename to...
(s390_expand_cmpmem): ... this.
* config/s390/s390.md (cmpmemdi, cmpmemsi, cmpmem_short_64,
cmpmem_short_31, cmpmem_long_64, cmpmem_long_31): Renamed
from cmpstr* patterns. Rename call to s390_expand_cmpstr
to s390_expand_cmpmem.
* config/s390/s390.c (s390_expand_cmpstr): Rename to...
(s390_expand_cmpstr): ... this. Rename cmpstr* instructions
to cmpmem*.
* config/i370/i370.md (cmpmemsi, cmpmemsi_1): Renamed from
cmpstr* patterns.
* doc/md.texi (cmpstrM): Describe as String compare insn, not
Block compare insn.
(cmpmemM): Add.
* gcc.dg/20030711-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69243 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 94712150ad1..90cd6acd165 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3196,7 +3196,7 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, return expand_expr (result, target, mode, EXPAND_NORMAL); } -#ifdef HAVE_cmpstrsi +#if defined HAVE_cmpmemsi || defined HAVE_cmpstrsi { rtx arg1_rtx, arg2_rtx, arg3_rtx; rtx result; @@ -3206,8 +3206,19 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; int arg2_align = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - enum machine_mode insn_mode - = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + enum machine_mode insn_mode; + +#ifdef HAVE_cmpmemsi + if (HAVE_cmpmemsi) + insn_mode = insn_data[(int) CODE_FOR_cmpmemsi].operand[0].mode; + else +#endif +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) + insn_mode = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + else +#endif + return 0; /* If we don't have POINTER_TYPE, call the function. */ if (arg1_align == 0 || arg2_align == 0) @@ -3223,11 +3234,19 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, 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; +#ifdef HAVE_cmpmemsi + if (HAVE_cmpmemsi) + insn = gen_cmpmemsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); else +#endif +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, GEN_INT (MIN (arg1_align, arg2_align))); + else +#endif + abort (); if (insn) emit_insn (insn); |