From patchwork Fri Sep 9 13:01:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leon Alrae X-Patchwork-Id: 9323317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0770460752 for ; Fri, 9 Sep 2016 13:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE02A29E89 for ; Fri, 9 Sep 2016 13:01:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E273529E8C; Fri, 9 Sep 2016 13:01:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 08AB029E89 for ; Fri, 9 Sep 2016 13:01:56 +0000 (UTC) Received: from localhost ([::1]:57849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biLRL-0001Cc-Fa for patchwork-qemu-devel@patchwork.kernel.org; Fri, 09 Sep 2016 09:01:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biLQw-0001Au-67 for qemu-devel@nongnu.org; Fri, 09 Sep 2016 09:01:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biLQt-0004fo-4f for qemu-devel@nongnu.org; Fri, 09 Sep 2016 09:01:30 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:43891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biLQs-0004fT-VP for qemu-devel@nongnu.org; Fri, 09 Sep 2016 09:01:27 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id C0FBA2F528575; Fri, 9 Sep 2016 14:01:11 +0100 (IST) Received: from hhmipssw201.hh.imgtec.org (10.100.21.117) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 9 Sep 2016 14:01:14 +0100 Date: Fri, 9 Sep 2016 14:01:10 +0100 From: Leon Alrae To: Richard Henderson Message-ID: <20160909130110.GA24307@hhmipssw201.hh.imgtec.org> References: <1472935202-3342-1-git-send-email-rth@twiddle.net> <1472935202-3342-6-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1472935202-3342-6-git-send-email-rth@twiddle.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.100.21.117] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Subject: Re: [Qemu-devel] [PATCH v3 05/34] int128: Add int128_make128 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Sep 03, 2016 at 09:39:33PM +0100, Richard Henderson wrote: > Allows Int128 to be used more generally, rather than having to > begin with 64-bit inputs and accumulate. > > Signed-off-by: Richard Henderson > --- > include/qemu/int128.h | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/include/qemu/int128.h b/include/qemu/int128.h > index 08f1db1..67440fa 100644 > --- a/include/qemu/int128.h > +++ b/include/qemu/int128.h > @@ -10,6 +10,11 @@ static inline Int128 int128_make64(uint64_t a) > return a; > } > > +static inline Int128 int128_make128(uint64_t lo, uint64_t hi) > +{ > + return (unsigned __int128)hi << 64 | lo; > +} > + This causes build failures for me on CentOS6.5: /user/lea/dev/qemu/include/qemu/int128.h:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Int128’ /user/lea/dev/qemu/include/qemu/int128.h:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int128_make64’ /user/lea/dev/qemu/include/qemu/int128.h:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int128_make128’ (...) This is because CONFIG_INT128 is set if test for __int128_t succeeds, not __int128. The following change on top of patches 4 and 5 in this series fixes the problem for me: diff --git a/include/qemu/int128.h b/include/qemu/int128.h index 261b55f..5c9890d 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -4,7 +4,7 @@ #ifdef CONFIG_INT128 #include "qemu/bswap.h" -typedef __int128 Int128; +typedef __int128_t Int128; static inline Int128 int128_make64(uint64_t a) { @@ -13,7 +13,7 @@ static inline Int128 int128_make64(uint64_t a) static inline Int128 int128_make128(uint64_t lo, uint64_t hi) { - return (unsigned __int128)hi << 64 | lo; + return (__uint128_t)hi << 64 | lo; }