From patchwork Fri Jan 5 07:19:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Cederman X-Patchwork-Id: 185247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6069821dyb; Thu, 4 Jan 2024 23:20:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHk80A+hGQrXBpk2aI25N++kNYzAjEat4kVVkG9jTk2qaOLOBlC1bORi1NdyKtzdZGjY8PS X-Received: by 2002:a05:6214:2389:b0:680:b80b:273e with SMTP id fw9-20020a056214238900b00680b80b273emr1595730qvb.99.1704439232075; Thu, 04 Jan 2024 23:20:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704439232; cv=pass; d=google.com; s=arc-20160816; b=GdIDizx07WumR8L43FQOTuzqMGqUY+qlbtx/nETkP+rOLYTLZx2Pyp3X4ywaHlh1HM EahBchaSOHtSGGvlTCYz/wLFG5LSL8dzzEdsHkts2on2TVpZs7leJt/ql2Z6WnwT7CtP Oc9qBVJfN1wbI3TIZYNgL4daSO6fsLpAISBZAShzFWqIZBAzkE7zX8F6J0Wvu4vST8WJ i8hPM1z3UL2LWwucrgnEVUT/0tMNT1VIYe/MVhVgmyplGBY9IIxP0LCkXkiA2fY/K7+n SGhg7Z3g3aquL56Jq74zJuFc7j+3pj2uvm+mlM0ltJNYxWI561ETCXrz6FiWaMFvES8D CaHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=2JQagp0J+4u3G+o0CteIXRXZHBOoyf0n64hgbdwbXH8=; fh=rIObTAxIziLroRYYyAaA4FmRqLBS8lo6qLKQtV3fxpU=; b=a6jYxu8nquO8yxakO+oJe5AO5RVDQt7Zh+DdNb80FQBGAiY1agoiX9Dq5KdOzx4IZZ hwMhuqpr0kaTPPKzss2Tf4njK6QwSWYEe2RrcuRX1401E+BQKwxX5A5h270hafVlzIPB eZmQuMTLqptyhZ3P6GprI4D3O9vdlasiJc/9sf7ui6SSQ6UNh8VmCGPLSF6K+6hV9j7x NfBhTAc5sxbUhG1zV9l3agRepa4pDqKqUfwZfFHuhYIXjEqS3xeBiy9LBnAdGefwZSAN QhnPxX1e/FpjzWPQ3nu90teSRsRbVHEE9Lmj5NruYn4GApp/LHq3yR7C9N0W/MQZCVbb 1inQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gaisler.com header.s=unoeuro header.b=CEwleQsn; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gaisler.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a11-20020a0ca98b000000b0067f870851ffsi1229929qvb.25.2024.01.04.23.20.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 23:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gaisler.com header.s=unoeuro header.b=CEwleQsn; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gaisler.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3CDD385E007 for ; Fri, 5 Jan 2024 07:20:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out3.simply.com (smtp-out3.simply.com [94.231.106.210]) by sourceware.org (Postfix) with ESMTPS id 5E5AE3858004 for ; Fri, 5 Jan 2024 07:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E5AE3858004 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=gaisler.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gaisler.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E5AE3858004 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=94.231.106.210 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704439180; cv=none; b=wNZC3XhyaIbFOim+Eia10mIQCP+STMLgZ1HSRyUt74Fygkjg8HZhtbvvF9d5hnJRaO5EA6kZ3EjQruQVYHCjI5zReXg95nrGSZ5S8lsxp/CgAUMboNbJZnkg764QPG/DHhw/YlOtwTDMGmfo0BS3j6E+VRCfLIVbDsCIa8ZGUvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704439180; c=relaxed/simple; bh=OipN3PKxUxwELW6xiEB9UPd5EhcxjcTIE8G8J6+7Nds=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Sg2+YCaAGTgBv0znAjytzA6BKYgTNjdFd7vYDnxLIAxHqyxz0Tf7HzdnUZBUZMyDGrSJ9DVK9yJsx/cguY54MPdM0rq+LObSkAxhTMPINUd2NSFTGJEvyJJ+i0Y8KB2M33j6Pvml1zv9Ia+5B2jZqguo1wg9SS80HXUa1qCweHo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4T5vwT0y57z67wf; Fri, 5 Jan 2024 08:19:37 +0100 (CET) Received: from cederman.got.gaisler.com (h-98-128-223-123.NA.cust.bahnhof.se [98.128.223.123]) by smtp.simply.com (Simply.com) with ESMTPA id 4T5vwS6SyVz67qq; Fri, 5 Jan 2024 08:19:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaisler.com; s=unoeuro; t=1704439177; bh=2JQagp0J+4u3G+o0CteIXRXZHBOoyf0n64hgbdwbXH8=; h=From:To:Cc:Subject:Date; b=CEwleQsnOYxSniZroN+7/BSV3m/NsG1xec+CMNuGlP0X1jNps48g2NNNRxHKYNcIV Q1NfP8svM47sBgE+Jvosh5dqUt84XZZ69zh9NHqbpfeLrRDX2W3JgczNdI8ntlAel3 jqHuQB37zRMc+lNJEn6eJ0rPC3AC+DCZcRo7j9tY= From: Daniel Cederman To: gcc-patches@gcc.gnu.org Cc: ebotcazou@libertysurf.fr, daniel@gaisler.com Subject: [PATCH] sparc: Char arrays are 64-bit aligned on SPARC Date: Fri, 5 Jan 2024 08:19:10 +0100 Message-Id: <20240105071913.593978-1-cederman@gaisler.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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: 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787234072514489940 X-GMAIL-MSGID: 1787234072514489940 pr88077 fails on SPARC since char HeaderStr[1] in pr88077_1.c and long HeaderStr in pr88077_0.c differs in alignment. warning: alignment 4 of normal symbol `HeaderStr' in c_lto_pr88077_0.o is smaller than 8 used by the common definition in c_lto_pr88077_1.o gcc/testsuite/ChangeLog: * gcc.dg/lto/pr88077_0.c: Change type to match alignment for SPARC --- gcc/testsuite/gcc.dg/lto/pr88077_0.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/testsuite/gcc.dg/lto/pr88077_0.c b/gcc/testsuite/gcc.dg/lto/pr88077_0.c index 924fe9fc3f01..9455295051fc 100644 --- a/gcc/testsuite/gcc.dg/lto/pr88077_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr88077_0.c @@ -1,3 +1,7 @@ /* { dg-lto-do link } */ +#if defined __sparc__ +long long HeaderStr; +#else long HeaderStr; +#endif From patchwork Fri Jan 5 07:19:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Cederman X-Patchwork-Id: 185250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6070133dyb; Thu, 4 Jan 2024 23:21:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIgSoDYGzdBzVV/sQp8i57ZDvyj4hwhioz+YrLiyu0s86qu3uviQqQaMRRxVkOGZR2xWjz X-Received: by 2002:ac8:5a06:0:b0:427:a33e:8b97 with SMTP id n6-20020ac85a06000000b00427a33e8b97mr1903864qta.5.1704439288902; Thu, 04 Jan 2024 23:21:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704439288; cv=pass; d=google.com; s=arc-20160816; b=wH0XRYpxdYCr2y6dnqG5MKYhq7CdFgdHRE2lvy2hEhcROP9ouvuye7+ds8qzygO4lW LlNTDCF+OGzIK5aFyOFBkDD7C9b7Ag3NXO91V/Xzcm8M0lQcJFDoc9P5TmCMYulRep9c /UmFN5G6j5X5ZxaeJOxmMUJ5T4noXwDFOLLTGjqA/NCMp/4s+4dmg2xeOsTb8WA/lOTU NXoai7fWmRBTMXO5eJaHs+28kGlLGHO6hNtnDAd0pY4qVrdv1fpJjtTs6kj1+JeBPDe9 6rzaCbCvOft12yP6hBbMF2vdI8uQSvMRFs3O0M6tjLwnHhvoiR94fGMJWdx30LA9I6bb UhCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=jgwrPigoAIeSBUSfTetOehvtcToSes2fA3TVbeunOtA=; fh=rIObTAxIziLroRYYyAaA4FmRqLBS8lo6qLKQtV3fxpU=; b=mmrExszUaoYcg7ccES0yPIlPbV0jP6IcvdAwf5+WYW1nxDJMyYqOB4ylZZGBx0RKxy I6zpVhxwjkyqLy5UtIYMXKuIOGJT6IbWX9aVHDHQA5xBvu/XwNirLyR2q+ZxDCG0FUwO pmmlqw8Uo7E07WXANyOX4Da6Yt5bMIsiZYNM/Gb9hlMS3syE7DaF03HPQNTrUefqWK7w j9gB3G7UALHw5M+KI9gvQqDImfMqXQXtG2er1iqSC1wFNZ0RelvIYHXr4+67X169wEdY AGXz6QvLtjAB8UqXepUmQC+rWb1xqQNJxPehxOlbNs821fEJYGBNFeXHtBj912f2P3lL 2ZxQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gaisler.com header.s=unoeuro header.b=EF5KImeo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gaisler.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i18-20020ac85e52000000b00427e96d51a7si1276749qtx.197.2024.01.04.23.21.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 23:21:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gaisler.com header.s=unoeuro header.b=EF5KImeo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gaisler.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B37B385E00A for ; Fri, 5 Jan 2024 07:21:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out3.simply.com (smtp-out3.simply.com [94.231.106.210]) by sourceware.org (Postfix) with ESMTPS id AE1213857BA3 for ; Fri, 5 Jan 2024 07:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE1213857BA3 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=gaisler.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gaisler.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE1213857BA3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=94.231.106.210 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704439180; cv=none; b=XE2swyVWcKx0Yrd0vnqNuSfZzCiSBVi1+bsvTmrc+csGnCd7r0h/3m7uWU+30MakbP5KH5duSYMu8MFvz9UebRTanJvRsqMt/3ooicSoP1/CR3dA9vRcdlY4UKW4oEFuNN8MM+1wcIFMhK5W7zF+AinjDBB5yCApq6f8sxAAQqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704439180; c=relaxed/simple; bh=00sUL889NIdU7eBvRFaB2+zFMW+2E1K+AJVdx8RBiXg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=E+LBQQvq331A6qt3ukIHm0y8rF+lbWN91Tpis37JLBf4QAmvRYPi4lpzjwF8zQb8MzKcCFM5y7ZPtd9+wNKSRynCeDJqRugY4SUqT9qMqgtiaCOrAV4LYmKrs+7TgjBFHyabHbNU/TPn2Jec7P5vhBouAHyTYuOyruVvSxKWS4A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4T5vwT4bDRz67wy; Fri, 5 Jan 2024 08:19:37 +0100 (CET) Received: from cederman.got.gaisler.com (h-98-128-223-123.NA.cust.bahnhof.se [98.128.223.123]) by smtp.simply.com (Simply.com) with ESMTPA id 4T5vwT3H7sz67wG; Fri, 5 Jan 2024 08:19:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaisler.com; s=unoeuro; t=1704439177; bh=jgwrPigoAIeSBUSfTetOehvtcToSes2fA3TVbeunOtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EF5KImeofuEuJXHFWW3RmUNICHNC09ndL2y5J+wQU5kz59CR9PIFwCBgg35MnipDB wxa36REj1JMLHDtIvoZHBJTphtEoMX0r/b4iKV/zzaoZptj2KoDj+EBUHqzu5bSl5f ablj+9WAjg4tETQ1VXUKuB08PRFqbAELY6GmIsp4= From: Daniel Cederman To: gcc-patches@gcc.gnu.org Cc: ebotcazou@libertysurf.fr, daniel@gaisler.com Subject: [PATCH 2/2] sparc: Add errata workaround to membar patterns Date: Fri, 5 Jan 2024 08:19:13 +0100 Message-Id: <20240105071913.593978-4-cederman@gaisler.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240105071913.593978-1-cederman@gaisler.com> References: <20240105071913.593978-1-cederman@gaisler.com> MIME-Version: 1.0 X-Spam-Status: No, score=-16.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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: 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787234131767628402 X-GMAIL-MSGID: 1787234131767628402 LEON now uses the standard V8 membar patterns that contains an ldstub instruction. This instruction needs to be aligned properly when the GR712RC errata workaround is enabled. gcc/ChangeLog: * config/sparc/sparc.cc (atomic_insn_for_leon3_p): Treat membar_storeload as atomic * config/sparc/sync.md: Add GR712RC errata workaround --- gcc/config/sparc/sparc.cc | 1 + gcc/config/sparc/sync.md | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc index ebf1a557a49d..62c57cc53159 100644 --- a/gcc/config/sparc/sparc.cc +++ b/gcc/config/sparc/sparc.cc @@ -1052,6 +1052,7 @@ atomic_insn_for_leon3_p (rtx_insn *insn) { switch (INSN_CODE (insn)) { + case CODE_FOR_membar_storeload: case CODE_FOR_swapsi: case CODE_FOR_ldstub: case CODE_FOR_atomic_compare_and_swap_leon3_1: diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md index ac291420b8b9..fa249908a55f 100644 --- a/gcc/config/sparc/sync.md +++ b/gcc/config/sparc/sync.md @@ -65,12 +65,19 @@ [(set_attr "type" "multi")]) ;; For V8, LDSTUB has the effect of membar #StoreLoad. -(define_insn "*membar_storeload" +(define_insn "membar_storeload" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] "TARGET_V8" - "ldstub\t[%%sp-1], %%g0" - [(set_attr "type" "multi")]) +{ + if (sparc_fix_gr712rc) + return ".align\t16\n\tldstub\t[%%sp-1], %%g0"; + else + return "ldstub\t[%%sp-1], %%g0"; +} + [(set_attr "type" "multi") + (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true") + (const_int 4) (const_int 1)))]) ;; Put the two together, in combination with the fact that V8 implements PSO ;; as its weakest memory model, means a full barrier. Match all remaining @@ -80,9 +87,15 @@ (unspec:BLK [(match_dup 0) (match_operand:SI 1 "const_int_operand")] UNSPEC_MEMBAR))] "TARGET_V8" - "stbar\n\tldstub\t[%%sp-1], %%g0" +{ + if (sparc_fix_gr712rc) + return "stbar\n.align\t16\n\tldstub\t[%%sp-1], %%g0"; + else + return "stbar\n\tldstub\t[%%sp-1], %%g0"; +} [(set_attr "type" "multi") - (set_attr "length" "2")]) + (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true") + (const_int 5) (const_int 2)))]) ;; For V9, we have the full membar instruction. (define_insn "*membar"