[Bug target/92041] m68k optimizations (-O2, -O3 or -Ofast) generates wrong code

2019-10-10 Thread djipi.mari at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92041

Jean-Paul Mari  changed:

   What|Removed |Added

  Known to work||8.3.0
  Known to fail||9.1.0

--- Comment #2 from Jean-Paul Mari  ---
Following the bug 78074 fix workaround (-fno-builtin) generates a correct
assembly now. Thank you for the hint.

[Bug target/92041] New: m68k optimizations (-O2, -O3 or -Ofast) generates wrong code

2019-10-09 Thread djipi.mari at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92041

Bug ID: 92041
   Summary: m68k optimizations (-O2, -O3 or -Ofast) generates
wrong code
   Product: gcc
   Version: 9.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: djipi.mari at gmail dot com
  Target Milestone: ---
  Host: x86
Target: m68k-elf

This code:
void *calloc(size_t num_elements, size_t size)
{
void *ptr = malloc(num_elements*size);

if (ptr)
{
memset(ptr, 0, (num_elements*size));
}

return  ptr;
}

Generates this assembly when using -O2, -O3 or -Ofast:
calloc:
move.l 8(%sp),%d0
moveq #1,%d1
move.l %d1,8(%sp)
move.l %d0,-(%sp)
move.l 8(%sp),-(%sp)
jsr __mulsi3
addq.l #8,%sp
move.l %d0,4(%sp)
jra calloc

The issue appears since the 9.1.0, previous versions do not have such issues.

[Bug target/82182] m68k slow code: u16/u8 division calls divsi3

2019-09-10 Thread djipi.mari at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82182

Jean-Paul Mari  changed:

   What|Removed |Added

 CC||djipi.mari at gmail dot com

--- Comment #4 from Jean-Paul Mari  ---
Same results with the 9.2.0
Also checked with versions before the 7.1.0, and got the same results.