From patchwork Mon Apr 11 01:09:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 52768 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1CC91386C3FF for ; Mon, 11 Apr 2022 01:10:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CC91386C3FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649639427; bh=eCWeUG0pSiGH6HBeQow/uZgjH7/HLyMmi91ntQnA5js=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PR4vJeys6xMJA1jBhhqtc+D5tHlFpC8FWsaf6+UWt2aBiSBerv08hBFuWdhC+0bps 7kVrGw1TeAdEeBGTxT7I8kVTVIthdfPo0/1ZpzG5jlZENMNOX31/ZAWaxzt3ZSNReD wWOzMZ3yNsjRxxEdiUvsX10wmZ8zIzt2lpT4vZ0w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id C255C3858403 for ; Mon, 11 Apr 2022 01:09:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C255C3858403 Received: by mail-il1-x12b.google.com with SMTP id y16so10401440ilc.7 for ; Sun, 10 Apr 2022 18:09:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eCWeUG0pSiGH6HBeQow/uZgjH7/HLyMmi91ntQnA5js=; b=vJmypFYWkm4PEtq7xC5DXSx912Fj/tTJbvAdFmbXuQvDz2SDjxA5lpH/VsJjjWOyFW OG2vV437rZDvswyJCCBcP41Jr9hryJImaV9YKqGWHs/9r3iIFtOpyNsY26IUCI8d+WMm Z1CUM1GCj+RRb2QM9fYE37Py9qoM/3+NMjnFwMQI3tuoAzreOrapWTVlytFR/jNSnadN ARwwOtt0nmtTO2QYUs53mR3v6ldpwWzzWd1J0Ub2aXy/of257COyXQa+8rIZCMUpSeOn 3OikPOdCdAvNzFkPv0r2d7+WIIRqMmH0Pe4JiFYnOKDMFQqUfl3/EsffXs8HrgIXAJHj K5iw== X-Gm-Message-State: AOAM532MiBxYAInNvBCIhveCCQcPMPwkMwRP8plquAPDo74TckqauMga XXoUusZr0wbkQCsF27dNiJT3Vyo8ejw= X-Google-Smtp-Source: ABdhPJxQf0UhVe8eB91GlZUyyeopKtaak1/QUHTO+kieYd+uw/o5Rb3u4scwKnv1PhX5be9dlcCVBQ== X-Received: by 2002:a05:6e02:1a64:b0:2ca:74eb:f3e7 with SMTP id w4-20020a056e021a6400b002ca74ebf3e7mr8341636ilv.232.1649639360919; Sun, 10 Apr 2022 18:09:20 -0700 (PDT) Received: from localhost.localdomain ([173.245.202.36]) by smtp.googlemail.com with ESMTPSA id g14-20020a056602150e00b0064d30c94155sm5291114iow.37.2022.04.10.18.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 18:09:20 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v1 2/2] x86_64: Add {u}int_fast defs ideal for x86_64 Date: Sun, 10 Apr 2022 20:09:13 -0500 Message-Id: <20220411010913.1061799-2-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220411010913.1061799-1-goldstein.w.n@gmail.com> References: <20220411010913.1061799-1-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" {u}int_fast{16|32} should never use 64-bit types. 64-bit instructions often use more code size (REX prefix) and a variety of instructions are slower on many implementations (div, bswap, etc...). Full xcheck passes on x86_64. --- sysdeps/x86_64/int-fast.h | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sysdeps/x86_64/int-fast.h diff --git a/sysdeps/x86_64/int-fast.h b/sysdeps/x86_64/int-fast.h new file mode 100644 index 0000000000..8f341de646 --- /dev/null +++ b/sysdeps/x86_64/int-fast.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _INT_FAST_X86_64_H +#define _INT_FAST_X86_64_H 1 + +#define __HAS_INT_FAST_DEFS 1 + +/* Signed. */ +typedef signed char int_fast8_t; +/* On x86_64 32-bit instructions are almost always fastest. */ +typedef int int_fast16_t; +typedef int int_fast32_t; +typedef long int int_fast64_t; + +/* Unsigned. */ +typedef unsigned char uint_fast8_t; +/* On x86_64 32-bit instructions are almost always fastest. */ +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; +typedef unsigned long int uint_fast64_t; + + +# define __INT_FAST8_BASE INT8 +# define __INT_FAST16_BASE INT32 +# define __INT_FAST32_BASE INT32 +# define __INT_FAST64_BASE INT64 + +# define __UINT_FAST8_BASE UINT8 +# define __UINT_FAST16_BASE UINT32 +# define __UINT_FAST32_BASE UINT32 +# define __UINT_FAST64_BASE UINT64 + +# include + +#endif