Hi!

I've noticed this PR is still open, but has been fixed, though
apparently Bernd's patch from the PR has been applied as is with
the needed tab eaten (instead 7 spaces) and no testcase has been added.

Tested with cross-compiler and the r240625 change reverted and as is
and running the resulting assembler on ppc64le.

Ok for trunk?

2016-11-09  Jakub Jelinek  <ja...@redhat.com>

        PR target/77718
        * builtins.c (expand_builtin_memcmp): Formatting fix.

        * gcc.c-torture/execute/pr77718.c: New test.

--- gcc/ChangeLog.jj    2016-11-09 15:22:28.000000000 +0100
+++ gcc/ChangeLog       2016-11-09 16:29:35.152056326 +0100
@@ -5027,7 +5027,8 @@
 
 2016-09-29  Bernd Schmidt  <bschm...@redhat.com>
 
-       * builtins.c (expand_builtin_memcmp): don't swap args unless
+       PR target/77718
+       * builtins.c (expand_builtin_memcmp): Don't swap args unless
        result is only being compared with zero.
 
 2016-09-29  Marek Polacek  <pola...@redhat.com>
--- gcc/builtins.c.jj   2016-10-31 13:28:06.000000000 +0100
+++ gcc/builtins.c      2016-11-09 16:19:08.886909150 +0100
@@ -3754,7 +3754,7 @@ expand_builtin_memcmp (tree exp, rtx tar
     {
       src_str = c_getstr (arg1);
       if (src_str != NULL)
-       std::swap (arg1_rtx, arg2_rtx);
+       std::swap (arg1_rtx, arg2_rtx);
     }
 
   /* If SRC is a string constant and block move would be done
--- gcc/testsuite/gcc.c-torture/execute/pr77718.c.jj    2016-11-09 
16:28:30.414868074 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr77718.c       2016-11-09 
16:22:06.000000000 +0100
@@ -0,0 +1,25 @@
+/* PR middle-end/77718 */
+
+char a[64] __attribute__((aligned (8)));
+
+__attribute__((noinline, noclone)) int
+foo (void)
+{
+  return __builtin_memcmp ("bbbbbb", a, 6);
+}
+
+__attribute__((noinline, noclone)) int
+bar (void)
+{
+  return __builtin_memcmp (a, "bbbbbb", 6);
+}
+
+int
+main ()
+{
+  __builtin_memset (a, 'a', sizeof (a));
+  if (((foo () < 0) ^ ('a' > 'b'))
+      || ((bar () < 0) ^ ('a' < 'b')))
+    __builtin_abort ();
+  return 0;
+}

        Jakub

Reply via email to