public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Andreas Schwab <schwab@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR69047
Date: Tue, 30 Aug 2016 09:22:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1608301121100.26629@t29.fhfr.qr> (raw)
In-Reply-To: <mvmy43gkjz8.fsf@hawking.suse.de>

On Mon, 29 Aug 2016, Andreas Schwab wrote:

> On Aug 26 2016, Richard Biener <rguenther@suse.de> wrote:
> 
> > Index: gcc/testsuite/gcc.dg/pr69047.c
> > ===================================================================
> > --- gcc/testsuite/gcc.dg/pr69047.c	(revision 0)
> > +++ gcc/testsuite/gcc.dg/pr69047.c	(working copy)
> > @@ -0,0 +1,18 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O -fdump-tree-cddce1" } */
> > +
> > +__UINT8_TYPE__
> > +f(__UINT16_TYPE__ b)
> > +{
> > +  __UINT8_TYPE__ a;
> > +#if __BYTE_ORDER == __LITTLE_ENDIAN
> > +  __builtin_memcpy(&a, &b, sizeof a);
> > +#elif __BYTE_ORDER == __BIG_ENDIAN
> > +  __builtin_memcpy(&a, (char *)&b + sizeof a, sizeof a);
> > +#else
> > +  a = b;
> > +#endif
> > +  return a;
> > +}
> > +
> > +/* { dg-final { scan-tree-dump "_\[0-9\]+ = \\(\[^)\]+\\) b" "cddce1" } } */
> >
> 
> On m68k:
> 
> FAIL: gcc.dg/pr69047.c scan-tree-dump cddce1 "_[0-9]+ = \\([^)]+\\) b"
> 
> $ cat pr69047.c.037t.cddce1 
> 
> ;; Function f (f, funcdef_no=0, decl_uid=1432, cgraph_uid=0, symbol_order=0)
> 
> f (short unsigned int b)
> {
>   unsigned char a;
>   unsigned char _2;
> 
>   <bb 2>:
>   _2 = BIT_FIELD_REF <b_6(D), 8, 0>;
>   return _2;
> 
> }
> 
> 
> Andreas.

Ah, forgot to re-write to use GCC internal macros.

Tested on m68k, applied.

Richard.

2016-08-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69047
	* gcc.dg/pr69047.c: Fix byte-order check.

Index: gcc/testsuite/gcc.dg/pr69047.c
===================================================================
--- gcc/testsuite/gcc.dg/pr69047.c	(revision 239856)
+++ gcc/testsuite/gcc.dg/pr69047.c	(working copy)
@@ -5,9 +5,9 @@ __UINT8_TYPE__
 f(__UINT16_TYPE__ b)
 {
   __UINT8_TYPE__ a;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
   __builtin_memcpy(&a, &b, sizeof a);
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
   __builtin_memcpy(&a, (char *)&b + sizeof a, sizeof a);
 #else
   a = b;

      reply	other threads:[~2016-08-30  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 12:31 Richard Biener
2016-08-29  9:22 ` Andreas Schwab
2016-08-30  9:22   ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.11.1608301121100.26629@t29.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).