From patchwork Tue Jun 11 14:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Rebe?= X-Patchwork-Id: 1946356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=exactco.de header.i=@exactco.de header.a=rsa-sha256 header.s=x header.b=fwAP3mTm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.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 4Vz9rV4DTxz20Pb for ; Wed, 12 Jun 2024 00:23:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C5763385DDD9 for ; Tue, 11 Jun 2024 14:23:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx.exactcode.de (mx.exactcode.de [144.76.154.42]) by sourceware.org (Postfix) with ESMTPS id A88E9385842C; Tue, 11 Jun 2024 14:22:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A88E9385842C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=exactcode.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=exactcode.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A88E9385842C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=144.76.154.42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718115779; cv=none; b=fFN7TjOE/n5tyOR4duWDV6YZee9Xd8huksyk/yFXY8VndBnSXZW+S/Ffuxe/q603pP1ANqdkSfbINmSFDtPo8u8WQ9sNgO+jaNMqVRSYbgwTZmW/syNt4ZJQnZRuI1Gzr9t5wGzcgmguhriWj6WEjcwyMIQyaxqCecNAdc5kJk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718115779; c=relaxed/simple; bh=guj5Asi6mkgGmX+1jZW1u5lAKd5WJOq2MKOLCDPJVkA=; h=DKIM-Signature:Date:Message-Id:To:Subject:From:Mime-Version; b=U7fEslArFVM/pxmYewOBRcwz0LhZL3um9Rg8wkcTgofXNuoJdr/e1DWVsdppwTlVNyNi17q7PwZ4Tlf9RnVFmgxMUnDs1ZNy5/eTa0F1ZJbeQ6IDsAYJ7LBa1gp17QGLr4TBRJxzekq68gdnNGo4lVTPQDaGVaw2UgA3n8UBi/w= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=exactco.de; s=x; h=Content-Transfer-Encoding:Content-Type:Mime-Version:From:Subject:Cc:To:Message-Id:Date; bh=fwhxvTADVUqatbMgk+77MJG4pDdBYWO1JiFlzc90Cf4=; b=fwAP3mTmHEmKBGliCpt1aNT15MTT+wqbL6hQ5wPZZUxRLKjBUAaCj5TAr7Ws/iu8YKk/+URC59A+4xhsNhLTXod3rT5JlsoEr4jbpLPaMZ3PxJ1JV/9M0SkQAN27URlOAsIFYHO50NRL9FgWu87cBPIbIcrokND5IZiJLlWL3bw=; Received: from exactco.de ([90.187.5.221]) by mx.exactcode.de with esmtp (Exim 4.82) (envelope-from ) id 1sH2PP-0002l9-1s; Tue, 11 Jun 2024 14:23:35 +0000 Received: from [192.168.2.175] (helo=localhost) by exactco.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1sH2SY-00068x-5L; Tue, 11 Jun 2024 14:26:50 +0000 Date: Tue, 11 Jun 2024 16:22:54 +0200 (CEST) Message-Id: <20240611.162254.1882679419605247393.rene@exactcode.de> To: gcc-patches@gcc.gnu.org Cc: linkw@linux.ibm.com, sjames@gcc.gnu.org, bergner@linux.ibm.com, segher@kernel.crashing.org, dje.gcc@gmail.com Subject: [PATCH v2] fix PowerPC < 7 w/ Altivec not to default to power7 From: Rene Rebe X-Mailer: Mew version 6.9 on Emacs 29.2 Mime-Version: 1.0 X-Spam-Score: -3.1 (---) X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi Kewen, v2 with test case - I hope I worked all your nits in: Glibc uses .machine to determine assembler optimizations to use. However, since reworking the rs6000 .machine output selection in commit e154242724b084380e3221df7c08fcdbd8460674 22 May 2019, G5 as well as Cell, and even power4 w/ -maltivec currently resulted in power7. Mask _ALTIVEC away as the .machine selection already did for GFX and GPOPT. powerpc64-t2-linux-gnu-gcc test.c -S -o - -mcpu=G5 .file "test.c" .machine power7 .abiversion 2 .section ".text" .ident "GCC: (GNU) 10.2.0" .section .note.GNU-stack,"",@progbits We ship this in T2/Linux [2] since 2020 and it is tested on G5, Cell and Power8. Signed-of-by: René Rebe [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97367 [2] https://t2sde.org --- a/gcc/config/rs6000/rs6000.cc.vanilla 2021-04-25 22:57:16.964223106 +0200 +++ b/gcc/config/rs6000/rs6000.cc 2024-06-10 18:20:27.193223841 +0200 @@ -5765,7 +5765,8 @@ HOST_WIDE_INT flags = rs6000_isa_flags; /* Disable the flags that should never influence the .machine selection. */ - flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL); + flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ALTIVEC + | OPTION_MASK_ISEL); if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0) return "power10"; --- a/gcc/testsuite/gcc.target/powerpc/pr97367.c.vanilla 2024-05-30 18:26:29.839784279 +0200 +++ b/gcc/testsuite/gcc.target/powerpc/pr97367.c 2024-10-06 18:20:34.873818482 +0200 @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-mdejagnu-cpu=G5" } */ + +int dummy () +{ + return 0; +} + +/* { dg-final { scan-assembler "power4" } } */