[Bug rtl-optimization/68217] Wrong constant folding

2018-11-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Known to work||6.3.0, 7.1.0
 Resolution|--- |FIXED
  Known to fail||6.2.0

--- Comment #6 from Richard Biener  ---
The testcase starts to pass somewhen between 6.2 (FAIL) and 6.3 (PASS).

[Bug rtl-optimization/68217] Wrong constant folding

2018-11-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #5 from Martin Liška  ---
Can the bug be marked as resolved?

[Bug rtl-optimization/68217] Wrong constant folding

2016-07-28 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Jul 29 00:35:23 2016
New Revision: 238846

URL: https://gcc.gnu.org/viewcvs?rev=238846=gcc=rev
Log:
gcc/ChangeLog:

2016-07-29  Kugan Vivekanandarajah  

PR middle-end/68217
* tree-vrp.c (extract_range_from_binary_expr_1): In case of signed
& sign-bit-CST, generate [-INF, 0] instead of [-INF, INF].


gcc/testsuite/ChangeLog:

2016-07-29  Kugan Vivekanandarajah  

PR middle-end/68217
* gcc.dg/pr68217.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr68217.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c

[Bug rtl-optimization/68217] Wrong constant folding

2015-11-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener  ---
Ok, so combine should have used sign_extract here because of the comparison
code I think.

There is also a missed optimization in VRP as signed & sign-bit-CST should
result in a [-INF, 0] range, not a [-INF, INF] range as now.

[Bug rtl-optimization/68217] Wrong constant folding

2015-11-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

Richard Biener  changed:

   What|Removed |Added

  Known to fail||4.1.2, 4.3.5

--- Comment #2 from Richard Biener  ---
Fails with just -O1 as well, --param max-combine-insns=2 "fixes" it, =3
"fails".
Thus it's triggered by a 3-insn combine:

Trying 9 -> 10:
Successfully matched this instruction:
(set (reg:CCNO 17 flags)
(compare:CCNO (and:DI (reg:DI 91 [ D.1848 ])
(reg:DI 93))
(const_int 0 [0])))
allowing combination of insns 9 and 10
original costs 4 + 4 = 8

Trying 7, 8 -> 10:
Successfully matched this instruction:
(set (reg:CCZ 17 flags)
(compare:CCZ (zero_extract:DI (subreg:DI (reg:SI 87 [ D.1847 ]) 0)
(const_int 1 [0x1])
(const_int 31 [0x1f]))
(const_int 0 [0])))
Successfully matched this instruction:
(set (pc)
(if_then_else (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(label_ref 15)
(pc)))
allowing combination of insns 7, 8 and 10
original costs 4 + 3 + 8 = 0
replacement cost 4

Before:

(insn 7 6 8 2 (set (reg:DI 91 [ D.1848 ])
(sign_extend:DI (reg:SI 87 [ D.1847 ]))) t.c:5 142 {*extendsidi2_rex64}
 (expr_list:REG_DEAD (reg:SI 87 [ D.1847 ])
(nil)))
(insn 8 7 9 2 (set (reg:DI 93)
(const_int -9223372036854775808 [0x8000])) t.c:5 89
{*movdi_internal}
 (nil))
(insn 9 8 10 2 (parallel [
(set (reg:DI 92 [ x ])
(and:DI (reg:DI 91 [ D.1848 ])
(reg:DI 93)))
(clobber (reg:CC 17 flags))
]) t.c:5 381 {*anddi_1}
 (expr_list:REG_DEAD (reg:DI 93)
(expr_list:REG_DEAD (reg:DI 91 [ D.1848 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (and:DI (reg:DI 91 [ D.1848 ])
(const_int -9223372036854775808 [0x8000]))
(nil))
(insn 10 9 11 2 (set (reg:CCNO 17 flags)
(compare:CCNO (reg:DI 92 [ x ])
(const_int 0 [0]))) t.c:5 4 {*cmpdi_ccno_1}
 (expr_list:REG_DEAD (reg:DI 92 [ x ])
(nil)))

After:

(note 7 6 8 2 NOTE_INSN_DELETED)
(note 8 7 9 2 NOTE_INSN_DELETED)
(note 9 8 10 2 NOTE_INSN_DELETED)
(insn 10 9 11 2 (set (reg:CCZ 17 flags)
(compare:CCZ (zero_extract:DI (subreg:DI (reg:SI 87 [ D.1847 ]) 0)
(const_int 1 [0x1])
(const_int 31 [0x1f]))
(const_int 0 [0]))) t.c:5 368 {*testqi_ext_3}
 (expr_list:REG_DEAD (reg:SI 87 [ D.1847 ])
(nil)))


The zero-extract is weird and the subreg should be the high-part?

[Bug rtl-optimization/68217] Wrong constant folding

2015-11-04 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

Marc Glisse  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-11-05
  Component|c   |rtl-optimization
 Ever confirmed|0   |1
  Known to fail||4.8.5, 4.9.3, 5.2.1

--- Comment #1 from Marc Glisse  ---
Might happen during the combine pass (or not).