[PATCH PR77718]
Aaron Sawdey
acsawdey@linux.vnet.ibm.com
Wed Sep 28 15:59:00 GMT 2016
This patch that Bernd put in PR77718 seems to be fine. Bootstrap and
regtest done on powerpc64le, no new failures. Ok for trunk?
2016-09-28  Bernd Schmidt  <bschmidt@redhat.com>
* builtins.c (expand_builtin_memcmp): don't swap args unless
result is only being compared with zero.
Index: builtins.c
===================================================================
--- builtins.c (revision 240511)
+++ builtins.c (working copy)
@@ -3707,11 +3707,13 @@ expand_builtin_memcmp (tree exp, rtx tar
Â
   by_pieces_constfn constfn = NULL;
Â
-Â Â const char *src_str = c_getstr (arg1);
-Â Â if (src_str == NULL)
-Â Â Â Â src_str = c_getstr (arg2);
-Â Â else
-Â Â Â Â std::swap (arg1_rtx, arg2_rtx);
+Â Â const char *src_str = c_getstr (arg2);
+Â Â if (result_eq && src_str == NULL)
+Â Â Â Â {
+Â Â Â Â Â Â src_str = c_getstr (arg1);
+Â Â Â Â Â Â if (src_str != NULL)
+ std::swap (arg1_rtx, arg2_rtx);
+Â Â Â Â }
Â
   /* If SRC is a string constant and block move would be done
      by pieces, we can avoid loading the string from memory
--
Aaron Sawdey, Ph.D. acsawdey@linux.vnet.ibm.com
050-2/C113 (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain
More information about the Gcc-patches
mailing list