From patchwork Tue Jul 18 06:48:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 121819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1569432vqt; Tue, 18 Jul 2023 00:40:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHSj3+9Z+GQ0byjC290hG1kca8dQMgmisB3EfMz5kn8PfRz9JM/v7S8uaQXS2F8t/cli2K6 X-Received: by 2002:a17:902:c3c6:b0:1b8:1c9e:444e with SMTP id j6-20020a170902c3c600b001b81c9e444emr14247621plj.25.1689666022732; Tue, 18 Jul 2023 00:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689666022; cv=none; d=google.com; s=arc-20160816; b=FHuHCnjUKr0fl5a4DD6aLg1VhoApSscAuObfJ0CfIXNnnDIPjXI3SA8EMYgIxCEaZw oMJ8EBGhxt20xziVeVWeLTWOo8RpLuL0XwFIKe/qC4gxBpRnHXNIhJshSDyg4s4BYSVs duVFZ+xWO9yseRovtey+MpQSXz1fkHMX5G1gnQa+VIUQsW1SbTCbVtb7kLtSjUl4RCho Tpv3WwBh08SWGETFU9twSo77p318ihJg9WGAOdykwxtxIKBV4HBSQE9RDPr2ooSR9aBW S6hks8pNqzWecbN/BW7BsgXE0BzKxxCbrzXjjzq+IVUCE3ST4WTVT1P1/zlcdS0xkzrZ N3Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SGM8eplDyxv9tT62WGruCAd4ZxoSoMHqhQMStRVsVr8=; fh=pP+xT0kTi/LGP6in3+LZ1QVlto3/kHwDSWacmmsN9lw=; b=b31vvcm0qSo9LK+RD5Tj3/r9llwQ1zZCNrcdU4IiZoOCnKLOCsbPqIwuWg/3/xX9cC qun2aLRzBYmiIdOZhu+LsrCErZFNwCm7kIS7o8xhHu3ylJnhr8DSc5CXoEaDRSDLJ/+y wZTLP5spN8FGuD5CpyjSc66zaGcgHVRNrczPeDNNiWG7Joh8lOowm7n5GXz+sLLgoSlI eN8+6ZzvcKzgc3tUiI+rCvhguzwOMzgMjZDIhbSvjd9vm/Q2sXivy4niYfYMpXyNOTSu MHKChJ/sbx3PlN9Jlq+7e44uA7UeXbs3uuTkTtxHNvaitnCbV4N+3SXa+3AE3q0abhGt ho7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz13-20020a170903430d00b001b8a5cec6e4si1197947plb.251.2023.07.18.00.40.09; Tue, 18 Jul 2023 00:40:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbjGRGsz (ORCPT + 99 others); Tue, 18 Jul 2023 02:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231294AbjGRGsr (ORCPT ); Tue, 18 Jul 2023 02:48:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3B1B2; Mon, 17 Jul 2023 23:48:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C5E961484; Tue, 18 Jul 2023 06:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D226C433C9; Tue, 18 Jul 2023 06:48:40 +0000 (UTC) From: Huacai Chen To: Huacai Chen Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen Subject: [PATCH] LoongArch: Cleanup __builtin_constant_p() checking for cpu_has_* Date: Tue, 18 Jul 2023 14:48:19 +0800 Message-Id: <20230718064819.2549052-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771743239348364663 X-GMAIL-MSGID: 1771743239348364663 In current configuration, cpu_has_lsx and cpu_has_lasx are impossible constants. So cleanup the __builtin_constant_p() checking to reduce the complexity. Signed-off-by: Huacai Chen Reviewed-by: WANG Xuerui --- arch/loongarch/include/asm/fpu.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/loongarch/include/asm/fpu.h b/arch/loongarch/include/asm/fpu.h index e4193d637f66..f02f4a0d0d64 100644 --- a/arch/loongarch/include/asm/fpu.h +++ b/arch/loongarch/include/asm/fpu.h @@ -218,12 +218,7 @@ static inline void restore_lsx(struct task_struct *t) static inline void init_lsx_upper(void) { - /* - * Check cpu_has_lsx only if it's a constant. This will allow the - * compiler to optimise out code for CPUs without LSX without adding - * an extra redundant check for CPUs with LSX. - */ - if (__builtin_constant_p(cpu_has_lsx) && !cpu_has_lsx) + if (!cpu_has_lsx) return; _init_lsx_upper(); @@ -294,7 +289,7 @@ static inline void restore_lasx_upper(struct task_struct *t) {} static inline int thread_lsx_context_live(void) { - if (__builtin_constant_p(cpu_has_lsx) && !cpu_has_lsx) + if (!cpu_has_lsx) return 0; return test_thread_flag(TIF_LSX_CTX_LIVE); @@ -302,7 +297,7 @@ static inline int thread_lsx_context_live(void) static inline int thread_lasx_context_live(void) { - if (__builtin_constant_p(cpu_has_lasx) && !cpu_has_lasx) + if (!cpu_has_lasx) return 0; return test_thread_flag(TIF_LASX_CTX_LIVE);