From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BED3C43462 for ; Sat, 17 Apr 2021 14:36:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9C7E6100B for ; Sat, 17 Apr 2021 14:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236586AbhDQOg5 (ORCPT ); Sat, 17 Apr 2021 10:36:57 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:51833 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236517AbhDQOg4 (ORCPT ); Sat, 17 Apr 2021 10:36:56 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 13HEaKSO015819; Sat, 17 Apr 2021 16:36:20 +0200 Date: Sat, 17 Apr 2021 16:36:20 +0200 From: Willy Tarreau To: Peter Zijlstra Cc: Matthew Wilcox , Miguel Ojeda , Wedson Almeida Filho , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, Linux Kbuild mailing list , Linux Doc Mailing List , linux-kernel Subject: Re: [PATCH 00/13] [RFC] Rust support Message-ID: <20210417143620.GB15678@1wt.eu> References: <20210416161444.GA10484@1wt.eu> <20210416180829.GO2531743@casper.infradead.org> <20210417114623.GA15120@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 17, 2021 at 04:24:43PM +0200, Peter Zijlstra wrote: > On Sat, Apr 17, 2021 at 01:46:23PM +0200, Willy Tarreau wrote: > > For me the old trick of casting one side as long long still works: > > > > unsigned long long mul3264(unsigned int a, unsigned int b) > > { > > return (unsigned long long)a * b; > > } > > > > i386: > > 00000000 : > > 0: 8b 44 24 08 mov 0x8(%esp),%eax > > 4: f7 64 24 04 mull 0x4(%esp) > > 8: c3 ret > > > > x86_64: > > 0000000000000000 : > > 0: 89 f8 mov %edi,%eax > > 2: 89 f7 mov %esi,%edi > > 4: 48 0f af c7 imul %rdi,%rax > > 8: c3 retq > > > > Or maybe you had something else in mind ? > > Last time I tried it, the thing refused :/ which is how we ended up with > mul_u32_u32() in asm. Oh I trust you, I do remember having noticed it on one gcc version as well (maybe 4.5). But I've been successfully using this since 2.95, and could quickly recheck that 4.7, 4.8, 5.4, 6.5, 7.4, 9.3 and 11-trunk do produce the code above, which is reassuring, as we all prefer to limit the amount of asm statements. Willy