From patchwork Fri Oct 5 18:02:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 148284 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp757250lji; Fri, 5 Oct 2018 11:06:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV62tzQdKpf2pcSpkSbOR0O8p+zwD+G/Hv8EHlwAQ2cL/gipjY4xG4StIwQilE5fUN2oQqu5S X-Received: by 2002:ac8:26b9:: with SMTP id 54-v6mr10306423qto.281.1538762779013; Fri, 05 Oct 2018 11:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538762779; cv=none; d=google.com; s=arc-20160816; b=ucqaxLfbQKNtTKZgWZEjshtqQwFoDy1kJYaWuhXm7874PGnUphspAVB12pJnVlNQ5D VMMUpPMohcwHDaDHTZQX8STNEvI9kqBsMM0920Ww2t5dctb2LgEPn3KpWbSkhkTxPGQv GnH1Ex7ccMrXs5JMTKTNffGu3XpfSjdZFocXj+Af7Axd8C/2FVVUUT0GNiG8tahGKKmd Yfy7rugjAdmeaX9pyVr/vGr4gBQ8SaI1tMl1bMNDBjkizsvRXxFcOO6jOBfeBEW3+1kY QjlpER43ZlPypUU5OtDEBHDfzBWcKppEwkVrVFEb6dfQZyKSfQEtjAbT3ZAlRDyMwJ8I nbVA== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=X5a/KvnsV8gRrymCZvMRPaAHMUoAfW8yBsI+pfK7k9k=; b=K/evaSlGp2VW8HOJ2Vh0shSZILPiSbfaoP2x4x0rngj6+B1bwj4dPOgOroKQNH5KSW JRNF6sqa9+Gbp2i9HOli5+5gZQ1hmbySwk8neecxcVnayo6LGUDLEGJsovm4yA01RMmn MokMboIqie3b3tOCeaB6CqkzN4IZ8FkAbO+l5T0NaGmTWfWC9bSo6VdtuhKzXZX2dRrp WOMdbQlpuSPYkqvz/4l5x5Sytc6cKgnR9cQJy4fvTHU9WpV56Vp1K3PvSWJW0+G4ff+M tZtto5BXuUwibsWlNdVYtja8dST4SQRTS/f4jRs4pgnQyw/eE4I585tfPw2+j+ZPV1oZ 4bsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YmuEMIvY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p11-v6si487228qtj.126.2018.10.05.11.06.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 05 Oct 2018 11:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YmuEMIvY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:36401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8UUU-00041g-Ck for patch@linaro.org; Fri, 05 Oct 2018 14:06:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8UQi-0000X5-EQ for qemu-devel@nongnu.org; Fri, 05 Oct 2018 14:02:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8UQf-0005CO-IV for qemu-devel@nongnu.org; Fri, 05 Oct 2018 14:02:23 -0400 Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]:42235) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8UQf-00056l-A8 for qemu-devel@nongnu.org; Fri, 05 Oct 2018 14:02:21 -0400 Received: by mail-oi1-x242.google.com with SMTP id w81-v6so11083772oiw.9 for ; Fri, 05 Oct 2018 11:02:21 -0700 (PDT) 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; bh=X5a/KvnsV8gRrymCZvMRPaAHMUoAfW8yBsI+pfK7k9k=; b=YmuEMIvYTvMvnWt9Ua7aDBJFkf98tZ1NzUCx8Lu9n3JMWF/W1SklrcfS+LDdV3WfHN PgUI+pV4HFwspIFmvnBsd2YZxoF5yzLUjZYAZdHHeOP3QA3aZrbopFD0uBPeHFITZH+G VIWOnTACVxjtAcbc1PpTTmDt4ByW0I33Bmphw= 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; bh=X5a/KvnsV8gRrymCZvMRPaAHMUoAfW8yBsI+pfK7k9k=; b=r5YuunqKoN52bnF9RttAel5bPQoCGn2DDhVswad6Nb+sU7Wnu7OWqDaPlDAwVCX7pU /VMGEIcM2hAyKjUAX1yDC6ls04ePQxNfP4cJOhekr2zqc4wUb++G0YIVX2ntW4fhudlS n0U3Fv+fjWEK3rNV+motJm4KhpiREja9JKeTlQ60BOkEob2ThAuHV0TSaCUoY8c+qnF6 U4fDH/r9rhJaE74NGua2SZ8yrv/g+UQ3KlIDNl5dsOUmuxsNCgoW+mi4Zt/2N6NJrOlV VcUSGbbqzR9XqRJ0U8BPhmC+lgdqfRsCSAM1QaOyPEqHzWxdPx3g9JK3pvqggImvt3Hr dvMw== X-Gm-Message-State: ABuFfoiMM+k67M0Atzc7/ntmLMrGdCauAajb7Y9rWB6jUVxN7bjYEIre VJb/1PEat/FZf4HTpfuQXjR4FcYM9p2y6ouqBkc= X-Received: by 2002:aca:4c4f:: with SMTP id z76-v6mr39371oia.164.1538762540181; Fri, 05 Oct 2018 11:02:20 -0700 (PDT) Received: from cloudburst.twiddle.net ([187.217.230.84]) by smtp.gmail.com with ESMTPSA id d37-v6sm2601302otb.0.2018.10.05.11.02.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 11:02:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2018 13:02:01 -0500 Message-Id: <20181005180201.11387-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005180201.11387-1-richard.henderson@linaro.org> References: <20181005180201.11387-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::242 Subject: [Qemu-devel] [PULL 8/8] softfloat: Specialize udiv_qrnnd for ppc64 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@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The ISA has a 128/64-bit division instruction, though it assumes the low 64-bits of the numerator are 0, and so requires a bit more fixup than a full 128-bit division insn. Reviewed-by: David Gibson Signed-off-by: Richard Henderson --- include/fpu/softfloat-macros.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.17.1 diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h index eafc68932b..c86687fa5e 100644 --- a/include/fpu/softfloat-macros.h +++ b/include/fpu/softfloat-macros.h @@ -647,6 +647,22 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t n1, asm("dlgr %0, %1" : "+r"(n) : "r"(d)); *r = n >> 64; return n; +#elif defined(_ARCH_PPC64) + /* From Power ISA 3.0B, programming note for divdeu. */ + uint64_t q1, q2, Q, r1, r2, R; + asm("divdeu %0,%2,%4; divdu %1,%3,%4" + : "=&r"(q1), "=r"(q2) + : "r"(n1), "r"(n0), "r"(d)); + r1 = -(q1 * d); /* low part of (n1<<64) - (q1 * d) */ + r2 = n0 - (q2 * d); + Q = q1 + q2; + R = r1 + r2; + if (R >= d || R < r2) { /* overflow implies R > d */ + Q += 1; + R -= d; + } + *r = R; + return Q; #else uint64_t d0, d1, q0, q1, r1, r0, m;