Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2971418pxb; Mon, 19 Apr 2021 19:51:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuACHL5afZhaagu9mb3uwVMXb7bxwcMjpMwf6Ma0rIdRbXan2F9KksYMTLS8+6WxEeOR4+ X-Received: by 2002:a17:902:b10d:b029:ec:b5c2:5724 with SMTP id q13-20020a170902b10db02900ecb5c25724mr2116534plr.2.1618887072039; Mon, 19 Apr 2021 19:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618887072; cv=none; d=google.com; s=arc-20160816; b=d3DTBZXmcEglKCHJycTd1VpAEB7mIjZscEf+63DBoOswlLG2qvSb5lFX+4D6Cmg7PD CUQqYhHqikupLoe8q81mZCEVscnx++PdcL6k3+Pd6kfoBSb8s7xXfqoNxx8f9LrU1yZP U8uIKVRPI/5Dowg2vb1Hc/pZpRXeQB5Jjcs9+rL1/omyHem0Z4/u6rv7esyGW8w6OyKG kkMLtVuBADkaFEncDC2u2S1lJsxn0NcUyWwmwVua5TciLrc/M9k/aC+ShTTFTMtzz0ZA 888cXVJxQnNHd76v26eG3sMT+UZtoxbk5hVyIWO8GmDF7cgmL6g+E0Gb2jsEKXAxxFW/ OduQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:subject:cc:to :from:date; bh=Bj1ixs8aXX8/6n7opAoS750lSeNpY3FzTpemaSebLo0=; b=KQn+y5toDneDUNIrimkN3m/xf41TjSOt+5Iv3QM1rLVj1XLzesjUcAJnfOVuqHWqIC vkMneWSIrqY+pst/ZQfCMoNtJMDZq+xmQXFm+/N9dx4AJXh/iuUrkmzMqDpZF9lUH6Wn 75pbzSuSaCgSf3RTProEfLZ8b7eSiBIK7bQhykccWU26aIlpL/tZhW2XIYl4jxc81PJ9 dxDFb4f5H9a4jDi8Q8m+jI2xQn6mtkFtZYmSU8aBOfO5HPjQI4NMlg7v7B4P+xOKtGOu ZRYRmB6XcEg15qW3J+WkBnK4+bWFYLf1KOnIvOllj77Qg5BU+7aKd5x5h/GxZfPF2vSw 48hQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w2si13582192plg.55.2021.04.19.19.50.59; Mon, 19 Apr 2021 19:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbhDTCu4 (ORCPT + 99 others); Mon, 19 Apr 2021 22:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhDTCuz (ORCPT ); Mon, 19 Apr 2021 22:50:55 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38AC0C06174A; Mon, 19 Apr 2021 19:50:24 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 9483392009C; Tue, 20 Apr 2021 04:50:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 8D69C92009B; Tue, 20 Apr 2021 04:50:22 +0200 (CEST) Date: Tue, 20 Apr 2021 04:50:22 +0200 (CEST) From: "Maciej W. Rozycki" To: Arnd Bergmann , Thomas Bogendoerfer cc: Huacai Chen , Huacai Chen , Jiaxun Yang , linux-arch@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] Reinstate and improve MIPS `do_div' implementation Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, As Huacai has recently discovered the MIPS backend for `do_div' has been broken and inadvertently disabled with commit c21004cd5b4c ("MIPS: Rewrite to work with gcc 4.4.0."). As it is code I have originally written myself and Huacai had issues bringing it back to life leading to a request to discard it even I have decided to step in. In the end I have fixed the code and measured its performance to be ~100% better on average than our generic code. I have decided it would be worth having the test module I have prepared for correctness evaluation as well as benchmarking, so I have included it with the series, also so that I can refer to the results easily. In the end I have included four patches on this occasion: 1/4 is the test module, 2/4 is an inline documentation fix/clarification for the `do_div' wrapper, 3/4 enables the MIPS `__div64_32' backend and 4/4 adds a small performance improvement to it. I have investigated a fifth change as a potential improvement where I replaced the call to `do_div64_32' with a DIVU instruction for cases where the high part of the intermediate divident is zero, but it has turned out to regress performance a little, so I have discarded it. Also a follow-up change might be worth having to reduce the code size and place `__div64_32' out of line for CC_OPTIMIZE_FOR_SIZE configurations, but I have not fully prepared such a change at this time. I did use the WIP form I have for performance evaluation however; see the figures quoted with 4/4. These changes have been verified with a DECstation system with an R3400 MIPS I processor @40MHz and a MTI Malta system with a 5Kc MIPS64 processor @160MHz. See individual change descriptions and any additional discussions for further details. Questions, comments or concerns? Otherwise please apply. Maciej