From patchwork Wed Jan 16 20:23:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 155763 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1102819jaa; Wed, 16 Jan 2019 12:28:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN5GiRaSFHZZjug0HBuPa12OmEX9fbjm+6Sce/Yna4sv3pdMLr2HZwkqFAktM46kfP8kgu+h X-Received: by 2002:a1c:e3d7:: with SMTP id a206mr8472344wmh.12.1547670521415; Wed, 16 Jan 2019 12:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547670521; cv=none; d=google.com; s=arc-20160816; b=BCmL/jJqrFRoFtk2+Tc8XSTiKUH1oZoHGoasvudRzRKaG2J7uGT7XiQwFyOjDhnem+ 8nHBfLObIpNKe9YWdZ9Zy3/ZUAXJz2h96vMM18LDy6Aj5fHz07RCaoBGTf1P9/apW0Mg pkap/uZU4QJmhq4mdvViqTk2OEx0uZygZAW2w36Dft5akEunO1v2jzA/ZopL8x9g6AQk GKQ2yvLsGCNGhXnMQoXU4t5APhBlJEBZgV41P+SOtZmrP5degpiaqBCal0skbMmSTpK/ MLFZO8Y+H/bwX4cGAioG8fW+Prl86ig3Une4svqmkaNY6bDFoRgMu0Mdw5IZp6HplSY4 XhzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=CH+fbm3rQwsIpBYqFgXaDA7siyiApJFCyWBJwHgGYWA=; b=JyJba/QriDwzBYPlz2tum/VXjcJGSRjgdRSo1hDu7mJdhDp3OxjrCDEwDt/SWu1Vsu W9WUM4IPLZ/zb82JoWBHk/Js/3jpZWjjbRA8oAf0D880pF4TEbk4yxqJZIfmN5cePoYE S7DmBYRcv5twNGn9wfB/MjNYElo/c9FBIImqP6LssaDNegvb4uu2FXO1xmwsHxxLdoJL 3+/P3PjT/cOPeshuIjitN08drmx4I1JJ/yzfmQCm6KOjNCmPz3BbCTeRveeBdfNxekn4 NJMpJrzS/YmO6OXxSZcKAR46xRYRwTLPBYquyGQiIGSzMy30lQxrKHY2/DiAFO/MWyhy 9doA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aWZqCPxr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y14si53825276wrn.359.2019.01.16.12.28.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 Jan 2019 12:28:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aWZqCPxr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:45965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjrnk-0001EB-Bg for patch@linaro.org; Wed, 16 Jan 2019 15:28:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjrj9-0006uu-Pj for qemu-devel@nongnu.org; Wed, 16 Jan 2019 15:23:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjrj8-00065w-LM for qemu-devel@nongnu.org; Wed, 16 Jan 2019 15:23:55 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:33777) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjrj8-00061a-DK for qemu-devel@nongnu.org; Wed, 16 Jan 2019 15:23:54 -0500 Received: by mail-wm1-x342.google.com with SMTP id r24so1922813wmh.0 for ; Wed, 16 Jan 2019 12:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CH+fbm3rQwsIpBYqFgXaDA7siyiApJFCyWBJwHgGYWA=; b=aWZqCPxrEMnlEm+/gFQQFPkRlEiv9EH8+dwji35zK7tPZrybY90DEj0F7DyVrLaLcX Hk+eFvrvQvqKRI19puzXfRsOoea8WfE/hRelUpUFlkB3kMsHzIMA2iQCYP+H7LrNBiN8 DNWFNw7iV3ApNmmZp0vC4gk7TFG7K8fxRyoXw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CH+fbm3rQwsIpBYqFgXaDA7siyiApJFCyWBJwHgGYWA=; b=gkxp9OOjtkCeRytH/6aL53R1s9KKgsqjib1kucyCIjPtmcR4w6mO7a467g1IAh7nWj 5th/N9lwxYkLUJO2ffNwoAIRxGAfldTCSP7Ah46ryR8lZOZr+3XouI0gwTOASbqFaIDH CCMjfqM7uV56DnVZAN/ToFKDcg50jNyXf5STtgejgn/RruD98/H78iZl/eWtuUVGyY2r wlwQ9KZgOdQVZjKRjjGkFwQVnUCemNz5KDNALuhgHMumxfuh2Wgg6gjgSbK1295YtZUj bl7s7aZNnVIHLhX0H8UpsB47e8pbDXI81ardtOXo8U6/LhYx+FfwF02F2hZQicr4DXvY JCYg== X-Gm-Message-State: AJcUukfOY14sFPn4M0lWjpbOEzvqqaXLWM5APx+b1AXbuS3sBsWam7Up 6GK+CSpHG/UxXJRzD5PC/jgjUQ== X-Received: by 2002:a1c:7616:: with SMTP id r22mr8944104wmc.35.1547670233242; Wed, 16 Jan 2019 12:23:53 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g188sm40872946wmf.32.2019.01.16.12.23.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 12:23:50 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B8D2B3E0FBD; Wed, 16 Jan 2019 20:23:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2019 20:23:46 +0000 Message-Id: <20190116202349.29272-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190116202349.29272-1-alex.bennee@linaro.org> References: <20190116202349.29272-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 4/7] softfloat: fallback to __int128 maths for s390x and others 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: Peter Maydell , Thomas Huth , cohuck@redhat.com, "open list:S390" , =?utf-8?q?Alex_Benn=C3=A9e?= , Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Apparently some versions of clang can't handle inline assembly with __int128 parameters, especially on s390. Instead of hand-coding the s390 divide provide a generic fallback for anything that provides __int128 capable maths. Signed-off-by: Alex Bennée Cc: Thomas Huth --- include/fpu/softfloat-macros.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h index b1d772e6d4..1a43609eef 100644 --- a/include/fpu/softfloat-macros.h +++ b/include/fpu/softfloat-macros.h @@ -641,12 +641,6 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t n1, uint64_t q; asm("divq %4" : "=a"(q), "=d"(*r) : "0"(n0), "1"(n1), "rm"(d)); return q; -#elif defined(__s390x__) - /* Need to use a TImode type to get an even register pair for DLGR. */ - unsigned __int128 n = (unsigned __int128)n1 << 64 | n0; - asm("dlgr %0, %1" : "+r"(n) : "r"(d)); - *r = n >> 64; - return n; #elif defined(_ARCH_PPC64) && defined(_ARCH_PWR7) /* From Power ISA 2.06, programming note for divdeu. */ uint64_t q1, q2, Q, r1, r2, R; @@ -663,6 +657,10 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t n1, } *r = R; return Q; +#elif defined(CONFIG_INT128) + unsigned __int128 n = (unsigned __int128)n1 << 64 | n0; + *r = n % d; + return n / d; #else uint64_t d0, d1, q0, q1, r1, r0, m;