qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128()
@ 2022-07-21  7:48 Thomas Huth
  2022-07-24  3:29 ` Richard Henderson
  2022-08-04 11:49 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2022-07-21  7:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Richard Henderson

We currently require at least GCC 7.4 or Clang 6.0 for compiling QEMU.
GCC has __builtin_mul_overflow since version 5 already, and Clang 6.0
also provides this built-in function (see its documentation on this page:
https://releases.llvm.org/6.0.0/tools/clang/docs/LanguageExtensions.html ).
So we can simplify the #if statement here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/qemu/host-utils.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
index 29f3a99878..88d476161c 100644
--- a/include/qemu/host-utils.h
+++ b/include/qemu/host-utils.h
@@ -533,8 +533,7 @@ static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret)
  */
 static inline bool mulu128(uint64_t *plow, uint64_t *phigh, uint64_t factor)
 {
-#if defined(CONFIG_INT128) && \
-    (__has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5)
+#if defined(CONFIG_INT128)
     bool res;
     __uint128_t r;
     __uint128_t f = ((__uint128_t)*phigh << 64) | *plow;
-- 
2.31.1



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

* Re: [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128()
  2022-07-21  7:48 [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128() Thomas Huth
@ 2022-07-24  3:29 ` Richard Henderson
  2022-08-04 11:49 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-07-24  3:29 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: qemu-trivial

On 7/21/22 13:18, Thomas Huth wrote:
> We currently require at least GCC 7.4 or Clang 6.0 for compiling QEMU.
> GCC has __builtin_mul_overflow since version 5 already, and Clang 6.0
> also provides this built-in function (see its documentation on this page:
> https://releases.llvm.org/6.0.0/tools/clang/docs/LanguageExtensions.html ).
> So we can simplify the #if statement here.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128()
  2022-07-21  7:48 [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128() Thomas Huth
  2022-07-24  3:29 ` Richard Henderson
@ 2022-08-04 11:49 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-08-04 11:49 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: qemu-trivial, Richard Henderson

Le 21/07/2022 à 09:48, Thomas Huth a écrit :
> We currently require at least GCC 7.4 or Clang 6.0 for compiling QEMU.
> GCC has __builtin_mul_overflow since version 5 already, and Clang 6.0
> also provides this built-in function (see its documentation on this page:
> https://releases.llvm.org/6.0.0/tools/clang/docs/LanguageExtensions.html ).
> So we can simplify the #if statement here.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   include/qemu/host-utils.h | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
> index 29f3a99878..88d476161c 100644
> --- a/include/qemu/host-utils.h
> +++ b/include/qemu/host-utils.h
> @@ -533,8 +533,7 @@ static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret)
>    */
>   static inline bool mulu128(uint64_t *plow, uint64_t *phigh, uint64_t factor)
>   {
> -#if defined(CONFIG_INT128) && \
> -    (__has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5)
> +#if defined(CONFIG_INT128)
>       bool res;
>       __uint128_t r;
>       __uint128_t f = ((__uint128_t)*phigh << 64) | *plow;

Applied to my trivial-patches branch.

Thanks,
Laurent



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

end of thread, other threads:[~2022-08-04 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21  7:48 [PATCH] include/qemu/host-utils.h: Simplify the compiler check in mulu128() Thomas Huth
2022-07-24  3:29 ` Richard Henderson
2022-08-04 11:49 ` Laurent Vivier

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).