qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	"Greg Kurz" <groug@kaod.org>, "Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH] target/ppc: fix compilation breakage on windows
Date: Sat, 15 Dec 2018 19:42:22 +0100	[thread overview]
Message-ID: <20181215184222.15127-1-clg@kaod.org> (raw)

Fix the PPC_BIT definitions to use ULL instead in UL and replace
__builtin_ffssl() by the equivalent ctz routines.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Compile tested with --cross-prefix=x86_64-w64-mingw32-. When I have
 some more time, I might try runtime on windows also.

 The PPC compile failures have been there for a while (pre 2.12) and
 the MASK_TO_LSH macro was not used until the XIVE definitions were
 introduced.

 I let you guys decide on how you want to proceed, but I think it is
 safe to merge this patch as a prereq of the pull request.

 Thanks,

 C.

 target/ppc/cpu.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index ab68abe8a23c..a3d3e91eb4ce 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -70,18 +70,18 @@
 #define PPC_ELF_MACHINE     EM_PPC
 #endif
 
-#define PPC_BIT(bit)            (0x8000000000000000UL >> (bit))
-#define PPC_BIT32(bit)          (0x80000000UL >> (bit))
-#define PPC_BIT8(bit)           (0x80UL >> (bit))
+#define PPC_BIT(bit)            (0x8000000000000000ULL >> (bit))
+#define PPC_BIT32(bit)          (0x80000000ULL >> (bit))
+#define PPC_BIT8(bit)           (0x80ULL >> (bit))
 #define PPC_BITMASK(bs, be)     ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
 #define PPC_BITMASK32(bs, be)   ((PPC_BIT32(bs) - PPC_BIT32(be)) | \
                                  PPC_BIT32(bs))
 #define PPC_BITMASK8(bs, be)    ((PPC_BIT8(bs) - PPC_BIT8(be)) | PPC_BIT8(bs))
 
 #if HOST_LONG_BITS == 32
-# define MASK_TO_LSH(m)          (__builtin_ffsll(m) - 1)
+# define MASK_TO_LSH(m)          ctz32(m)
 #elif HOST_LONG_BITS == 64
-# define MASK_TO_LSH(m)          (__builtin_ffsl(m) - 1)
+# define MASK_TO_LSH(m)          ctz64(m)
 #else
 # error Unknown sizeof long
 #endif
-- 
2.17.2

             reply	other threads:[~2018-12-15 18:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 18:42 Cédric Le Goater [this message]
2018-12-17  4:50 ` [Qemu-devel] [PATCH] target/ppc: fix compilation breakage on windows David Gibson
2018-12-17  7:58   ` Cédric Le Goater
2018-12-17 12:40   ` Peter Maydell

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=20181215184222.15127-1-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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 NNTP newsgroup(s).