Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6471127rwp; Tue, 18 Jul 2023 00:23:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHByav0Ktpc4LcBeVTlktVCtEdBeCZifqxcAQdWL0Iiy8YaVYDFFiNv0Sp43kvV6XLIkRd8 X-Received: by 2002:ac2:4ec9:0:b0:4f8:6600:4074 with SMTP id p9-20020ac24ec9000000b004f866004074mr10740923lfr.17.1689665012620; Tue, 18 Jul 2023 00:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689665012; cv=none; d=google.com; s=arc-20160816; b=PYrfXfBUYsgNkgVByMQE9rhuSfvtI/B3SANOZvWLpqsy4WEcAdmxqQcYOK7j084m7W zP6/bTRQ/6RdsQUPu2W7vdX750W37JPolFpNCGiwsxPG07BbnlMSU4kliMDiLqqwf7cT CLaAotJbRHs8C/Cnuq6MKy0AnZiEli4p9zVlKGCedFpGCit3Q2rRSNk2Llsj8MQsjo8R 7uXm9qJqOIyEylfX3+mw5x+iH+pXEwilo9yWsGFLHAxDCLg5reNPuIq1H0UZHvJgSV7c tIBVFjxXjUKxUE1+xccG2Wi2o5EgGcKoX9NWOI9xZ5wpICpqbjgq5h+5ljjIlqzvg/RR dqqw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020aa7c0cb000000b0051d7e275e56si832716edp.272.2023.07.18.00.23.09; Tue, 18 Jul 2023 00:23:32 -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 S231343AbjGRGsy (ORCPT + 99 others); Tue, 18 Jul 2023 02:48:54 -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 Content-Transfer-Encoding: 8bit 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 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 --- 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); -- 2.39.3