From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id CF2473840C0C for ; Wed, 15 Jul 2020 14:56:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF2473840C0C Received: by mail-il1-x135.google.com with SMTP id e18so2213778ilr.7 for ; Wed, 15 Jul 2020 07:56:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=awJLY9Kkb7LpqLNmGMFWsDrx7Sm6W81R0ESrxEML2dc=; b=J5i5KX69xr3Ow6rIqyrISE9vMJcWI3i3hfFqRvF84zz35Gu2xCnPenBbbAdNa5BP5b t3+XAYs4svpL6HcRwdQ2OoQ/waOCW9zdpGF5PNsWreJQ5i+RiPmTIxtuWHwt3MS94vjd GRx5AwUltCSud6Cq7qk1MzJ8R71L5RTSjmU99g8wZl57M6/ur2xKZQAXcKDOblwWDG8D CT9OZbfNYrBvsWBqd84wOphS37BqsIXyJVxggne6KG6x4d8TU8rFC8PgJ0OcMTAzxdDW Ka1FeovHhJW01U5sLnwzM+yzxvlKIaaDcWvvBkOnF9w2tDXml5D2zSKHp6kQ7wrfDXdz mSnA== X-Gm-Message-State: AOAM533Tx7UlLTi1EM+dGmEPVGGlujmtBFa3+ZRja5v1+TtzmTFPYtkx EcXhyjrLGFcIQMm6D/HNgBMjcsDmsYiy20opzWvjyKHc X-Google-Smtp-Source: ABdhPJwA2b8Zn4AkB4v4oPPha4hzXEQuGovvI8r9dXLUny2O0ZFg15EX9L3Dc72TaCAaV/zVoFGm+ZIDCEyPqeh2duU= X-Received: by 2002:a92:bf0c:: with SMTP id z12mr9836366ilh.151.1594824993153; Wed, 15 Jul 2020 07:56:33 -0700 (PDT) MIME-Version: 1.0 References: <20200630043529.739181-1-hjl.tools@gmail.com> <20200630043529.739181-3-hjl.tools@gmail.com> In-Reply-To: <20200630043529.739181-3-hjl.tools@gmail.com> From: "H.J. Lu" Date: Wed, 15 Jul 2020 07:55:57 -0700 Message-ID: Subject: PING: V7: [PATCH 2/2] x86: Install [BZ #26124] To: GNU C Library Cc: Florian Weimer Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Wed, 15 Jul 2020 14:56:35 -0000 On Mon, Jun 29, 2020 at 9:35 PM H.J. Lu wrote: > > Install so that programmers can do > > #if __has_include() > #include > #endif > ... > > if (CPU_FEATURE_USABLE (SSE2)) > ... > if (CPU_FEATURE_USABLE (AVX2)) > ... > > exports only: > > enum > { > COMMON_CPUID_INDEX_1 = 0, > COMMON_CPUID_INDEX_7, > COMMON_CPUID_INDEX_80000001, > COMMON_CPUID_INDEX_D_ECX_1, > COMMON_CPUID_INDEX_80000007, > COMMON_CPUID_INDEX_80000008, > COMMON_CPUID_INDEX_7_ECX_1, > /* Keep the following line at the end. */ > COMMON_CPUID_INDEX_MAX > }; > > struct cpuid_features > { > struct cpuid_registers cpuid; > struct cpuid_registers usable; > }; > > struct cpu_features > { > struct cpu_features_basic basic; > struct cpuid_features features[COMMON_CPUID_INDEX_MAX]; > }; > > /* Get a pointer to the CPU features structure. */ > extern const struct cpu_features *__x86_get_cpu_features > (unsigned int max) __attribute__ ((const)); > > Since all feature checks are done through macros, programs compiled with > a newer are compatible with the older glibc binaries > as long as the layout of struct cpu_features is identical. The features > array can be expanded with backward binary compatibility for both .o and > .so files. When COMMON_CPUID_INDEX_MAX is increased to support new > processor features, __x86_get_cpu_features in the older glibc binaries > returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return falses on the > new processor feature. No new symbol version is neeeded. > > Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided. HAS_CPU_FEATURE > can be used to identify processor features. > > Note: Although GCC has __builtin_cpu_supports, it only supports a subset > of and it is equivalent to CPU_FEATURE_USABLE. It > doesn't support HAS_CPU_FEATURE. https://sourceware.org/pipermail/libc-alpha/2020-June/115546.html -- H.J.