[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2020-03-25 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com
   Priority|P3  |P2

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2020-03-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |WAITING
 Blocks||26163

--- Comment #20 from Richard Biener  ---
The patch from comment#4 got installed so re-analysis is necessary I think.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2020-01-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #19 from Richard Biener  ---
Doesn't seem fixed.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2020-01-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #18 from Richard Biener  ---
(In reply to Martin Liška from comment #17)
> Can the issue be closed as resolved?

I've fixed a -fno-common issue on the tester and will report back after the
next run.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2020-01-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-01-27
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #17 from Martin Liška  ---
Can the issue be closed as resolved?

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #16 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #13 from Uroš Bizjak  ---
> (In reply to rguent...@suse.de from comment #10) 
>> > +FAIL: gcc.target/i386/minmax-7.c scan-assembler pminsd
>> 
>> Not for me.  I've used -march=haswell in all of these testcases to
>> rule out ISA and cost issues.  So I really don't know what's the issue
>> with these FAILs.
>
> IIRC 32bit Solaris doesn't guarantee 16byte stack alignment, so STV is
> disabled.

Indeed: adding -mno-stackrealign (as is done in a couple of other STV
tests already) fixes this failure and the ones reported in PR
rtl-optimization/91154.

Tested with the appropriate runtest invocation on i386-pc-solaris2.11
and x86_64-pc-linux-gnu (both multilibs each).

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #15 from Rainer Orth  ---
Created attachment 46737
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46737&action=edit
Patch for 32-bit Solaris/x86 failures

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #14 from Richard Biener  ---
Author: rguenth
Date: Wed Aug 21 08:44:59 2019
New Revision: 274792

URL: https://gcc.gnu.org/viewcvs?rev=274792&root=gcc&view=rev
Log:
2019-08-21  Richard Biener  

PR target/91498
PR target/91503
* config/i386/i386-features.c
(general_scalar_chain::make_vector_copies): Copy stack temporary
rtx when using it multiple times.
(general_scalar_chain::convert_reg): Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-features.c

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #13 from Uroš Bizjak  ---
(In reply to rguent...@suse.de from comment #10) 
> > +FAIL: gcc.target/i386/minmax-7.c scan-assembler pminsd
> 
> Not for me.  I've used -march=haswell in all of these testcases to
> rule out ISA and cost issues.  So I really don't know what's the issue
> with these FAILs.

IIRC 32bit Solaris doesn't guarantee 16byte stack alignment, so STV is
disabled.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Dmitry G. Dyachenko  changed:

   What|Removed |Added

 CC||dimhen at gmail dot com

--- Comment #12 from Dmitry G. Dyachenko  ---
(In reply to Arseny Solokha from comment #9)
> (In reply to H.J. Lu from comment #7)
> > Our SPEC CPU 2017 failed with
> > 
> >  39 util.c:205:1: error: invalid rtl sharing found in the insn
> >  40   205 | }
> >  41   | ^
> >  42 (insn 29 28 3 2 (set (subreg:V2DI (reg:DI 91) 0)
> >  43 (vec_concat:V2DI (mem/c:DI (plus:DI (reg/f:DI 19 frame)
> >  44 (const_int -8 [0xfff8])) [0  S8 A64])
> >  45 (const_int 0 [0]))) "util.c":134:1 -1
> >  46  (nil))
> >  47 util.c:205:1: error: shared rtx
> >  48 (mem/c:DI (plus:DI (reg/f:DI 19 frame)
> >  49 (const_int -8 [0xfff8])) [0  S8 A64])
> >  50 during RTL pass: stv
> > 
> > We have an invalid shared rtx.
> 
> And the testcase is as simple as:
> 
> int
> ff (int jn)
> {
>   return jn > 0 ? jn : 0;
> }
> 
> % x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190818 -march=nano-3000 -Os -c
> f9272pqv.c
> f9272pqv.c: In function 'ff':
> f9272pqv.c:5:1: error: invalid rtl sharing found in the insn
> 5 | }
>   | ^
> (insn 18 17 3 2 (set (subreg:V4SI (reg:SI 87) 0)
> (vec_merge:V4SI (vec_duplicate:V4SI (mem/c:SI (plus:DI (reg/f:DI 19
> frame)
> (const_int -4 [0xfffc])) [0  S4 A32]))
> (const_vector:V4SI [
> (const_int 0 [0]) repeated x4
> ])
> (const_int 1 [0x1]))) "f9272pqv.c":3:1 -1
>  (nil))
> f9272pqv.c:5:1: error: shared rtx
> (mem/c:SI (plus:DI (reg/f:DI 19 frame)
> (const_int -4 [0xfffc])) [0  S4 A32])
> during RTL pass: stv
> f9272pqv.c:5:1: internal compiler error: internal consistency failure
> 0x9f3eca verify_rtx_sharing
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:2927
> 0x9f3dba verify_rtx_sharing
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:2942
> 0x9f3dba verify_rtx_sharing
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:2942
> 0x9f3dba verify_rtx_sharing
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:2942
> 0x9f4178 verify_insn_sharing
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:3013
> 0x9f79ed verify_rtl_sharing()
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/emit-rtl.c:3036
> 0xc7a8f3 execute_function_todo
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/passes.c:2004
> 0xc7b536 execute_todo
>   
> /var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/
> gcc/passes.c:2037

sounds like PR91503

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #11 from rguenther at suse dot de  ---
On Tue, 20 Aug 2019, asolokha at gmx dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498
> 
> Arseny Solokha  changed:
> 
>What|Removed |Added
> 
>  CC||asolokha at gmx dot com
> 
> --- Comment #9 from Arseny Solokha  ---
> (In reply to H.J. Lu from comment #7)
> > Our SPEC CPU 2017 failed with
> > 
> >  39 util.c:205:1: error: invalid rtl sharing found in the insn
> >  40   205 | }
> >  41   | ^
> >  42 (insn 29 28 3 2 (set (subreg:V2DI (reg:DI 91) 0)
> >  43 (vec_concat:V2DI (mem/c:DI (plus:DI (reg/f:DI 19 frame)
> >  44 (const_int -8 [0xfff8])) [0  S8 A64])
> >  45 (const_int 0 [0]))) "util.c":134:1 -1
> >  46  (nil))
> >  47 util.c:205:1: error: shared rtx
> >  48 (mem/c:DI (plus:DI (reg/f:DI 19 frame)
> >  49 (const_int -8 [0xfff8])) [0  S8 A64])
> >  50 during RTL pass: stv
> > 
> > We have an invalid shared rtx.
> 
> And the testcase is as simple as:
> 
> int
> ff (int jn)
> {
>   return jn > 0 ? jn : 0;
> }
> 
> % x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190818 -march=nano-3000 -Os -c
> f9272pqv.c
> f9272pqv.c: In function 'ff':
> f9272pqv.c:5:1: error: invalid rtl sharing found in the insn
> 5 | }
>   | ^
> (insn 18 17 3 2 (set (subreg:V4SI (reg:SI 87) 0)
> (vec_merge:V4SI (vec_duplicate:V4SI (mem/c:SI (plus:DI (reg/f:DI 19
> frame)
> (const_int -4 [0xfffc])) [0  S4 A32]))
> (const_vector:V4SI [
> (const_int 0 [0]) repeated x4
> ])
> (const_int 1 [0x1]))) "f9272pqv.c":3:1 -1
>  (nil))

I have a patch.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #10 from rguenther at suse dot de  ---
On Tue, 20 Aug 2019, ro at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498
> 
> Rainer Orth  changed:
> 
>What|Removed |Added
> 
>  CC||ro at gcc dot gnu.org
> 
> --- Comment #8 from Rainer Orth  ---
> The new testcase FAILs on both i386-pc-solaris2.11 and x86_64-pc-linux-gnu 
> with
> -m32:
> 
> +FAIL: gcc.target/i386/minmax-7.c scan-assembler pminsd

Not for me.  I've used -march=haswell in all of these testcases to
rule out ISA and cost issues.  So I really don't know what's the issue
with these FAILs.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Arseny Solokha  changed:

   What|Removed |Added

 CC||asolokha at gmx dot com

--- Comment #9 from Arseny Solokha  ---
(In reply to H.J. Lu from comment #7)
> Our SPEC CPU 2017 failed with
> 
>  39 util.c:205:1: error: invalid rtl sharing found in the insn
>  40   205 | }
>  41   | ^
>  42 (insn 29 28 3 2 (set (subreg:V2DI (reg:DI 91) 0)
>  43 (vec_concat:V2DI (mem/c:DI (plus:DI (reg/f:DI 19 frame)
>  44 (const_int -8 [0xfff8])) [0  S8 A64])
>  45 (const_int 0 [0]))) "util.c":134:1 -1
>  46  (nil))
>  47 util.c:205:1: error: shared rtx
>  48 (mem/c:DI (plus:DI (reg/f:DI 19 frame)
>  49 (const_int -8 [0xfff8])) [0  S8 A64])
>  50 during RTL pass: stv
> 
> We have an invalid shared rtx.

And the testcase is as simple as:

int
ff (int jn)
{
  return jn > 0 ? jn : 0;
}

% x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190818 -march=nano-3000 -Os -c
f9272pqv.c
f9272pqv.c: In function 'ff':
f9272pqv.c:5:1: error: invalid rtl sharing found in the insn
5 | }
  | ^
(insn 18 17 3 2 (set (subreg:V4SI (reg:SI 87) 0)
(vec_merge:V4SI (vec_duplicate:V4SI (mem/c:SI (plus:DI (reg/f:DI 19
frame)
(const_int -4 [0xfffc])) [0  S4 A32]))
(const_vector:V4SI [
(const_int 0 [0]) repeated x4
])
(const_int 1 [0x1]))) "f9272pqv.c":3:1 -1
 (nil))
f9272pqv.c:5:1: error: shared rtx
(mem/c:SI (plus:DI (reg/f:DI 19 frame)
(const_int -4 [0xfffc])) [0  S4 A32])
during RTL pass: stv
f9272pqv.c:5:1: internal compiler error: internal consistency failure
0x9f3eca verify_rtx_sharing
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:2927
0x9f3dba verify_rtx_sharing
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:2942
0x9f3dba verify_rtx_sharing
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:2942
0x9f3dba verify_rtx_sharing
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:2942
0x9f4178 verify_insn_sharing
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:3013
0x9f79ed verify_rtl_sharing()
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/emit-rtl.c:3036
0xc7a8f3 execute_function_todo
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/passes.c:2004
0xc7b536 execute_todo
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190818/work/gcc-10-20190818/gcc/passes.c:2037

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Rainer Orth  changed:

   What|Removed |Added

 CC||ro at gcc dot gnu.org

--- Comment #8 from Rainer Orth  ---
The new testcase FAILs on both i386-pc-solaris2.11 and x86_64-pc-linux-gnu with
-m32:

+FAIL: gcc.target/i386/minmax-7.c scan-assembler pminsd

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #7 from H.J. Lu  ---
Our SPEC CPU 2017 failed with

 39 util.c:205:1: error: invalid rtl sharing found in the insn
 40   205 | }
 41   | ^
 42 (insn 29 28 3 2 (set (subreg:V2DI (reg:DI 91) 0)
 43 (vec_concat:V2DI (mem/c:DI (plus:DI (reg/f:DI 19 frame)
 44 (const_int -8 [0xfff8])) [0  S8 A64])
 45 (const_int 0 [0]))) "util.c":134:1 -1
 46  (nil))
 47 util.c:205:1: error: shared rtx
 48 (mem/c:DI (plus:DI (reg/f:DI 19 frame)
 49 (const_int -8 [0xfff8])) [0  S8 A64])
 50 during RTL pass: stv

We have an invalid shared rtx.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #6 from H.J. Lu  ---
(In reply to Uroš Bizjak from comment #5)
> (In reply to Uroš Bizjak from comment #4)
> > Following patch
> 
> HJ, can you please put the patch through some benchmarks? (I have no access
> to SPEC).

Sure. We will measure it.  Thanks.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #5 from Uroš Bizjak  ---
(In reply to Uroš Bizjak from comment #4)
> Following patch

HJ, can you please put the patch through some benchmarks? (I have no access to
SPEC).

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #4 from Uroš Bizjak  ---
Following patch

--cut here--
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 49ab50ea41bf..11c75be113e0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -18601,9 +18601,9 @@ ix86_register_move_cost (machine_mode mode, reg_class_t
class1_i,
where integer modes in SSE registers are not tieable
because of missing QImode and HImode moves to, from or between
MMX/SSE registers.  */
-return MAX (8, SSE_CLASS_P (class1)
-   ? ix86_cost->hard_register.sse_to_integer
-   : ix86_cost->hard_register.integer_to_sse);
+return (SSE_CLASS_P (class1)
+   ? ix86_cost->hard_register.sse_to_integer
+   : ix86_cost->hard_register.integer_to_sse);

   if (MAYBE_FLOAT_CLASS_P (class1))
 return ix86_cost->hard_register.fp_move;
--cut here--

fixes the regression.

(BTW: QI/HImodes are not "missing" at all. We can use %k modifier to move
QImode and HImode values using MOVD instruction between register sets.)

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #3 from Richard Biener  ---
Author: rguenth
Date: Tue Aug 20 08:45:56 2019
New Revision: 274694

URL: https://gcc.gnu.org/viewcvs?rev=274694&root=gcc&view=rev
Log:
2019-08-20  Richard Biener  

PR target/91498
* config/i386/i386-features.c (general_scalar_chain::convert_op):
Use (vec_merge (vec_duplicate..)) style vector from scalar move.
(convert_scalars_to_vector): Add timode_p parameter and use it
to guard TImode-only operation.
(pass_stv::gate): Adjust so STV runs twice for TARGET_64BIT.
(pass_stv::execute): Pass down timode_p.

* gcc.target/i386/minmax-7.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.target/i386/minmax-7.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-features.c
trunk/gcc/testsuite/ChangeLog

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #2 from Uroš Bizjak  ---
(In reply to Richard Biener from comment #1)
> Patch that causes gcc.target/i386/minmax-6.c to spill to the stack:
> https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01283.html
> 
> This makes SI/DImode chains handled by STV2 only (after combine).  We can
> take it from there if we think that's what we need to do anyways.  In the
> end it's STV/RA interaction, I guess if we can take combine out of the
> equation it might simplify things.

Yes, this is the intended way SI/DImode STV should be used.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

--- Comment #1 from Richard Biener  ---
Patch that causes gcc.target/i386/minmax-6.c to spill to the stack:
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01283.html

This makes SI/DImode chains handled by STV2 only (after combine).  We can
take it from there if we think that's what we need to do anyways.  In the
end it's STV/RA interaction, I guess if we can take combine out of the
equation it might simplify things.

[Bug target/91498] [10 Regression] STV change in r274481 causes 300.twolf regression on Haswell

2019-08-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91498

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization, ra
 Target||x86_64-*-* i?86-*-*
 CC||hjl.tools at gmail dot com,
   ||uros at gcc dot gnu.org
   Target Milestone|--- |10.0