From patchwork Wed Jun 12 02:30:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1946609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=elkUkB4f; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VzTzh5Hgtz20Pb for ; Wed, 12 Jun 2024 12:30:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E47F5385C6C2 for ; Wed, 12 Jun 2024 02:30:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id 52E563858D34 for ; Wed, 12 Jun 2024 02:30:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52E563858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52E563858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718159426; cv=none; b=CAgmAxiqwro+McI8PotV4FdQDgkcEIVzTg0pQq2aQxHz2KPtMkuKqdBdCriKg/V3DCrYcFqAGpHKwpmBpJubgauDZcYTra/sXK9VnANCE+/QSKoFgUsDSA0W8Gu2FaC6BJgTrlZ1khsm6sDuwsXIlIeTTTASgBLKceBi6OWxO78= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718159426; c=relaxed/simple; bh=HDVh7UP/vldMTSZw/Q7TH9kfglS/WphXYsBc5rHomIo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lsqMAKK2xikN7nRwU0JY+x1DVjWrUcR0fksGHo3BO9P0fSTCKFpVI/fy1LjSvb4MoGBFv0zUBUAHMwoe+TxAQY2L7VJ4vvmNhp7gcvJyFDwCgzG2cPVRzGUhJaGcvWi7JHEbznA9Oi0hBg9HOgt+8CwEJdB+PtBvmi8JAJ7TYlc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7eb12b2bf78so273650439f.0 for ; Tue, 11 Jun 2024 19:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718159421; x=1718764221; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7lHgt8DpGSiHYwuyglZ7Y+e+K0xdsXGqdY1Z0VBNN7g=; b=elkUkB4fM2O8oTcAtyGX6QzUnerjRpBbOiFI6RDyDIvozOQEJEmv/3bnoI9Enjf2+D F+eXyEv66U9Ah9pefKGAXBzLSXy8xRuC5eJvCvVRj5ODJ95LzzRvk3XRmG2ywAp6pThq xj0YKo/HxbsdP7xtEtvCb6NQhrleCYQ493eYI5ckigfQgwECHoVDfqBLyc+TEZJJJZ4x 3DaMrRSQZen6zWyUiglWGjzc8Gavc9XdM+3zSyMyTbHChaDOg6/ADZNm/qYA6yb281HW kuiWzqwal013DAOzN621NZMospVzzYiYudOBeAAUPmGLxFewrT1SZ28uKO8Ni+dm+/6m YLxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718159421; x=1718764221; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7lHgt8DpGSiHYwuyglZ7Y+e+K0xdsXGqdY1Z0VBNN7g=; b=C5en6pSGE+naJVWELxWPUYmiJuciDFS1fU7J/A1OqQI5jzBC6rGWQrVNeXvzo8/enp fIZq0vq5zbUp8WuPAocP36inY2a8R6Y2N++Zs1IvKUJ+hvXIuIw6irN1hxOJYxEitnFa I84ueLcxIFGeYoKt+eirp7ZvCO2Z00uW757uFZ1BOvdnxsLtDMzT5cdU4lyfg6HzeX4Q HKIW/YqmO4ZNYIqFladQ9pGxa5VN1S1b6h9NZFe0fvq11thkUoMsv2RwFtFLQniy/Eg5 kLhaGlmeIN3KBSe8QQ0QDR+Gjm3a8e3iJgMhDnJjUFWJvY9pjVmwDEDCWovXzcDjXtlY NaLg== X-Gm-Message-State: AOJu0Yyc4mL24/hcEQY9O/pgcFA0UI6nqjKA+6b6KgbV1l6Bl8hdoDrn GXulDhEcgkPGkwoOLCKrX/tl5Vwqou0nuhoIaN2PJ9ZRgq9oVVXX X-Google-Smtp-Source: AGHT+IFssbV7mDa0h2oXgC5HLVU60D9bPv2KbhQsx52gEtiGm/l9e4iRNikCIUm30Cy8LdKbI9LI0w== X-Received: by 2002:a05:6602:2dc8:b0:7eb:7c8d:dee1 with SMTP id ca18e2360f4ac-7ebcd0d8d52mr79361739f.11.1718159419373; Tue, 11 Jun 2024 19:30:19 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.139.23]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4b908ebb0e8sm1957629173.111.2024.06.11.19.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 19:30:19 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 82B1BC0210; Tue, 11 Jun 2024 19:30:14 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: immoloism@gmail.com, sam@gentoo.org, fweimer@redhat.com Subject: [PATCH] x86: Properly set x86 minimum ISA level [BZ #31883] Date: Tue, 11 Jun 2024 19:30:14 -0700 Message-ID: <20240612023014.3003329-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-3021.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Properly set libc_cv_have_x86_isa_level in shell for MINIMUM_X86_ISA_LEVEL defined as (__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4) Also set __X86_ISA_V2 to 1 for i386 if __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 is defined. There are no changes in config.h nor in config.make on x86-64. On i386, -march=x86-64-v2 with GCC generates #define MINIMUM_X86_ISA_LEVEL 2 in config.h and have-x86-isa-level = 2 in config.make. This fixes BZ #31883. Signed-off-by: H.J. Lu --- sysdeps/x86/configure | 4 +++- sysdeps/x86/configure.ac | 4 +++- sysdeps/x86/isa-level.h | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure index 1e2325d0d7..04c6ba3e6c 100644 --- a/sysdeps/x86/configure +++ b/sysdeps/x86/configure @@ -141,8 +141,10 @@ libc_cv_have_x86_isa_level=3 libc_cv_have_x86_isa_level=2 #elif defined __x86_64__ libc_cv_have_x86_isa_level=baseline +#elif MINIMUM_X86_ISA_LEVEL == 1 +libc_cv_have_x86_isa_level=1 #else -libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL +libc_cv_have_x86_isa_level=0 #endif EOF eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level` diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac index 0b32fdfd4f..8a259d3971 100644 --- a/sysdeps/x86/configure.ac +++ b/sysdeps/x86/configure.ac @@ -98,8 +98,10 @@ libc_cv_have_x86_isa_level=3 libc_cv_have_x86_isa_level=2 #elif defined __x86_64__ libc_cv_have_x86_isa_level=baseline +#elif MINIMUM_X86_ISA_LEVEL == 1 +libc_cv_have_x86_isa_level=1 #else -libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL +libc_cv_have_x86_isa_level=0 #endif EOF eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level` diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h index 2c7f74212b..fe1f0924e4 100644 --- a/sysdeps/x86/isa-level.h +++ b/sysdeps/x86/isa-level.h @@ -35,7 +35,11 @@ # define __X86_ISA_V1 0 #endif -#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \ +#if __X86_ISA_V1 \ + && ((defined __x86_64__ \ + && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) \ + || (!defined __x86_64__ \ + && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) \ && defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ && defined __SSE3__ \ && defined __SSSE3__ && defined __SSE4_1__ && defined __SSE4_2__ /* NB: ISAs in x86-64 ISA level v2 are used. */