在 2019/5/17 上午6:04, Jakub Jelinek 写道:
On Thu, May 16, 2019 at 11:39:38PM +0200, Jakub Jelinek wrote:
One possibility is to add -fdump-tree-optimized and scan for
/* { dg-final { scan-tree-dump "pow \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
resp.
/* { dg-final { scan-tree-dump "log \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
Here it is in patch form.

That said, I'm not convinced your patch does what you wanted, because
comparing a month old trunk with today's trunk generates the same assembly
except for .ident, generates as many [tail call] lines in *.optimized dump
as before, emits the same number of jmp\tpow and jmp\tlog instructions as
before (one in a separate routine).


Thanks for point out the mistake and fix it.

For these two tests, cdce pass doesn't transform the builtin math functions in foo
with or without the patch because they cannot use internal functions.

I'll add another testcase to verify the patch.

Regards
Jun


But at least the tests aren't UNSUPPORTED anymore.

2019-05-16  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/90106
        * gcc.dg/cdce1.c: Don't scan-assembler, instead -fdump-tree-optimized
        and scan-tree-dump for tail call.
        * gcc.dg/cdce2.c: Likewise.

--- gcc/testsuite/gcc.dg/cdce1.c.jj     2019-05-16 11:28:22.750177582 +0200
+++ gcc/testsuite/gcc.dg/cdce1.c        2019-05-16 23:50:23.618450891 +0200
@@ -1,9 +1,9 @@
-/* { dg-do  run  } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
+/* { dg-do run } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -fdump-tree-optimized 
-lm" } */
  /* { dg-require-effective-target int32plus } */
-/* { dg-final { scan-tree-dump  "cdce1.c:17: .* function call is shrink-wrapped into error 
conditions\."  "cdce" } } */
-/* { dg-final { scan-assembler     "jmp pow" } } */
  /* { dg-require-effective-target large_double } */
+/* { dg-final { scan-tree-dump "cdce1.c:17: .* function call is shrink-wrapped into error 
conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "pow \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
#include <stdlib.h>
  #include <math.h>
--- gcc/testsuite/gcc.dg/cdce2.c.jj     2019-05-16 11:28:22.781177075 +0200
+++ gcc/testsuite/gcc.dg/cdce2.c        2019-05-16 23:50:58.505880845 +0200
@@ -1,8 +1,8 @@
-/* { dg-do  run  } */
+/* { dg-do run } */
  /* { dg-skip-if "doubles are floats" { "avr-*-*" } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
-/* { dg-final { scan-tree-dump  "cdce2.c:16: .* function call is shrink-wrapped into error 
conditions\." "cdce" } } */
-/* { dg-final { scan-assembler "jmp log" } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -fdump-tree-optimized 
-lm" } */
+/* { dg-final { scan-tree-dump "cdce2.c:16: .* function call is shrink-wrapped into error 
conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "log \\(\[^\n\r]*\\); \\\[tail call\\\]" 
"optimized" } } */
#include <stdlib.h>
  #include <math.h>


        Jakub


Reply via email to