aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-07-11 23:04:56 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2003-07-11 23:04:56 +0200
commit358b8f011484b845868d977d9bc0caaa096c96a3 (patch)
treea3656da4466c54cd571525ec90e2a1bf57bccbda /gcc/optabs.c
parent8634e925a9f53c086210ee461a0002278bc5c3d2 (diff)
downloadgcc-358b8f011484b845868d977d9bc0caaa096c96a3.zip
gcc-358b8f011484b845868d977d9bc0caaa096c96a3.tar.gz
gcc-358b8f011484b845868d977d9bc0caaa096c96a3.tar.bz2
optabs.c (prepare_cmp_insn): Try cmpmemM first if it exists, then fall back to cmpstrM.
* 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. From-SVN: r69243
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index b4023e3..3085b85 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3579,6 +3579,40 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
if (size == 0)
abort ();
+#ifdef HAVE_cmpmemqi
+ if (HAVE_cmpmemqi
+ && GET_CODE (size) == CONST_INT
+ && INTVAL (size) < (1 << GET_MODE_BITSIZE (QImode)))
+ {
+ result_mode = insn_data[(int) CODE_FOR_cmpmemqi].operand[0].mode;
+ result = gen_reg_rtx (result_mode);
+ emit_insn (gen_cmpmemqi (result, x, y, size, opalign));
+ }
+ else
+#endif
+#ifdef HAVE_cmpmemhi
+ if (HAVE_cmpmemhi
+ && GET_CODE (size) == CONST_INT
+ && INTVAL (size) < (1 << GET_MODE_BITSIZE (HImode)))
+ {
+ result_mode = insn_data[(int) CODE_FOR_cmpmemhi].operand[0].mode;
+ result = gen_reg_rtx (result_mode);
+ emit_insn (gen_cmpmemhi (result, x, y, size, opalign));
+ }
+ else
+#endif
+#ifdef HAVE_cmpmemsi
+ if (HAVE_cmpmemsi)
+ {
+ result_mode = insn_data[(int) CODE_FOR_cmpmemsi].operand[0].mode;
+ result = gen_reg_rtx (result_mode);
+ size = protect_from_queue (size, 0);
+ emit_insn (gen_cmpmemsi (result, x, y,
+ convert_to_mode (SImode, size, 1),
+ opalign));
+ }
+ else
+#endif
#ifdef HAVE_cmpstrqi
if (HAVE_cmpstrqi
&& GET_CODE (size) == CONST_INT