[Bug middle-end/113180] MIPS: bitops on an long long struct uses ins instead dins (or with -mstrict-align on aarch64)

2024-05-06 Thread syq at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113180

--- Comment #3 from YunQiang Su  ---
The argument `to` of `expand_assignment` differs between `strict-align` and
`no-strict-align`.

`debug_tree` states that the `strict-align` one has a `MEMREF` RTL, while 
`no-strict-align` has a `reg` one.

Any idea when the RTL is generated from STMT?

[Bug middle-end/113180] MIPS: bitops on an long long struct uses ins instead dins (or with -mstrict-align on aarch64)

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113180

Andrew Pinski  changed:

   What|Removed |Added

 Target|mips aarch64*-*-*   |mips aarch64*-*-* arm*-*

--- Comment #2 from Andrew Pinski  ---
arm is just as bad:
```
xx:
@ args = 8, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
sub sp, sp, #8
mov r3, r0
strdr1, r2, [sp]
ldr r1, [sp, #8]
ldrbr2, [sp, #7]@ zero_extendqisi2
bfi r2, r1, #4, #4
strbr2, [sp, #7]
ldrdr0, r1, [sp]
stm r3, {r0, r1}
mov r0, r3
add sp, sp, #8
@ sp needed
bx  lr
```

Basically the variable a is stored to the stack and then modified and then
stored to the stack and then loaded and stored to the return location.

This is all due to STRICT alignment IIRC.

[Bug middle-end/113180] MIPS: bitops on an long long struct uses ins instead dins (or with -mstrict-align on aarch64)

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113180

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug middle-end/113180] MIPS: bitops on an long long struct uses ins instead dins (or with -mstrict-align on aarch64)

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113180

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
  Component|target  |middle-end
 Target|mips|mips aarch64*-*-*
 Status|UNCONFIRMED |NEW
   Keywords||missed-optimization
   Last reconfirmed||2023-12-31
Summary|MIPS: bitops on an long |MIPS: bitops on an long
   |long struct uses ins|long struct uses ins
   |instead dins|instead dins (or with
   ||-mstrict-align on aarch64)

--- Comment #1 from Andrew Pinski  ---
The same issue happens on aarch64 with -mstrict-align though it is not as bad
as mips but the underlying issue is the same:
```
sub sp, sp, #32
.cfi_def_cfa_offset 32
str x0, [sp, 8]
lsr x0, x0, 32
bfi w0, w1, 28, 4
str w0, [sp, 12]
ldr x0, [sp, 8]
add sp, sp, 32
ret
```

Confirmed. there might be other bug reports which are very similar too.