[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2019-03-04 Thread steven at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

Steven Bosscher  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WORKSFORME

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2016-12-16
 Ever confirmed|0   |1

--- Comment #6 from Richard Biener  ---
On trunk it might finally work also for AVR (reassoc does that transform, but
not for signed ints).

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-16 Thread freddie_chopin at op dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

--- Comment #5 from Freddie Chopin  ---
Sure, more data points show that this is most likely a problem in a target
component, not in middle-end or c front-end.

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-16 Thread pj at hugeone dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

--- Comment #4 from Piotr  ---
Freddie it is about avr-gcc not arm-gcc.

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-16 Thread freddie_chopin at op dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

Freddie Chopin  changed:

   What|Removed |Added

 CC||freddie_chopin at op dot pl

--- Comment #3 from Freddie Chopin  ---
Works fine on arm-none-eabi- on -O1, -O2, -O3:

y = nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8
+ nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8;
 80001e4:   4b03ldr r3, [pc, #12]   ; (80001f4 )
 80001e6:   4a04ldr r2, [pc, #16]   ; (80001f8 )
 80001e8:   781bldrbr3, [r3, #0]
 80001ea:   011blslsr3, r3, #4
 80001ec:   8013strhr3, [r2, #0]

However on -Os suboptimal (and actually longer) code is generated:

y = nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8
+ nvx8 + nvx8 + nvx8 + nvx8 + nvx8 + nvx8;
 8008ef6:   4b75ldr r3, [pc, #468]  ; (80090cc
)
 8008efa:   781aldrbr2, [r3, #0]
 8008efc:   eb02 03c2   add.w   r3, r2, r2, lsl #3
 8008f00:   eb03 0382   add.w   r3, r3, r2, lsl #2
 8008f04:   eb03 0342   add.w   r3, r3, r2, lsl #1
 8008f08:   4413add r3, r2
 8008f0a:   4a71ldr r2, [pc, #452]  ; (80090d0
)
 8008f0c:   b29buxthr3, r3
 8008f0e:   8013strhr3, [r2, #0]

Similar code is generated for -Og.

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-15 Thread pj at hugeone dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

--- Comment #2 from Piotr  ---
avr-gcc actually

[Bug middle-end/78824] multiple add should in my opinion be optimized to multiplication

2016-12-15 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78824

--- Comment #1 from Andrew Pinski  ---
Works for me on aarch64-linux-gnu with GCC 5.4 and above:
main:
adrpx1, nvx8
adrpx2, y
mov w0, 0
ldrbw1, [x1, #:lo12:nvx8]
lsl w1, w1, 4
strhw1, [x2, #:lo12:y]
ret