[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-30 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #6 from Georg-Johann Lay  ---
Created attachment 41861
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41861=edit
time-i.c: C test case

(In reply to Richard Biener from comment #4)
> Fixed?

No.  The attached test case

$ avr-gcc-8 time-i.c -mmcu=atmega168 -O2 -S -dp

Still uses slow __[u]divmodhi when optimizing for speed.  The code has 2
divisions and modulo with 60.  The first mod is expanded as mul highpart (insn
25) but the second is expanded as __divmodhi4 call (insn 67):

timeid_add:
...
ldi r26,lo8(-119);  24  *movhi/5[length = 2]
ldi r27,lo8(-120)
call __umulhisi3 ;  25  *umulhi3_highpart_call  [length = 2]
...
ldi r22,lo8(16)  ;  61  *movhi/5[length = 2]
ldi r23,lo8(14)
call __udivmodhi4;  62  *udivmodhi4_call[length = 2]
std Z+2,r22  ;  34  movqi_insn/3[length = 1]
movw r24,r18 ;  65  *movhi/1[length = 1]
ldi r22,lo8(60)  ;  66  *movhi/5[length = 2]
ldi r23,0
call __divmodhi4 ;  67  *divmodhi4_call [length = 2]
std Z+1,r24  ;  50  movqi_insn/3[length = 1]
/* epilogue start */

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-25 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #5 from Georg-Johann Lay  ---
(In reply to Richard Biener from comment #4)
> Fixed?

Not sure; the middle-end (rtlanal.c::insn_rtx_cost, seq_cost) are still
bypassing PARALLELs with more than 1 SET, i.e. assume cost of 1.

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #4 from Richard Biener  ---
Fixed?

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.2

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-17 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #3 from Georg-Johann Lay  ---
Author: gjl
Date: Mon Jul 17 09:09:42 2017
New Revision: 250260

URL: https://gcc.gnu.org/viewcvs?rev=250260=gcc=rev
Log:
Backport from 2017-07-17 trunk r250258.
PR 80929
* config/avr/avr.c (avr_mul_highpart_cost): New static function.
(avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost.
[LSHIFTRT, outer_code = TRUNCATE]: Same.

Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/avr/avr.c

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-17 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #2 from Georg-Johann Lay  ---
Author: gjl
Date: Mon Jul 17 09:06:39 2017
New Revision: 250259

URL: https://gcc.gnu.org/viewcvs?rev=250259=gcc=rev
Log:
Backport from 2017-07-17 trunk r250258.
PR 80929
* config/avr/avr.c (avr_mul_highpart_cost): New static function.
(avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost.
[LSHIFTRT, outer_code = TRUNCATE]: Same.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/avr/avr.c

[Bug middle-end/80929] [7/8 Regression] Division with constant no more optimized to mult highpart

2017-07-17 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929

--- Comment #1 from Georg-Johann Lay  ---
Author: gjl
Date: Mon Jul 17 08:56:06 2017
New Revision: 250258

URL: https://gcc.gnu.org/viewcvs?rev=250258=gcc=rev
Log:
PR 80929
* config/avr/avr.c (avr_mul_highpart_cost): New static function.
(avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost.
[LSHIFTRT, outer_code = TRUNCATE]: Same.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/avr/avr.c