Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1134256pxb; Sat, 17 Apr 2021 07:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPzH0XreqmMwKmg7Iv7funx3fPfhg3NUWkNTKLXYgJKKhMj/V1x44QfKwvPDapDAUwL3mK X-Received: by 2002:a17:902:b601:b029:eb:1207:86ec with SMTP id b1-20020a170902b601b02900eb120786ecmr14307676pls.3.1618670303375; Sat, 17 Apr 2021 07:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618670303; cv=none; d=google.com; s=arc-20160816; b=slgMfFaIMwnk0sf1BDrj+RwT74GMlUk+oPfBSwdDktlysKt2B+o5iGz3Dv0VvzE5Fd RAuWN3EL94ngackkp2mm86kT8mchYxijZhkArBX5pACwm2PE5FmJ0VAPfrOg1uzZMT2A hFy4aVnjLhncV8FyT2PDIXGId/455rJ0MSaJ6TmrBENTbYL7b8kOxtkFTy8LCcrArulC +UUeh0y+NjcT37Mqk2MCllZLzteM6zA2mg0llznAJ5LGPOBoU7Q8ie5PzCzUXfrN940D 4PSeIQe7mk39w7q80hfOLKQM74uVg+zACBYMaf9ImWM57w11qfV3CrNLLiyhbI57P2ig Zldg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=7CrO+KFrhcrqPLqem/ueyQxhRWVAvpBgxg7fFmVCttY=; b=sgKNVnfDViaFxf7BDAMKZs7sZ6oZY78QBP8Y+sGODA3FUe0Kbo4oI7JVAYdqFb0cD8 QUj6rH38tG1hNLqOcnWGdU0IP2nnM2T72zpj7bVQhWaEcha6ZHdNOx0rqIsQSV9qA1xw BTL3DehA99wDsRxnh0yX7eGquIddBG9et+yNHjitoPInKN8p3fzi4cTZ3YeTUM2+ca2y oet6CL6cAWk51jQIS/ymJQ4IrzjTzb0ee2fnIv2f3jJZfUzshUq8S5dGN9RUfcmnjsbd lFa2vuBRpZl843WXycbYhn8M0BWzUwqGe3yabPuyBmnczK5JNq4NkddZov5cwjiI3IiW T0Ng== 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 m4si10370644pgs.500.2021.04.17.07.38.11; Sat, 17 Apr 2021 07:38:23 -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 S236577AbhDQOg4 (ORCPT + 99 others); Sat, 17 Apr 2021 10:36:56 -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