Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B51BAC6FD1F for ; Wed, 15 Mar 2023 00:58:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A52DE85E34; Wed, 15 Mar 2023 01:58:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=timesys-com.20210112.gappssmtp.com header.i=@timesys-com.20210112.gappssmtp.com header.b="6TI9ljfW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5511685E3A; Wed, 15 Mar 2023 01:58:25 +0100 (CET) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2002E85DB9 for ; Wed, 15 Mar 2023 01:58:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angelo.dureghello@timesys.com Received: by mail-wr1-x436.google.com with SMTP id l12so7645903wrm.10 for ; Tue, 14 Mar 2023 17:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timesys-com.20210112.gappssmtp.com; s=20210112; t=1678841901; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tJpmSLSUPqpZGNEZuW7Gp8eemVEHhtHtS60fLHAojnM=; b=6TI9ljfWpDIWAS2BfXRxDDx8aEC0SWu9eCLnV1jhL/1uGrtF/raPqy0hCtFaLq9k1v 0e41P+SJMEEDtpyfcKzVf25B89xc/C6PkDN00muiCq8N/X4MC9espqjNrPY+8c/vO0eg 68ZBGfdtUZxBuB3FvWpgnLDZk4Zi7QcFpCCf2wR/Gk0WXwepQ70WutQQGaJWeRC0ijqk LnjMQ74akouDaJmLiZZCefxW+ijNKg/3CteLMrvrFesLDtyFqIABrFrx4WtJTHIY3Q/+ b8+6uPAsXaJBySe9V3ji9TgxpZKZsJ3t6gT7rgsO9xFLd/RbSmNJ4lPhq0t66XTdKxsI PJ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678841901; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tJpmSLSUPqpZGNEZuW7Gp8eemVEHhtHtS60fLHAojnM=; b=PX3gdXsAy2C0p6l9h8sqAG0FseGK92X8EVXxEua0kB/ySGGgVrBf/kwodnkL7jTPrh KjeTLeE22GgEguPNKhXUIvLMNZexjummjU8CpqO8W38aDlHQ5bhcGQyZqGZSmLjv8X7M OH9QeKD+pQczkrk4Ytfe+U9cDxY9gH2OGu3ahUvMeWLfiQ8E0jRXCmT5OVkzhgCwve+d gqBLFqu8j07qLkZ7PvnWo+rw2UevVSXqGMnOXMOxtfZ6HrwTKauDUuOI7/OYysj0Sgk2 kprL39IGHUZ4BxMFTzx5ASVJpodbK9aVU/4Z/RFhvimk86/c9X5kxt0BkWGQysrGKjAV uacQ== X-Gm-Message-State: AO0yUKUX0vQrQwCgq4RGT3XsZ6axEFWCW7RlVYLzfOzxiLbeGk4fPrrg sXgXXuitaItQjN/9Z4/8iTBQGQ== X-Google-Smtp-Source: AK7set8ElZKdPR4azPK4pnjGf2KDlWh+/gabHPzc+kpEydWXJ7O3O5Kle4B9geAhxEJx6R7hek8vTQ== X-Received: by 2002:a5d:49cc:0:b0:2c7:57e:633e with SMTP id t12-20020a5d49cc000000b002c7057e633emr631389wrs.49.1678841901513; Tue, 14 Mar 2023 17:58:21 -0700 (PDT) Received: from localhost.localdomain (host-87-8-238-217.retail.telecomitalia.it. [87.8.238.217]) by smtp.gmail.com with ESMTPSA id w7-20020adfd4c7000000b002c557f82e27sm3315966wrk.99.2023.03.14.17.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 17:58:21 -0700 (PDT) From: Angelo Dureghello To: trini@konsulko.com Cc: u-boot@lists.denx.de, Angelo Dureghello Subject: [PATCH] m68k: add private libgcc ashrdi3 Date: Wed, 15 Mar 2023 01:58:04 +0100 Message-Id: <20230315005804.2022700-1-angelo.dureghello@timesys.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Angelo Dureghello Add ashrdi3.c to private libgcc. Signed-off-by: Angelo Dureghello --- arch/m68k/lib/Makefile | 2 +- arch/m68k/lib/ashrdi3.c | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 arch/m68k/lib/ashrdi3.c diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index b66d66afd2..6e1fd938f5 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -5,7 +5,7 @@ ## Build a couple of necessary functions into a private libgcc ## if the user asked for it -lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o obj-y += bdinfo.o obj-$(CONFIG_CMD_BOOTM) += bootm.o diff --git a/arch/m68k/lib/ashrdi3.c b/arch/m68k/lib/ashrdi3.c new file mode 100644 index 0000000000..e144378b7f --- /dev/null +++ b/arch/m68k/lib/ashrdi3.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: + * Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + */ + +#define BITS_PER_UNIT 8 + +typedef int SItype __attribute__((mode(SI))); +typedef unsigned int USItype __attribute__((mode(SI))); +typedef int DItype __attribute__((mode(DI))); +typedef int word_type __attribute__((mode(__word__))); + +struct DIstruct { + SItype high, low; +}; + +typedef union { + struct DIstruct s; + DItype ll; +} di_union; + +DItype __ashrdi3(DItype u, word_type b) +{ + di_union w; + word_type bm; + di_union uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof(SItype) * BITS_PER_UNIT) - b; + if (bm <= 0) { + /* w.s.high = 1..1 or 0..0 */ + w.s.high = uu.s.high >> (sizeof(SItype) * BITS_PER_UNIT - 1); + w.s.low = uu.s.high >> -bm; + } else { + USItype carries = (USItype)uu.s.high << bm; + + w.s.high = uu.s.high >> b; + w.s.low = ((USItype)uu.s.low >> b) | carries; + } + + return w.ll; +} + -- 2.39.1