From patchwork Fri Sep 29 06:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manos Anagnostakis X-Patchwork-Id: 146436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3827597vqu; Thu, 28 Sep 2023 23:56:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGH6HSz7hC8BVcTMfaMYAbvwVf3eqZTisRhZ3jPQhdzTlNDG36by/E/u9ANknvohvenF7/n X-Received: by 2002:a17:906:3196:b0:9a1:c991:a521 with SMTP id 22-20020a170906319600b009a1c991a521mr2903136ejy.4.1695970564661; Thu, 28 Sep 2023 23:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695970564; cv=none; d=google.com; s=arc-20160816; b=IPrKcflwr2A4ii/gR1lg/w45NMl/IEaheoEVu4PRZdR/NiwIYiUbYq5xWHQgZasi+Q r2KsdE8Ng5wSsf+g0ok43NFW5BmbQJcX+3mEVgpvl6doGDfgJVfJfzp9BTRSe3EoRSsM hFf/QHdWIUIC4vFdXDJBRvbilo3hyZ5966KYVQi5UQwdoZx8XIvbcQQ96SLyJQ9WSpQK LhTeaFAVHM0z7dfKuIRBIDkjgwhDRL2LMvqnOhGUxK0Mu2Pqbtz5G6LawjMHIwLMSlj6 JYhO1nGQT5akvTyRKs3GyADaRiLFH8OBflpCPYzD84QNxoTlBYscQSghLSbP725FCO/T AYwg== ARC-Message-Signature: i=1; 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 :dmarc-filter:delivered-to; bh=yfyFeMw01Bskk6QJCz4o6jywxoYB1Y6+WDXsE16NsZo=; fh=Fy2l74ivpUK6YmiG7YmhGbcVsgCOKIaM36wogmWqNoc=; b=HL2ZpSn4T2/RJCMM46men2flKgZa/ISywRRD2oWW1rhuIRQX28YLlIEYuGQveMfmx4 T/e5/lIuU//TpfgeREBiy02yHEqf2AEprmcWcvqDMIXf8iYLNittv3yAfFv4nPEQi91g kdAfwv88B9T0nTjupsHxP94IEW2fGGXOikYAnBO0QUTfA+3jaOpSQ916OalrD/zVQypw Xr9o22MLTTcdcT/6sHKjOxEnUcYqN8tMlCMIJ++lCBbGAP6OFGJ8UBZMptrAv8bwFs3X 3VVVMsOJk4NVRY+ecWGDbb7L24hjfivMptJ9XOa7p5Td7nKyH+Cr63yXO1s/1QQe4nL8 Krfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=LM5zqtEX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i17-20020a170906a29100b009ade251eabbsi16637328ejz.274.2023.09.28.23.56.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 23:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=LM5zqtEX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B0993857347 for ; Fri, 29 Sep 2023 06:55:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id A3AD23858C52 for ; Fri, 29 Sep 2023 06:55:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3AD23858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50437c618b4so19362335e87.2 for ; Thu, 28 Sep 2023 23:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1695970520; x=1696575320; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yfyFeMw01Bskk6QJCz4o6jywxoYB1Y6+WDXsE16NsZo=; b=LM5zqtEXIawcQtzUTvNvjgTHirvLMjnd0f5GDAuUdM+2qohj3E/ZCVnGMDiUlnLj4e vgt9T7VZ5MF4F7+62idUvPS3DhxRwp2N/JlRo3SLnuHG4av8fFHPuXvAp0okw+FgjbY3 klnuM6WDQG35tKEKi1BHZuRYNufWn5W0rI4Zef6UQpcpiLh3B+NTsLt2AFmNPJEFIe+/ lA0m/SIDCuQCWfGsLOQVmZzJ9Sz3PR26YIlijvfEtgRTuaQ2DmD5JZuwwgR2NDtgNpiF 2jJx/puEh+1RwQU9hM6TR+HD8EiKZrdD8al025bAZUhooqwgqPUOT1Wd+JgXJT0iOTxC dXPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695970520; x=1696575320; 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=yfyFeMw01Bskk6QJCz4o6jywxoYB1Y6+WDXsE16NsZo=; b=IBeQ2BXF4lulvu6/8UQu4dL/ShLUX8oPgYCuHVeXhJlYG8xEVo0BgQBhRVWIvVnN5o sEppkoP2dIvl5PRBt1BnHGkJkRAxSaHF/D/LX6iy8i730iaXve8IvnfOLEwjf8ptT20+ dYqfYGDvKpfGDkUF4T5bjDrW5JgGrPumEzgQOmXHYeCRs5voCKqDchl68q0jULczl8tF 2HS3aZ3fqeD0P9hpP+gjIfQXWm3AEgQzRyZp5rAHl8VPt1Q9XG9GpyxyNJNydna23UAe 9cfkGsTu+dwduKvGdRoSnIv4KvOD5A0xLm2tHZILgFOvGhMpzmkNvzH1H0+Qy/n0VTSq lguw== X-Gm-Message-State: AOJu0YxjLhiMT9MG3z9572MSRIg4pq1wL7l57M/r1wy8m1fsF8qrV8i0 km1qNP5TFElxmX1R6qCR6k9SeFylZ47xS0OrIy0= X-Received: by 2002:a05:6512:12c4:b0:500:c2d7:3ab4 with SMTP id p4-20020a05651212c400b00500c2d73ab4mr3327456lfg.8.1695970519308; Thu, 28 Sep 2023 23:55:19 -0700 (PDT) Received: from localhost.localdomain (adsl-225.79.107.6.tellas.gr. [79.107.6.225]) by smtp.gmail.com with ESMTPSA id d18-20020a056402401200b00536246d1eadsm1958421eda.41.2023.09.28.23.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 23:55:18 -0700 (PDT) From: Manos Anagnostakis To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Philipp Tomsich , Manos Anagnostakis Subject: [PATCH] aarch64: Improve on ldp-stp policies code structure. Date: Fri, 29 Sep 2023 09:55:09 +0300 Message-Id: <20230929065509.30852-1-manos.anagnostakis@vrull.eu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: 1778354031103421432 X-GMAIL-MSGID: 1778354031103421432 Improves on: 834fc2bf This improves the code structure of the ldp-stp policies patch introduced in 834fc2bf Bootstrapped and regtested on aarch64-linux. gcc/ChangeLog: * config/aarch64/aarch64-opts.h (enum aarch64_ldp_policy): Added AARCH64 prefix. (enum aarch64_stp_policy): Added AARCH64 prefix. * config/aarch64/aarch64-protos.h (struct tune_params): Merged enums aarch64_ldp_policy_model and aarch64_stp_policy_model to aarch64_ldp_stp_policy_model. * config/aarch64/aarch64.cc (aarch64_parse_ldp_policy): Removed. (aarch64_parse_ldp_stp_policy): New function. (aarch64_parse_stp_policy): Removed. (aarch64_override_options_internal): Added call to new parsing function and removed superseded ones. (aarch64_mem_ok_with_ldpstp_policy_model): Improved code quality based on the new changes. * config/aarch64/aarch64.opt: Added AARCH64 prefix. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ldp_aligned.c: Splitted into this and ldp_unaligned. * gcc.target/aarch64/stp_aligned.c: Splitted into this and stp_unaligned. * gcc.target/aarch64/ldp_unaligned.c: New test. * gcc.target/aarch64/stp_unaligned.c: New test. Signed-off-by: Manos Anagnostakis --- gcc/config/aarch64/aarch64-opts.h | 16 +- gcc/config/aarch64/aarch64-protos.h | 30 +-- gcc/config/aarch64/aarch64.cc | 184 ++++++++---------- gcc/config/aarch64/aarch64.opt | 20 +- .../gcc.target/aarch64/ldp_aligned.c | 28 --- .../gcc.target/aarch64/ldp_unaligned.c | 40 ++++ .../gcc.target/aarch64/stp_aligned.c | 25 --- .../gcc.target/aarch64/stp_unaligned.c | 37 ++++ 8 files changed, 189 insertions(+), 191 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/ldp_unaligned.c create mode 100644 gcc/testsuite/gcc.target/aarch64/stp_unaligned.c diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h index db8348507a3..e23e1ea200e 100644 --- a/gcc/config/aarch64/aarch64-opts.h +++ b/gcc/config/aarch64/aarch64-opts.h @@ -110,18 +110,18 @@ enum aarch64_key_type { /* Load pair policy type. */ enum aarch64_ldp_policy { - LDP_POLICY_DEFAULT, - LDP_POLICY_ALWAYS, - LDP_POLICY_NEVER, - LDP_POLICY_ALIGNED + AARCH64_LDP_POLICY_DEFAULT, + AARCH64_LDP_POLICY_ALWAYS, + AARCH64_LDP_POLICY_NEVER, + AARCH64_LDP_POLICY_ALIGNED }; /* Store pair policy type. */ enum aarch64_stp_policy { - STP_POLICY_DEFAULT, - STP_POLICY_ALWAYS, - STP_POLICY_NEVER, - STP_POLICY_ALIGNED + AARCH64_STP_POLICY_DEFAULT, + AARCH64_STP_POLICY_ALWAYS, + AARCH64_STP_POLICY_NEVER, + AARCH64_STP_POLICY_ALIGNED }; #endif diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 5c6802b4fe8..7d19111a215 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -568,30 +568,20 @@ struct tune_params /* Place prefetch struct pointer at the end to enable type checking errors when tune_params misses elements (e.g., from erroneous merges). */ const struct cpu_prefetch_tune *prefetch; -/* An enum specifying how to handle load pairs using a fine-grained policy: - - LDP_POLICY_ALIGNED: Emit ldp if the source pointer is aligned - to at least double the alignment of the type. - - LDP_POLICY_ALWAYS: Emit ldp regardless of alignment. - - LDP_POLICY_NEVER: Do not emit ldp. */ - enum aarch64_ldp_policy_model - { - LDP_POLICY_ALIGNED, - LDP_POLICY_ALWAYS, - LDP_POLICY_NEVER - } ldp_policy_model; -/* An enum specifying how to handle store pairs using a fine-grained policy: - - STP_POLICY_ALIGNED: Emit stp if the source pointer is aligned +/* An enum specifying how to handle load and store pairs using + a fine-grained policy: + - LDP_STP_POLICY_ALIGNED: Emit ldp/stp if the source pointer is aligned to at least double the alignment of the type. - - STP_POLICY_ALWAYS: Emit stp regardless of alignment. - - STP_POLICY_NEVER: Do not emit stp. */ + - LDP_STP_POLICY_ALWAYS: Emit ldp/stp regardless of alignment. + - LDP_STP_POLICY_NEVER: Do not emit ldp/stp. */ - enum aarch64_stp_policy_model + enum aarch64_ldp_stp_policy_model { - STP_POLICY_ALIGNED, - STP_POLICY_ALWAYS, - STP_POLICY_NEVER - } stp_policy_model; + AARCH64_LDP_STP_POLICY_ALIGNED, + AARCH64_LDP_STP_POLICY_ALWAYS, + AARCH64_LDP_STP_POLICY_NEVER + } ldp_policy_model, stp_policy_model; }; /* Classifies an address. diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index aa920fc703a..8edc4c18643 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -1358,8 +1358,8 @@ static const struct tune_params generic_tunings = have at most a very minor effect on SVE2 cores. */ (AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params cortexa35_tunings = @@ -1394,8 +1394,8 @@ static const struct tune_params cortexa35_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params cortexa53_tunings = @@ -1430,8 +1430,8 @@ static const struct tune_params cortexa53_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params cortexa57_tunings = @@ -1466,8 +1466,8 @@ static const struct tune_params cortexa57_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_RENAME_FMA_REGS), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params cortexa72_tunings = @@ -1502,8 +1502,8 @@ static const struct tune_params cortexa72_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params cortexa73_tunings = @@ -1538,12 +1538,10 @@ static const struct tune_params cortexa73_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; - - static const struct tune_params exynosm1_tunings = { &exynosm1_extra_costs, @@ -1575,8 +1573,8 @@ static const struct tune_params exynosm1_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &exynosm1_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params thunderxt88_tunings = @@ -1610,8 +1608,8 @@ static const struct tune_params thunderxt88_tunings = tune_params::AUTOPREFETCHER_OFF, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &thunderxt88_prefetch_tune, - tune_params::LDP_POLICY_ALIGNED, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALIGNED /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED /* stp_policy_model. */ }; static const struct tune_params thunderx_tunings = @@ -1645,8 +1643,8 @@ static const struct tune_params thunderx_tunings = tune_params::AUTOPREFETCHER_OFF, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND), /* tune_flags. */ &thunderx_prefetch_tune, - tune_params::LDP_POLICY_ALIGNED, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALIGNED /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED /* stp_policy_model. */ }; static const struct tune_params tsv110_tunings = @@ -1681,8 +1679,8 @@ static const struct tune_params tsv110_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &tsv110_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params xgene1_tunings = @@ -1716,8 +1714,8 @@ static const struct tune_params xgene1_tunings = tune_params::AUTOPREFETCHER_OFF, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS), /* tune_flags. */ &xgene1_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params emag_tunings = @@ -1751,8 +1749,8 @@ static const struct tune_params emag_tunings = tune_params::AUTOPREFETCHER_OFF, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS), /* tune_flags. */ &xgene1_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params qdf24xx_tunings = @@ -1787,8 +1785,8 @@ static const struct tune_params qdf24xx_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ AARCH64_EXTRA_TUNE_RENAME_LOAD_REGS, /* tune_flags. */ &qdf24xx_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; /* Tuning structure for the Qualcomm Saphira core. Default to falkor values @@ -1825,8 +1823,8 @@ static const struct tune_params saphira_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params thunderx2t99_tunings = @@ -1861,8 +1859,8 @@ static const struct tune_params thunderx2t99_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &thunderx2t99_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params thunderx3t110_tunings = @@ -1897,8 +1895,8 @@ static const struct tune_params thunderx3t110_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &thunderx3t110_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params neoversen1_tunings = @@ -1932,8 +1930,8 @@ static const struct tune_params neoversen1_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params ampere1_tunings = @@ -1971,8 +1969,8 @@ static const struct tune_params ampere1_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &ere1_prefetch_tune, - tune_params::LDP_POLICY_ALIGNED, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALIGNED /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED /* stp_policy_model. */ }; static const struct tune_params ampere1a_tunings = @@ -2011,8 +2009,8 @@ static const struct tune_params ampere1a_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &ere1_prefetch_tune, - tune_params::LDP_POLICY_ALIGNED, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALIGNED /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALIGNED /* stp_policy_model. */ }; static const advsimd_vec_cost neoversev1_advsimd_vector_cost = @@ -2194,8 +2192,8 @@ static const struct tune_params neoversev1_tunings = | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT | AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const sve_vec_cost neoverse512tvb_sve_vector_cost = @@ -2333,8 +2331,8 @@ static const struct tune_params neoverse512tvb_tunings = | AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const advsimd_vec_cost neoversen2_advsimd_vector_cost = @@ -2525,8 +2523,8 @@ static const struct tune_params neoversen2_tunings = | AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const advsimd_vec_cost neoversev2_advsimd_vector_cost = @@ -2717,8 +2715,8 @@ static const struct tune_params neoversev2_tunings = | AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT), /* tune_flags. */ &generic_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; static const struct tune_params a64fx_tunings = @@ -2752,8 +2750,8 @@ static const struct tune_params a64fx_tunings = tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */ &a64fx_prefetch_tune, - tune_params::LDP_POLICY_ALWAYS, /* ldp_policy_model. */ - tune_params::STP_POLICY_ALWAYS /* stp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ + tune_params::AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */ }; /* Support for fine-grained override of the tuning structures. */ @@ -17866,34 +17864,35 @@ aarch64_parse_tune (const char *to_parse, const struct processor **res) return AARCH_PARSE_INVALID_ARG; } -/* Parse a command-line -param=aarch64-ldp-policy= parameter. VALUE is - the value of the parameter. */ +/* Parse command-line -param=aarch64-ldp-policy= and + -param=aarch64-stp-policy= parameters. LDP_VALUE is the value + of the ldp-policy parameter and STP_VALUE is the value + of the stp-policy parameter. */ static void -aarch64_parse_ldp_policy (enum aarch64_ldp_policy value, - struct tune_params* tune) +aarch64_parse_ldp_stp_policy (enum aarch64_ldp_policy ldp_value, + enum aarch64_stp_policy stp_value, + struct tune_params* tune) { - if (value == LDP_POLICY_ALWAYS) - tune->ldp_policy_model = tune_params::LDP_POLICY_ALWAYS; - else if (value == LDP_POLICY_NEVER) - tune->ldp_policy_model = tune_params::LDP_POLICY_NEVER; - else if (value == LDP_POLICY_ALIGNED) - tune->ldp_policy_model = tune_params::LDP_POLICY_ALIGNED; -} - -/* Parse a command-line -param=aarch64-stp-policy= parameter. VALUE is - the value of the parameter. */ + if (ldp_value != AARCH64_LDP_POLICY_DEFAULT) + { + if (ldp_value == AARCH64_LDP_POLICY_ALWAYS) + tune->ldp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_ALWAYS; + else if (ldp_value == AARCH64_LDP_POLICY_NEVER) + tune->ldp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_NEVER; + else if (ldp_value == AARCH64_LDP_POLICY_ALIGNED) + tune->ldp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_ALIGNED; + } -static void -aarch64_parse_stp_policy (enum aarch64_stp_policy value, - struct tune_params* tune) -{ - if (value == STP_POLICY_ALWAYS) - tune->stp_policy_model = tune_params::STP_POLICY_ALWAYS; - else if (value == STP_POLICY_NEVER) - tune->stp_policy_model = tune_params::STP_POLICY_NEVER; - else if (value == STP_POLICY_ALIGNED) - tune->stp_policy_model = tune_params::STP_POLICY_ALIGNED; + if (stp_value != AARCH64_STP_POLICY_DEFAULT) + { + if (stp_value == AARCH64_STP_POLICY_ALWAYS) + tune->stp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_ALWAYS; + else if (stp_value == AARCH64_STP_POLICY_NEVER) + tune->stp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_NEVER; + else if (stp_value == AARCH64_STP_POLICY_ALIGNED) + tune->stp_policy_model = tune_params::AARCH64_LDP_STP_POLICY_ALIGNED; + } } /* Parse TOKEN, which has length LENGTH to see if it is an option @@ -18244,13 +18243,10 @@ aarch64_override_options_internal (struct gcc_options *opts) aarch64_parse_override_string (opts->x_aarch64_override_tune_string, &aarch64_tune_params); - if (opts->x_aarch64_ldp_policy_param) - aarch64_parse_ldp_policy (opts->x_aarch64_ldp_policy_param, - &aarch64_tune_params); - - if (opts->x_aarch64_stp_policy_param) - aarch64_parse_stp_policy (opts->x_aarch64_stp_policy_param, - &aarch64_tune_params); + if (opts->x_aarch64_ldp_policy_param || opts->x_aarch64_stp_policy_param) + aarch64_parse_ldp_stp_policy (opts->x_aarch64_ldp_policy_param, + opts->x_aarch64_stp_policy_param, + &aarch64_tune_params); /* This target defaults to strict volatile bitfields. */ if (opts->x_flag_strict_volatile_bitfields < 0 && abi_version_at_least (2)) @@ -26551,30 +26547,18 @@ aarch64_mergeable_load_pair_p (machine_mode mode, rtx mem1, rtx mem2) bool aarch64_mem_ok_with_ldpstp_policy_model (rtx mem, bool load, machine_mode mode) { - /* If we have LDP_POLICY_NEVER, reject the load pair. */ - if (load - && aarch64_tune_params.ldp_policy_model == tune_params::LDP_POLICY_NEVER) - return false; + auto policy = (load + ? aarch64_tune_params.ldp_policy_model + : aarch64_tune_params.stp_policy_model); - /* If we have STP_POLICY_NEVER, reject the store pair. */ - if (!load - && aarch64_tune_params.stp_policy_model == tune_params::STP_POLICY_NEVER) + /* If we have AARCH64_LDP_STP_POLICY_NEVER, reject the load pair. */ + if (policy == tune_params::AARCH64_LDP_STP_POLICY_NEVER) return false; - /* If we have LDP_POLICY_ALIGNED, + /* If we have AARCH64_LDP_STP_POLICY_ALIGNED, do not emit the load pair unless the alignment is checked to be at least double the alignment of the type. */ - if (load - && aarch64_tune_params.ldp_policy_model == tune_params::LDP_POLICY_ALIGNED - && !optimize_function_for_size_p (cfun) - && MEM_ALIGN (mem) < 2 * GET_MODE_ALIGNMENT (mode)) - return false; - - /* If we have STP_POLICY_ALIGNED, - do not emit the store pair unless the alignment is checked to be - at least double the alignment of the type. */ - if (!load - && aarch64_tune_params.stp_policy_model == tune_params::STP_POLICY_ALIGNED + if (policy == tune_params::AARCH64_LDP_STP_POLICY_ALIGNED && !optimize_function_for_size_p (cfun) && MEM_ALIGN (mem) < 2 * GET_MODE_ALIGNMENT (mode)) return false; diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt index 2101c5a23c4..58b834f967b 100644 --- a/gcc/config/aarch64/aarch64.opt +++ b/gcc/config/aarch64/aarch64.opt @@ -339,39 +339,39 @@ Target Joined UInteger Var(aarch64_vect_unroll_limit) Init(4) Param Limit how much the autovectorizer may unroll a loop. -param=aarch64-ldp-policy= -Target Joined Var(aarch64_ldp_policy_param) Enum(aarch64_ldp_policy) Init(LDP_POLICY_DEFAULT) Param +Target Joined Var(aarch64_ldp_policy_param) Enum(aarch64_ldp_policy) Init(AARCH64_LDP_POLICY_DEFAULT) Param --param=aarch64-ldp-policy=[default|always|never|aligned] Fine-grained policy for load pairs. Enum Name(aarch64_ldp_policy) Type(enum aarch64_ldp_policy) UnknownError(unknown aarch64_ldp_policy mode %qs) EnumValue -Enum(aarch64_ldp_policy) String(default) Value(LDP_POLICY_DEFAULT) +Enum(aarch64_ldp_policy) String(default) Value(AARCH64_LDP_POLICY_DEFAULT) EnumValue -Enum(aarch64_ldp_policy) String(always) Value(LDP_POLICY_ALWAYS) +Enum(aarch64_ldp_policy) String(always) Value(AARCH64_LDP_POLICY_ALWAYS) EnumValue -Enum(aarch64_ldp_policy) String(never) Value(LDP_POLICY_NEVER) +Enum(aarch64_ldp_policy) String(never) Value(AARCH64_LDP_POLICY_NEVER) EnumValue -Enum(aarch64_ldp_policy) String(aligned) Value(LDP_POLICY_ALIGNED) +Enum(aarch64_ldp_policy) String(aligned) Value(AARCH64_LDP_POLICY_ALIGNED) -param=aarch64-stp-policy= -Target Joined Var(aarch64_stp_policy_param) Enum(aarch64_stp_policy) Init(STP_POLICY_DEFAULT) Param +Target Joined Var(aarch64_stp_policy_param) Enum(aarch64_stp_policy) Init(AARCH64_STP_POLICY_DEFAULT) Param --param=aarch64-stp-policy=[default|always|never|aligned] Fine-grained policy for store pairs. Enum Name(aarch64_stp_policy) Type(enum aarch64_stp_policy) UnknownError(unknown aarch64_stp_policy mode %qs) EnumValue -Enum(aarch64_stp_policy) String(default) Value(STP_POLICY_DEFAULT) +Enum(aarch64_stp_policy) String(default) Value(AARCH64_STP_POLICY_DEFAULT) EnumValue -Enum(aarch64_stp_policy) String(always) Value(STP_POLICY_ALWAYS) +Enum(aarch64_stp_policy) String(always) Value(AARCH64_STP_POLICY_ALWAYS) EnumValue -Enum(aarch64_stp_policy) String(never) Value(STP_POLICY_NEVER) +Enum(aarch64_stp_policy) String(never) Value(AARCH64_STP_POLICY_NEVER) EnumValue -Enum(aarch64_stp_policy) String(aligned) Value(STP_POLICY_ALIGNED) +Enum(aarch64_stp_policy) String(aligned) Value(AARCH64_STP_POLICY_ALIGNED) diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_aligned.c b/gcc/testsuite/gcc.target/aarch64/ldp_aligned.c index f44f9616366..75495d71df2 100644 --- a/gcc/testsuite/gcc.target/aarch64/ldp_aligned.c +++ b/gcc/testsuite/gcc.target/aarch64/ldp_aligned.c @@ -14,16 +14,6 @@ TYPE ldp_aligned_##TYPE(char* ptr){ \ return a_0 + a_1; \ } -#define LDP_TEST_UNALIGNED(TYPE) \ -TYPE ldp_unaligned_##TYPE(char* ptr){ \ - TYPE a_0, a_1; \ - TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ - TYPE *a = arr+1; \ - a_0 = a[0]; \ - a_1 = a[1]; \ - return a_0 + a_1; \ -} - #define LDP_TEST_ADJUST_ALIGNED(TYPE) \ TYPE ldp_aligned_adjust_##TYPE(char* ptr){ \ TYPE a_0, a_1, a_2, a_3, a_4; \ @@ -36,29 +26,11 @@ TYPE ldp_aligned_adjust_##TYPE(char* ptr){ \ return a_0 + a_1 + a_2 + a_3 + a_4; \ } -#define LDP_TEST_ADJUST_UNALIGNED(TYPE) \ -TYPE ldp_unaligned_adjust_##TYPE(char* ptr){ \ - TYPE a_0, a_1, a_2, a_3, a_4; \ - TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ - TYPE *a = arr+1; \ - a_0 = a[100]; \ - a_1 = a[101]; \ - a_2 = a[102]; \ - a_3 = a[103]; \ - a_4 = a[110]; \ - return a_0 + a_1 + a_2 + a_3 + a_4; \ -} - LDP_TEST_ALIGNED(int32_t); LDP_TEST_ALIGNED(int64_t); LDP_TEST_ALIGNED(v4si); -LDP_TEST_UNALIGNED(int32_t); -LDP_TEST_UNALIGNED(int64_t); -LDP_TEST_UNALIGNED(v4si); LDP_TEST_ADJUST_ALIGNED(int32_t); LDP_TEST_ADJUST_ALIGNED(int64_t); -LDP_TEST_ADJUST_UNALIGNED(int32_t); -LDP_TEST_ADJUST_UNALIGNED(int64_t); /* { dg-final { scan-assembler-times "ldp\tw\[0-9\]+, w\[0-9\]" 3 } } */ /* { dg-final { scan-assembler-times "ldp\tx\[0-9\]+, x\[0-9\]" 3 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_unaligned.c b/gcc/testsuite/gcc.target/aarch64/ldp_unaligned.c new file mode 100644 index 00000000000..d9dcfe432f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ldp_unaligned.c @@ -0,0 +1,40 @@ +/* { dg-options "-O2 --param=aarch64-ldp-policy=aligned -mcpu=generic" } */ + +#include +#include + +typedef int v4si __attribute__ ((vector_size (16))); + +#define LDP_TEST_UNALIGNED(TYPE) \ +TYPE ldp_unaligned_##TYPE(char* ptr){ \ + TYPE a_0, a_1; \ + TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ + TYPE *a = arr+1; \ + a_0 = a[0]; \ + a_1 = a[1]; \ + return a_0 + a_1; \ +} + +#define LDP_TEST_ADJUST_UNALIGNED(TYPE) \ +TYPE ldp_unaligned_adjust_##TYPE(char* ptr){ \ + TYPE a_0, a_1, a_2, a_3, a_4; \ + TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ + TYPE *a = arr+1; \ + a_0 = a[100]; \ + a_1 = a[101]; \ + a_2 = a[102]; \ + a_3 = a[103]; \ + a_4 = a[110]; \ + return a_0 + a_1 + a_2 + a_3 + a_4; \ +} + +LDP_TEST_UNALIGNED(int32_t); +LDP_TEST_UNALIGNED(int64_t); +LDP_TEST_UNALIGNED(v4si); +LDP_TEST_ADJUST_UNALIGNED(int32_t); +LDP_TEST_ADJUST_UNALIGNED(int64_t); + +/* { dg-final { scan-assembler-times "ldp\tw\[0-9\]+, w\[0-9\]" 0 } } */ +/* { dg-final { scan-assembler-times "ldp\tx\[0-9\]+, x\[0-9\]" 0 } } */ +/* { dg-final { scan-assembler-times "ldp\tq\[0-9\]+, q\[0-9\]" 0 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/stp_aligned.c b/gcc/testsuite/gcc.target/aarch64/stp_aligned.c index ab9c2f42dd3..20bd95373fa 100644 --- a/gcc/testsuite/gcc.target/aarch64/stp_aligned.c +++ b/gcc/testsuite/gcc.target/aarch64/stp_aligned.c @@ -13,15 +13,6 @@ TYPE *stp_aligned_##TYPE(char* ptr, TYPE x){ \ return arr; \ } -#define STP_TEST_UNALIGNED(TYPE) \ -TYPE *stp_unaligned_##TYPE(char* ptr, TYPE x){ \ - TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ - TYPE *a = arr+1; \ - a[0] = x; \ - a[1] = x; \ - return a; \ -} - #define STP_TEST_ADJUST_ALIGNED(TYPE) \ TYPE *stp_aligned_adjust_##TYPE(char* ptr, TYPE x){ \ TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ @@ -32,27 +23,11 @@ TYPE *stp_aligned_adjust_##TYPE(char* ptr, TYPE x){ \ return arr; \ } -#define STP_TEST_ADJUST_UNALIGNED(TYPE) \ -TYPE *stp_unaligned_adjust_##TYPE(char* ptr, TYPE x){ \ - TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ - TYPE *a = arr+1; \ - a[100] = x; \ - a[101] = x; \ - a[102] = x; \ - a[103] = x; \ - return a; \ -} - STP_TEST_ALIGNED(int32_t); STP_TEST_ALIGNED(int64_t); STP_TEST_ALIGNED(v4si); -STP_TEST_UNALIGNED(int32_t); -STP_TEST_UNALIGNED(int64_t); -STP_TEST_UNALIGNED(v4si); STP_TEST_ADJUST_ALIGNED(int32_t); STP_TEST_ADJUST_ALIGNED(int64_t); -STP_TEST_ADJUST_UNALIGNED(int32_t); -STP_TEST_ADJUST_UNALIGNED(int64_t); /* { dg-final { scan-assembler-times "stp\tw\[0-9\]+, w\[0-9\]" 3 } } */ /* { dg-final { scan-assembler-times "stp\tx\[0-9\]+, x\[0-9\]" 3 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/stp_unaligned.c b/gcc/testsuite/gcc.target/aarch64/stp_unaligned.c new file mode 100644 index 00000000000..9a5690af362 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/stp_unaligned.c @@ -0,0 +1,37 @@ +/* { dg-options "-O2 --param=aarch64-stp-policy=aligned -mcpu=generic" } */ + +#include +#include + +typedef int v4si __attribute__ ((vector_size (16))); + +#define STP_TEST_UNALIGNED(TYPE) \ +TYPE *stp_unaligned_##TYPE(char* ptr, TYPE x){ \ + TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ + TYPE *a = arr+1; \ + a[0] = x; \ + a[1] = x; \ + return a; \ +} + +#define STP_TEST_ADJUST_UNALIGNED(TYPE) \ +TYPE *stp_unaligned_adjust_##TYPE(char* ptr, TYPE x){ \ + TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ + TYPE *a = arr+1; \ + a[100] = x; \ + a[101] = x; \ + a[102] = x; \ + a[103] = x; \ + return a; \ +} + +STP_TEST_UNALIGNED(int32_t); +STP_TEST_UNALIGNED(int64_t); +STP_TEST_UNALIGNED(v4si); +STP_TEST_ADJUST_UNALIGNED(int32_t); +STP_TEST_ADJUST_UNALIGNED(int64_t); + +/* { dg-final { scan-assembler-times "stp\tw\[0-9\]+, w\[0-9\]" 0 } } */ +/* { dg-final { scan-assembler-times "stp\tx\[0-9\]+, x\[0-9\]" 0 } } */ +/* { dg-final { scan-assembler-times "stp\tq\[0-9\]+, q\[0-9\]" 0 } } */ +