[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2018-10-17 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

Wilco  changed:

   What|Removed |Added

 CC||wilco at gcc dot gnu.org

--- Comment #7 from Wilco  ---
(In reply to Bernd Edlinger from comment #6)
> Author: edlinger
> Date: Thu Aug  4 13:20:57 2016
> New Revision: 239122
> 
> URL: https://gcc.gnu.org/viewcvs?rev=239122=gcc=rev
> Log:
> 2016-08-04  Bernd Edlinger  
> 
> PR rtl-optimization/70903
> * cse.c (cse_insn): If DEST is a paradoxical SUBREG, don't record
> DEST.
> 
> testsuite:
> 2016-08-04  Bernd Edlinger  
> 
> PR rtl-optimization/70903
> * gcc.c-torture/execute/pr70903.c: New test.
> 
> Added:
> trunk/gcc/testsuite/gcc.c-torture/execute/pr70903.c
> Modified:
> trunk/gcc/ChangeLog
> trunk/gcc/cse.c
> trunk/gcc/testsuite/ChangeLog

This should be backported to GCC6/7.

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-08-04 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

--- Comment #6 from Bernd Edlinger  ---
Author: edlinger
Date: Thu Aug  4 13:20:57 2016
New Revision: 239122

URL: https://gcc.gnu.org/viewcvs?rev=239122=gcc=rev
Log:
2016-08-04  Bernd Edlinger  

PR rtl-optimization/70903
* cse.c (cse_insn): If DEST is a paradoxical SUBREG, don't record DEST.

testsuite:
2016-08-04  Bernd Edlinger  

PR rtl-optimization/70903
* gcc.c-torture/execute/pr70903.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr70903.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cse.c
trunk/gcc/testsuite/ChangeLog

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-07-26 Thread jgreenhalgh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

James Greenhalgh  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||jgreenhalgh at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #5 from James Greenhalgh  ---
Technically this report came first, but looks to be the same root as PR71779,
which has a patch.

*** This bug has been marked as a duplicate of bug 71779 ***

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

--- Comment #4 from ktkachov at gcc dot gnu.org ---
Basically at expand time we're expanding:

  vector(32) unsigned char _4;
  unsigned char _5;
  _3 = {65535, _2};
  _4 = VIEW_CONVERT_EXPR(_3);
  _5 = BIT_FIELD_REF <_4, 8, 8>;

and we're getting:
(insn 17 16 18 (set (subreg:DI (reg:OI 91 [ D.2757 ]) 0)
(const_int 65535 [0x])) bfi.c:7 -1
 (nil))

(insn 18 17 19 (set (subreg:DI (reg:OI 91 [ D.2757 ]) 8)
(subreg:DI (reg/v:OI 84 [ x ]) 0)) bfi.c:7 -1
 (nil))

(insn 19 18 20 (set (subreg:DI (reg:QI 94) 0)
(zero_extract:DI (subreg:DI (reg:OI 91 [ D.2757 ]) 0)
(const_int 8 [0x8])
(const_int 8 [0x8]))) bfi.c:7 -1
 (nil))

(insn 20 19 21 (set (reg:DI 95)
(subreg:DI (reg:QI 94) 0)) bfi.c:7 -1
 (nil))


the various RTL optimizers propagate the 65535 through the subregs and
zero-extracts and it ends up as -1 (0x) in reg 95.

I'm not sure what path during expand expands this operation, but the subreg on
insn 20 is probably wrong, as we do care about the bits beyond QImode, we want
a zero_extend.

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

--- Comment #3 from ktkachov at gcc dot gnu.org ---
Although, that seems to be exposing something else that's fishy, looking at the
combine dumps I see it combining:
(insn 19 42 20 2 (set (subreg:DI (reg:QI 94) 0)
(const_int 255 [0xff])) bfi.c:7 50 {*movdi_aarch64}
 (nil))
(insn 20 19 21 2 (set (reg:DI 95)
(subreg:DI (reg:QI 94) 0)) bfi.c:7 50 {*movdi_aarch64}
 (expr_list:REG_DEAD (reg:QI 94)
(expr_list:REG_EQUAL (const_int 255 [0xff])
(nil

into:

(insn 20 19 21 2 (set (reg:DI 95)
(const_int -1 [0x])) bfi.c:7 50 {*movdi_aarch64}
 (expr_list:REG_EQUAL (const_int 255 [0xff])
(nil)))

That's where the -1 comes from. Need to see why the reg94 := 255 was
represented that way (with a subreg)

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

--- Comment #2 from ktkachov at gcc dot gnu.org ---
-fno-rerun-cse-after-loop "fixes" the tescase. cse2 is where it starts to go
wrong

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-05-03
 CC||ktkachov at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed.

[Bug target/70903] [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

2016-05-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70903

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |4.9.4