From patchwork Thu Nov 16 08:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiahao Xu X-Patchwork-Id: 165723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3065373vqg; Thu, 16 Nov 2023 00:28:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqE9D8ifMytbjdtZ2YQ/T2rMMn01JhArj345JmGWlRhgu74N70jVYCXfYi/PogLInd+VxK X-Received: by 2002:a05:620a:2707:b0:779:cf04:3c47 with SMTP id b7-20020a05620a270700b00779cf043c47mr8881788qkp.24.1700123318564; Thu, 16 Nov 2023 00:28:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700123318; cv=pass; d=google.com; s=arc-20160816; b=Njn4k+XqkiAOIcYJ7//RprywNhkHh2LNSOACWCZ3AVCO3/fsVBcDtctU5i838otYIy N8sRyMSh/0g/Zu2jB6NOmAo+Zb+NyU0hY15hhndySnvudHMFlCUVMoNlw/lNLP839Akx Nr11FEV4uGcVrknC4PHpbB/T92M9OdPp64RCvB38rA0BY6cCMkT0AY0WbGDeo61yScFK wCn+ZwW9LAMdr5YmMm1PYRP9m6Cra0NMoIhGfll6DUEuNXUEtvsyAUwk2mJoKGhxpkSj Y/JmAbQN1thIsHuAF+ohRgRn77dUirgxzX/fIfgMBsQRgRv+CZ/qU105n/nRPO6zT71J 3bhg== 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:arc-filter :dmarc-filter:delivered-to; bh=6PZQQ1/gwCXaWKgE1Ourc6nEhw/Nrx3iBvvve+MyaF8=; fh=w+xsGLuzpTj56E0bzPMCc39RWHkBXt2f2AGs+4pGimo=; b=UT6SlDdZjcbOUE64SqVdyJf5NnBE1wzFNZKc3Cl96NRJ6Wzu6mYyb2+xW6LoNMxXXi gKRtsRH2FZcVnBzHdyKOqUeEEx7uqtsMWmpRs2c/ly7k95434jo8LD/Cy/IvUPjdjcB7 vRpuuncWVBFNs3SqPdT7ZxGvkWEx37f1mJ3npgqAQBhcQp3nd5UCmCuPyCBjyNOSTdWo PeeI4o7T8ioYkxGZSJNguU+ptKTC37TeRqAIR3oCwOg1nOkBWCwlW72lzAjf0KtjeqrD fEAlNACPOtviskdbajutXVi1ZpHMx4Xrcn8h+NVwduVzILKqCvrFBqphGqSHXUnh8/Bh Juzg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id tq21-20020a05620a3d1500b00767e994ff18si10221937qkn.143.2023.11.16.00.28.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:28:38 -0800 (PST) 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; arc=pass (i=1); 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 53FE13858424 for ; Thu, 16 Nov 2023 08:28:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id A52DA3858D20 for ; Thu, 16 Nov 2023 08:28:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A52DA3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A52DA3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700123290; cv=none; b=JT+xeUq1CNOYYQ3keXNffMbbGLw2XETU0Fvcm1KRk2CkydG9fSLIt+Rm7aWj9+HSkczuUMoJwswOPZO7tYM/8fQPLpf6Jph+j5osHAS66G9WobD7mCNe/DQXoL4pKev2ASKGozZOO7SlYtDN+hOXf1Fmu4eOP6cpAEXSvi9Pq/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700123290; c=relaxed/simple; bh=BH4YmfGyu/7Wgf4+LZp5eOvDOSabL6AcbBRJZBvnq5E=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=Md2ryB15twkRMJ8d+to5zSNzNxtCUwLy7LltSf3/3BETGflyjJzDM+wlC7rwQGTe7BBtPJZtgDTqyNpGmSTuypCUhBFKFBZI6mP/nuUuR3xYmfeztXZDORrt9O+ChyeAa2EB7NwA12TPwK6w4RJRoDbpNCxWK/ncEvKDnM3jwFg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3XjI-0003we-5Z for gcc-patches@gcc.gnu.org; Thu, 16 Nov 2023 03:28:07 -0500 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8CxLOuE0lVliX86AA--.44236S3; Thu, 16 Nov 2023 16:27:49 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axji+C0lVl1+lDAA--.18000S4; Thu, 16 Nov 2023 16:27:46 +0800 (CST) From: Jiahao Xu To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, chenglulu@loongson.cn, xuchenghua@loongson.cn, Jiahao Xu Subject: [PATCH 1/2] LoongArch: Increase cost of vector aligned store/load. Date: Thu, 16 Nov 2023 16:27:44 +0800 Message-Id: <20231116082744.5839-1-xujiahao@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Axji+C0lVl1+lDAA--.18000S4 X-CM-SenderInfo: 50xmxthkdrqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj9xXoW7Gr45Gry7uw15ZF4UKw48GrX_yoWkXFb_Xw nrGa4qgr4UtayYyr4qqr98J3y5Xa18tF98CF9IqFs7GrW8Xwn8Aw1DAwnxZw10gryxW3Zx KF4Fkryayr1Y9osvyTuYvTs0mTUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x 0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E 7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcV C0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF 04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7 CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8r9N3UUUUU== Received-SPF: pass client-ip=114.242.206.163; envelope-from=xujiahao@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_FAIL, SPF_HELO_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: 1782708509081045224 X-GMAIL-MSGID: 1782708509081045224 Based on SPEC2017 performance evaluation results, it's better to make them equal to the cost of unaligned store/load so as to avoid odd alignment peeling. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_builtin_vectorization_cost): Adjust. diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 738911661d7..d05743bec87 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -3893,11 +3893,9 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, case scalar_stmt: case scalar_load: case vector_stmt: - case vector_load: case vec_to_scalar: case scalar_to_vec: case scalar_store: - case vector_store: return 1; case vec_promote_demote: @@ -3905,6 +3903,8 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, return LASX_SUPPORTED_MODE_P (mode) && !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1; + case vector_load: + case vector_store: case unaligned_load: case unaligned_store: return 2;