public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-25  0:02 ` pinskia at gcc dot gnu.org
  2012-01-25 10:43 ` zsojka at seznam dot cz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-25  0:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-24 22:52:54 UTC ---
This is dup of the merge loads from two adjacent memory location into one load
bug.  Which I don't remember the number of the bug right now.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
  2012-01-25  0:02 ` [Bug target/43311] missed 'movw' optimization pinskia at gcc dot gnu.org
@ 2012-01-25 10:43 ` zsojka at seznam dot cz
  2012-01-25 11:21 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2012-01-25 10:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #3 from Zdenek Sojka <zsojka at seznam dot cz> 2012-01-25 10:35:47 UTC ---
Does the following code have undefined behavior?

typedef struct { unsigned char b1, b2; } __attribute__((aligned(8))) S;
void f( S const* s, unsigned char* b1, unsigned char* b2 )
{
        *b1 = s->b1;
        *b2 = s->b2;
}

int main()
{
  S s = { 1, 2 };
  f(&s, &s.b2, &s.b2);
  return s.b2 != 1;
}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
  2012-01-25  0:02 ` [Bug target/43311] missed 'movw' optimization pinskia at gcc dot gnu.org
  2012-01-25 10:43 ` zsojka at seznam dot cz
@ 2012-01-25 11:21 ` rguenth at gcc dot gnu.org
  2012-01-25 13:15 ` zsojka at seznam dot cz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-25 11:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-25 11:13:40 UTC ---
(In reply to comment #3)
> Does the following code have undefined behavior?
> 
> typedef struct { unsigned char b1, b2; } __attribute__((aligned(8))) S;
> void f( S const* s, unsigned char* b1, unsigned char* b2 )
> {
>         *b1 = s->b1;
>         *b2 = s->b2;
> }
> 
> int main()
> {
>   S s = { 1, 2 };
>   f(&s, &s.b2, &s.b2);
>   return s.b2 != 1;
> }

No, s.b2 should be 1.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-01-25 11:21 ` rguenth at gcc dot gnu.org
@ 2012-01-25 13:15 ` zsojka at seznam dot cz
  2012-01-25 13:21 ` jakub at gcc dot gnu.org
  2022-01-05 23:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2012-01-25 13:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

--- Comment #5 from Zdenek Sojka <zsojka at seznam dot cz> 2012-01-25 12:56:30 UTC ---
(In reply to comment #4)
> 
> No, s.b2 should be 1.

Thank you for the answer. In that case, the optimisation in comment #0 can't be
done in a general case (unless I have overlooked something).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-01-25 13:15 ` zsojka at seznam dot cz
@ 2012-01-25 13:21 ` jakub at gcc dot gnu.org
  2022-01-05 23:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-25 13:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-25 13:16:10 UTC ---
For storing two small adjacent constants there is PR22141, that is always safe,
but the question is when it is desirable (that is the primary reason why the
patch isn't in the tree yet).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
       [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-01-25 13:21 ` jakub at gcc dot gnu.org
@ 2022-01-05 23:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-05 23:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|x86_64-gnu-linux            |
              Build|x86_64-gnu-linux            |

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Zdenek Sojka from comment #5)
> (In reply to comment #4)
> > 
> > No, s.b2 should be 1.
> 
> Thank you for the answer. In that case, the optimisation in comment #0 can't
> be done in a general case (unless I have overlooked something).

Right this makes the code wrong if we do this, an aliasing issue. 

But this is well defined to do:
typedef struct { unsigned char b1, b2; } __attribute__((aligned(8))) S;
void f( S const* __restrict__ s, unsigned char* __restrict__ b1, unsigned char*
__restrict__ b2 )
{
        *b1 = s->b1;
        *b2 = s->b2;
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/43311] missed 'movw' optimization.
  2010-03-09 19:06 [Bug target/43311] New: " pluto at agmk dot net
@ 2010-03-10 10:55 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-10 10:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-03-10 10:55 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-10 10:55:26
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-05 23:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
2012-01-25  0:02 ` [Bug target/43311] missed 'movw' optimization pinskia at gcc dot gnu.org
2012-01-25 10:43 ` zsojka at seznam dot cz
2012-01-25 11:21 ` rguenth at gcc dot gnu.org
2012-01-25 13:15 ` zsojka at seznam dot cz
2012-01-25 13:21 ` jakub at gcc dot gnu.org
2022-01-05 23:28 ` pinskia at gcc dot gnu.org
2010-03-09 19:06 [Bug target/43311] New: " pluto at agmk dot net
2010-03-10 10:55 ` [Bug target/43311] " rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).