Message ID | CAMZc-bwnD92c-yNLLKfGXp6VBAGCCqRaYgoLo=zXbfww90i=-g@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | [PR,97506] Simplify trivial vcond_expr in expander. | expand |
On Wed, Oct 21, 2020 at 02:29:07PM +0800, Hongtao Liu via Gcc-patches wrote: > gcc/ChangeLog: > > PR target/97506 > * config/i386/i386-expand.c (ix86_expand_sse_movcc): Move > op_true to dest directly When op_true equals op_false, Lowercase when in the middle of sentence. Use . instead of , at the end. > --- a/gcc/config/i386/i386-expand.c > +++ b/gcc/config/i386/i386-expand.c > @@ -3525,6 +3525,13 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx > op_true, rtx op_false) > machine_mode mode = GET_MODE (dest); > machine_mode cmpmode = GET_MODE (cmp); > > + /* Simplify trivial vcond_expr to avoid ICE error in pr97506. */ There is no such thing as vcond_expr, I'd say use VEC_COND_EXPR instead. Please change ICE error to just ICE, ICE stands for internal compiler error, so the error word is in there already. Otherwise LGTM. > + if (rtx_equal_p (op_true, op_false)) > + { > + emit_move_insn (dest, op_true); > + return; > + } > + > /* In AVX512F the result of comparison is an integer mask. */ > bool maskcmp = mode != cmpmode && ix86_valid_mask_cmp_mode (mode); > > diff --git a/gcc/testsuite/gcc.target/i386/pr97506.c > b/gcc/testsuite/gcc.target/i386/pr97506.c > new file mode 100644 > index 00000000000..74714cfab2c > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr97506.c > @@ -0,0 +1,19 @@ > +/* PR target/97506 */ > +/* { dg-do compile } */ > +/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp > -mavx512vbmi -mavx512vl" } */ > + > +typedef unsigned char __attribute__ ((__vector_size__ (16))) U; > +typedef int __attribute__ ((__vector_size__ (4))) V; > +U u; > + > +void > +bar (int i, V v) > +{ > + u += (char) i & (char) i > (U){}; > +} > + > +void > +foo (void) > +{ > + bar (0, (V){}); > +} > -- > 2.18.1 > > > -- > BR, > Hongtao Jakub
On Wed, Oct 21, 2020 at 5:07 PM Jakub Jelinek <jakub@redhat.com> wrote: > > On Wed, Oct 21, 2020 at 02:29:07PM +0800, Hongtao Liu via Gcc-patches wrote: > > gcc/ChangeLog: > > > > PR target/97506 > > * config/i386/i386-expand.c (ix86_expand_sse_movcc): Move > > op_true to dest directly When op_true equals op_false, > > Lowercase when in the middle of sentence. Use . instead of , at the end. > > > --- a/gcc/config/i386/i386-expand.c > > +++ b/gcc/config/i386/i386-expand.c > > @@ -3525,6 +3525,13 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx > > op_true, rtx op_false) > > machine_mode mode = GET_MODE (dest); > > machine_mode cmpmode = GET_MODE (cmp); > > > > + /* Simplify trivial vcond_expr to avoid ICE error in pr97506. */ > > There is no such thing as vcond_expr, I'd say use VEC_COND_EXPR instead. > Please change ICE error to just ICE, ICE stands for internal compiler error, > so the error word is in there already. > > Otherwise LGTM. > Thanks for the review, i'll commit the patch with upper adjustment. > > + if (rtx_equal_p (op_true, op_false)) > > + { > > + emit_move_insn (dest, op_true); > > + return; > > + } > > + > > /* In AVX512F the result of comparison is an integer mask. */ > > bool maskcmp = mode != cmpmode && ix86_valid_mask_cmp_mode (mode); > > > > diff --git a/gcc/testsuite/gcc.target/i386/pr97506.c > > b/gcc/testsuite/gcc.target/i386/pr97506.c > > new file mode 100644 > > index 00000000000..74714cfab2c > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/i386/pr97506.c > > @@ -0,0 +1,19 @@ > > +/* PR target/97506 */ > > +/* { dg-do compile } */ > > +/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp > > -mavx512vbmi -mavx512vl" } */ > > + > > +typedef unsigned char __attribute__ ((__vector_size__ (16))) U; > > +typedef int __attribute__ ((__vector_size__ (4))) V; > > +U u; > > + > > +void > > +bar (int i, V v) > > +{ > > + u += (char) i & (char) i > (U){}; > > +} > > + > > +void > > +foo (void) > > +{ > > + bar (0, (V){}); > > +} > > -- > > 2.18.1 > > > > > > -- > > BR, > > Hongtao > > Jakub >
From c31173a93b64854d33cf284d8f88db30b9b65609 Mon Sep 17 00:00:00 2001 From: liuhongt <hongtao.liu@intel.com> Date: Wed, 21 Oct 2020 13:05:16 +0800 Subject: [PATCH] Simplify trivial vcond_expr in expander. gcc/ChangeLog: PR target/97506 * config/i386/i386-expand.c (ix86_expand_sse_movcc): Move op_true to dest directly When op_true equals op_false, gcc/testsuite/ChangeLog: PR target/97506 * gcc.target/i386/pr97506.c: New test. --- gcc/config/i386/i386-expand.c | 7 +++++++ gcc/testsuite/gcc.target/i386/pr97506.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr97506.c diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index e6f8b314f18..d036a3b5b4e 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -3525,6 +3525,13 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) machine_mode mode = GET_MODE (dest); machine_mode cmpmode = GET_MODE (cmp); + /* Simplify trivial vcond_expr to avoid ICE error in pr97506. */ + if (rtx_equal_p (op_true, op_false)) + { + emit_move_insn (dest, op_true); + return; + } + /* In AVX512F the result of comparison is an integer mask. */ bool maskcmp = mode != cmpmode && ix86_valid_mask_cmp_mode (mode); diff --git a/gcc/testsuite/gcc.target/i386/pr97506.c b/gcc/testsuite/gcc.target/i386/pr97506.c new file mode 100644 index 00000000000..74714cfab2c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97506.c @@ -0,0 +1,19 @@ +/* PR target/97506 */ +/* { dg-do compile } */ +/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp -mavx512vbmi -mavx512vl" } */ + +typedef unsigned char __attribute__ ((__vector_size__ (16))) U; +typedef int __attribute__ ((__vector_size__ (4))) V; +U u; + +void +bar (int i, V v) +{ + u += (char) i & (char) i > (U){}; +} + +void +foo (void) +{ + bar (0, (V){}); +} -- 2.18.1