From 34a13a521e3fc6f46fcaf2f158d20e66874e99fd Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 31 May 2019 19:04:20 +0200 Subject: [PATCH] apply unary op to both sides of (vec_cond x cst1 cst2) 2019-05-31 Marc Glisse gcc/ * match.pd (~(vec?cst1:cst2)): New transformation. gcc/testsuite/ * g++.dg/tree-ssa/cprop-vcond.C: New file. From-SVN: r271817 --- gcc/ChangeLog | 4 ++++ gcc/match.pd | 15 +++++++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/tree-ssa/cprop-vcond.C | 12 ++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/cprop-vcond.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67cfc44f19b..832ec727959 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-05-31 Marc Glisse + + * match.pd (~(vec?cst1:cst2)): New transformation. + 2019-05-31 Marc Glisse * match.pd (X/[ex]D + + * g++.dg/tree-ssa/cprop-vcond.C: New file. + 2019-05-31 Marc Glisse * gcc.dg/tree-ssa/cmpexactdiv-3.c: New file. diff --git a/gcc/testsuite/g++.dg/tree-ssa/cprop-vcond.C b/gcc/testsuite/g++.dg/tree-ssa/cprop-vcond.C new file mode 100644 index 00000000000..7d62cff1a17 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/cprop-vcond.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-forwprop1-raw" } */ + +typedef long vec __attribute__((vector_size(2*sizeof(long)))); +void f(vec*v){ + vec t = { 5, 16 }; + vec f = { 27, -11 }; + vec r = *v ? t : f; + *v = -r; +} + +/* { dg-final { scan-tree-dump-not "negate_expr" "forwprop1" } } */ -- 2.30.2