From patchwork Fri Jun 14 03:59:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengqinggang X-Patchwork-Id: 1947641 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W0lsv4N2Kz20QH for ; Fri, 14 Jun 2024 14:00:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C41233882179 for ; Fri, 14 Jun 2024 04:00:01 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id D4879388206F for ; Fri, 14 Jun 2024 03:59:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D4879388206F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D4879388206F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718337587; cv=none; b=pwlLV5eU+aqMED266Q5Me78A8dNwjqMu4t75ANEv+KkbHgovQSLvCwkmU4rQCQE7/pTmC3HJhhyFpjEOJuVGFJlwuqN2bf1CNgLDwQRx6q7Y9SUqixGpPcSrBoRlG4FyfDeIa3JfmcCGoCz4t+1VzEAxFYECtglz5E2cqaeFNK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718337587; c=relaxed/simple; bh=Hp36cpkHVCjhm6+Y8k2fPUhBKTF9ouJdMxqee8ccKxo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=H8pAbs4qvIGlDr2WmauHHfVpWgr7Q2MMV18JFBooHpTkNfRfYczNmzXdcSq7eLfeU4kCETp6MQ+HOuRaaXoqllmVzPi1IWIGCTOAlzMSef+Eca1JHHzk0rZsCawyhAuz4GR+9/Zp1tbjHvgWiwWTf5d/DS8+VXHcwaCzUwMfbho= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.2.6.5]) by gateway (Coremail) with SMTP id _____8Axz+stwGtmpcUGAA--.11348S3; Fri, 14 Jun 2024 11:59:41 +0800 (CST) Received: from 5.5.5 (unknown [10.2.6.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPMcrwGtmC7sfAA--.12991S2; Fri, 14 Jun 2024 11:59:40 +0800 (CST) From: mengqinggang To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, xuchenghua@loongson.cn, caiyinyu@loongson.cn, chenglulu@loongson.cn, cailulu@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn, wanglei@loongson.cn, hejinyang@loongson.cn, mengqinggang@loongson.cn Subject: [PATCH v1] LoongArch: Fix tst-gnu2-tls2 with -Og flag Date: Fri, 14 Jun 2024 11:59:38 +0800 Message-Id: <20240614035938.3099384-1-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxPMcrwGtmC7sfAA--.12991S2 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj9fXoW3ZF4xtr1xKrWxWryfCr13KFX_yoW8AF13to Wq9rn5X3W7t347XFn7Ca45Xrya9FsxKrs5Gr1Ygr17CFy2vFW8K34UCFZFvF95ZF45Kr9r WFyfXrs8C3yjka4Ul-sFpf9Il3svdjkaLaAFLSUrUUUU1b8apTn2vfkv8UJUUUU8wcxFpf 9Il3svdxBIdaVrn0xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3 UjIYCTnIWjp_UUUYy7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI 8IcIk0rVWrJVCq3wAFIxvE14AKwVWUXVWUAwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xG Y2AK021l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14 v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAF wI0_Gr1j6F4UJwAaw2AFwI0_Jrv_JF1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2 xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_ Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x 0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C267AK xVWUXVWUAwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67 AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI 42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMI IF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVF xhVjvjDU0xZFpf9x07jz2NtUUUUU= X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org asm volatile ("movfcsr2gr $t0, $fcsr0" ::: "$t0"); asm volatile ("st.d $t0, %0" :"=m"(restore_fcsr)); generate to the following instructions with -Og flag: movfcsr2gr $t0, $zero addi.d $t0, $sp, 2047(0x7ff) addi.d $t0, $t0, 77(0x4d) st.w $t0, $t0, 0 fcsr0 register and restore_fcsr variable are both stored in t0 register. Change to: asm volatile ("st.d $t0, %0" :"=m"(restore_fcsr) ::"$t0"); to avoid restore_fcsr address in t0. --- sysdeps/loongarch/tst-gnu2-tls2.h | 258 ++++++++++++++++-------------- 1 file changed, 138 insertions(+), 120 deletions(-) diff --git a/sysdeps/loongarch/tst-gnu2-tls2.h b/sysdeps/loongarch/tst-gnu2-tls2.h index 8e4216785d..935a7b1e66 100644 --- a/sysdeps/loongarch/tst-gnu2-tls2.h +++ b/sysdeps/loongarch/tst-gnu2-tls2.h @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include @@ -43,34 +44,38 @@ #define SAVE_REGISTER_FCC(src) \ asm volatile ("movcf2gr $t0, $fcc0" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[0]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[0]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc1" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[1]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[1]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc2" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[2]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[2]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc3" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[3]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[3]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc4" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[4]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[4]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc5" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[5]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[5]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc6" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[6]) :); \ + asm volatile ("st.d $t0, %0" :"=m"(src[6]) ::"$t0"); \ asm volatile ("movcf2gr $t0, $fcc7" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(src[7]) :); + asm volatile ("st.d $t0, %0" :"=m"(src[7]) ::"$t0"); #define LOAD_REGISTER_FCSR() \ + uint64_t src_fcsr = 0x01010101; \ asm volatile ("li.d $t0, 0x01010101" ::: "$t0"); \ asm volatile ("movgr2fcsr $fcsr0, $t0" :::); -#define SAVE_REGISTER_FCSR() \ - asm volatile ("movfcsr2gr $t0, $fcsr0" ::: "$t0"); \ - asm volatile ("st.d $t0, %0" :"=m"(restore_fcsr) :); +#define SAVE_REGISTER_FCSR() \ + uint64_t restore_fcsr; \ + asm volatile ("movfcsr2gr $t0, $fcsr0" ::: "$t0"); \ + asm volatile ("st.d $t0, %0" :"=m"(restore_fcsr) ::"$t0"); -# define INIT_TLSDESC_CALL() \ +#define INIT_TLSDESC_CALL() \ unsigned long hwcap = getauxval (AT_HWCAP); #define LOAD_REGISTER_FLOAT() \ + for (int i = 0; i < 32; i++) \ + src_float[i] = i + 1; \ asm volatile ("fld.d $f0, %0" ::"m"(src_float[0]) :"$f0"); \ asm volatile ("fld.d $f1, %0" ::"m"(src_float[1]) :"$f1"); \ asm volatile ("fld.d $f2, %0" ::"m"(src_float[2]) :"$f2"); \ @@ -105,38 +110,39 @@ asm volatile ("fld.d $f31, %0" ::"m"(src_float[31]) :"$f31"); #define SAVE_REGISTER_FLOAT() \ - asm volatile ("fst.d $f0, %0" :"=m"(restore_float[0]) :); \ - asm volatile ("fst.d $f1, %0" :"=m"(restore_float[1]) :); \ - asm volatile ("fst.d $f2, %0" :"=m"(restore_float[2]) :); \ - asm volatile ("fst.d $f3, %0" :"=m"(restore_float[3]) :); \ - asm volatile ("fst.d $f4, %0" :"=m"(restore_float[4]) :); \ - asm volatile ("fst.d $f5, %0" :"=m"(restore_float[5]) :); \ - asm volatile ("fst.d $f6, %0" :"=m"(restore_float[6]) :); \ - asm volatile ("fst.d $f7, %0" :"=m"(restore_float[7]) :); \ - asm volatile ("fst.d $f8, %0" :"=m"(restore_float[8]) :); \ - asm volatile ("fst.d $f9, %0" :"=m"(restore_float[9]) :); \ - asm volatile ("fst.d $f10, %0" :"=m"(restore_float[10]) :); \ - asm volatile ("fst.d $f11, %0" :"=m"(restore_float[11]) :); \ - asm volatile ("fst.d $f12, %0" :"=m"(restore_float[12]) :); \ - asm volatile ("fst.d $f13, %0" :"=m"(restore_float[13]) :); \ - asm volatile ("fst.d $f14, %0" :"=m"(restore_float[14]) :); \ - asm volatile ("fst.d $f15, %0" :"=m"(restore_float[15]) :); \ - asm volatile ("fst.d $f16, %0" :"=m"(restore_float[16]) :); \ - asm volatile ("fst.d $f17, %0" :"=m"(restore_float[17]) :); \ - asm volatile ("fst.d $f18, %0" :"=m"(restore_float[18]) :); \ - asm volatile ("fst.d $f19, %0" :"=m"(restore_float[19]) :); \ - asm volatile ("fst.d $f20, %0" :"=m"(restore_float[20]) :); \ - asm volatile ("fst.d $f21, %0" :"=m"(restore_float[21]) :); \ - asm volatile ("fst.d $f22, %0" :"=m"(restore_float[22]) :); \ - asm volatile ("fst.d $f23, %0" :"=m"(restore_float[23]) :); \ - asm volatile ("fst.d $f24, %0" :"=m"(restore_float[24]) :); \ - asm volatile ("fst.d $f25, %0" :"=m"(restore_float[25]) :); \ - asm volatile ("fst.d $f26, %0" :"=m"(restore_float[26]) :); \ - asm volatile ("fst.d $f27, %0" :"=m"(restore_float[27]) :); \ - asm volatile ("fst.d $f28, %0" :"=m"(restore_float[28]) :); \ - asm volatile ("fst.d $f29, %0" :"=m"(restore_float[29]) :); \ - asm volatile ("fst.d $f30, %0" :"=m"(restore_float[30]) :); \ - asm volatile ("fst.d $f31, %0" :"=m"(restore_float[31]) :); + double restore_float[32]; \ + asm volatile ("fst.d $f0, %0" :"=m"(restore_float[0])); \ + asm volatile ("fst.d $f1, %0" :"=m"(restore_float[1])); \ + asm volatile ("fst.d $f2, %0" :"=m"(restore_float[2])); \ + asm volatile ("fst.d $f3, %0" :"=m"(restore_float[3])); \ + asm volatile ("fst.d $f4, %0" :"=m"(restore_float[4])); \ + asm volatile ("fst.d $f5, %0" :"=m"(restore_float[5])); \ + asm volatile ("fst.d $f6, %0" :"=m"(restore_float[6])); \ + asm volatile ("fst.d $f7, %0" :"=m"(restore_float[7])); \ + asm volatile ("fst.d $f8, %0" :"=m"(restore_float[8])); \ + asm volatile ("fst.d $f9, %0" :"=m"(restore_float[9])); \ + asm volatile ("fst.d $f10, %0" :"=m"(restore_float[10])); \ + asm volatile ("fst.d $f11, %0" :"=m"(restore_float[11])); \ + asm volatile ("fst.d $f12, %0" :"=m"(restore_float[12])); \ + asm volatile ("fst.d $f13, %0" :"=m"(restore_float[13])); \ + asm volatile ("fst.d $f14, %0" :"=m"(restore_float[14])); \ + asm volatile ("fst.d $f15, %0" :"=m"(restore_float[15])); \ + asm volatile ("fst.d $f16, %0" :"=m"(restore_float[16])); \ + asm volatile ("fst.d $f17, %0" :"=m"(restore_float[17])); \ + asm volatile ("fst.d $f18, %0" :"=m"(restore_float[18])); \ + asm volatile ("fst.d $f19, %0" :"=m"(restore_float[19])); \ + asm volatile ("fst.d $f20, %0" :"=m"(restore_float[20])); \ + asm volatile ("fst.d $f21, %0" :"=m"(restore_float[21])); \ + asm volatile ("fst.d $f22, %0" :"=m"(restore_float[22])); \ + asm volatile ("fst.d $f23, %0" :"=m"(restore_float[23])); \ + asm volatile ("fst.d $f24, %0" :"=m"(restore_float[24])); \ + asm volatile ("fst.d $f25, %0" :"=m"(restore_float[25])); \ + asm volatile ("fst.d $f26, %0" :"=m"(restore_float[26])); \ + asm volatile ("fst.d $f27, %0" :"=m"(restore_float[27])); \ + asm volatile ("fst.d $f28, %0" :"=m"(restore_float[28])); \ + asm volatile ("fst.d $f29, %0" :"=m"(restore_float[29])); \ + asm volatile ("fst.d $f30, %0" :"=m"(restore_float[30])); \ + asm volatile ("fst.d $f31, %0" :"=m"(restore_float[31])); #ifdef HAVE_LOONGARCH_VEC_COM #define LOAD_REGISTER_LSX() \ @@ -181,44 +187,47 @@ #define SAVE_REGISTER_LSX() \ int src_lsx[32][4]; \ int restore_lsx[32][4]; \ - asm volatile ("vst $vr0, %0" :"=m"(restore_lsx[0]) :); \ - asm volatile ("vst $vr1, %0" :"=m"(restore_lsx[1]) :); \ - asm volatile ("vst $vr2, %0" :"=m"(restore_lsx[2]) :); \ - asm volatile ("vst $vr3, %0" :"=m"(restore_lsx[3]) :); \ - asm volatile ("vst $vr4, %0" :"=m"(restore_lsx[4]) :); \ - asm volatile ("vst $vr5, %0" :"=m"(restore_lsx[5]) :); \ - asm volatile ("vst $vr6, %0" :"=m"(restore_lsx[6]) :); \ - asm volatile ("vst $vr7, %0" :"=m"(restore_lsx[7]) :); \ - asm volatile ("vst $vr8, %0" :"=m"(restore_lsx[8]) :); \ - asm volatile ("vst $vr9, %0" :"=m"(restore_lsx[9]) :); \ - asm volatile ("vst $vr10, %0" :"=m"(restore_lsx[10]) :); \ - asm volatile ("vst $vr11, %0" :"=m"(restore_lsx[11]) :); \ - asm volatile ("vst $vr12, %0" :"=m"(restore_lsx[12]) :); \ - asm volatile ("vst $vr13, %0" :"=m"(restore_lsx[13]) :); \ - asm volatile ("vst $vr14, %0" :"=m"(restore_lsx[14]) :); \ - asm volatile ("vst $vr15, %0" :"=m"(restore_lsx[15]) :); \ - asm volatile ("vst $vr16, %0" :"=m"(restore_lsx[16]) :); \ - asm volatile ("vst $vr17, %0" :"=m"(restore_lsx[17]) :); \ - asm volatile ("vst $vr18, %0" :"=m"(restore_lsx[18]) :); \ - asm volatile ("vst $vr19, %0" :"=m"(restore_lsx[19]) :); \ - asm volatile ("vst $vr20, %0" :"=m"(restore_lsx[20]) :); \ - asm volatile ("vst $vr21, %0" :"=m"(restore_lsx[21]) :); \ - asm volatile ("vst $vr22, %0" :"=m"(restore_lsx[22]) :); \ - asm volatile ("vst $vr23, %0" :"=m"(restore_lsx[23]) :); \ - asm volatile ("vst $vr24, %0" :"=m"(restore_lsx[24]) :); \ - asm volatile ("vst $vr25, %0" :"=m"(restore_lsx[25]) :); \ - asm volatile ("vst $vr26, %0" :"=m"(restore_lsx[26]) :); \ - asm volatile ("vst $vr27, %0" :"=m"(restore_lsx[27]) :); \ - asm volatile ("vst $vr28, %0" :"=m"(restore_lsx[28]) :); \ - asm volatile ("vst $vr29, %0" :"=m"(restore_lsx[29]) :); \ - asm volatile ("vst $vr30, %0" :"=m"(restore_lsx[30]) :); \ - asm volatile ("vst $vr31, %0" :"=m"(restore_lsx[31]) :); \ + asm volatile ("vst $vr0, %0" :"=m"(restore_lsx[0])); \ + asm volatile ("vst $vr1, %0" :"=m"(restore_lsx[1])); \ + asm volatile ("vst $vr2, %0" :"=m"(restore_lsx[2])); \ + asm volatile ("vst $vr3, %0" :"=m"(restore_lsx[3])); \ + asm volatile ("vst $vr4, %0" :"=m"(restore_lsx[4])); \ + asm volatile ("vst $vr5, %0" :"=m"(restore_lsx[5])); \ + asm volatile ("vst $vr6, %0" :"=m"(restore_lsx[6])); \ + asm volatile ("vst $vr7, %0" :"=m"(restore_lsx[7])); \ + asm volatile ("vst $vr8, %0" :"=m"(restore_lsx[8])); \ + asm volatile ("vst $vr9, %0" :"=m"(restore_lsx[9])); \ + asm volatile ("vst $vr10, %0" :"=m"(restore_lsx[10])); \ + asm volatile ("vst $vr11, %0" :"=m"(restore_lsx[11])); \ + asm volatile ("vst $vr12, %0" :"=m"(restore_lsx[12])); \ + asm volatile ("vst $vr13, %0" :"=m"(restore_lsx[13])); \ + asm volatile ("vst $vr14, %0" :"=m"(restore_lsx[14])); \ + asm volatile ("vst $vr15, %0" :"=m"(restore_lsx[15])); \ + asm volatile ("vst $vr16, %0" :"=m"(restore_lsx[16])); \ + asm volatile ("vst $vr17, %0" :"=m"(restore_lsx[17])); \ + asm volatile ("vst $vr18, %0" :"=m"(restore_lsx[18])); \ + asm volatile ("vst $vr19, %0" :"=m"(restore_lsx[19])); \ + asm volatile ("vst $vr20, %0" :"=m"(restore_lsx[20])); \ + asm volatile ("vst $vr21, %0" :"=m"(restore_lsx[21])); \ + asm volatile ("vst $vr22, %0" :"=m"(restore_lsx[22])); \ + asm volatile ("vst $vr23, %0" :"=m"(restore_lsx[23])); \ + asm volatile ("vst $vr24, %0" :"=m"(restore_lsx[24])); \ + asm volatile ("vst $vr25, %0" :"=m"(restore_lsx[25])); \ + asm volatile ("vst $vr26, %0" :"=m"(restore_lsx[26])); \ + asm volatile ("vst $vr27, %0" :"=m"(restore_lsx[27])); \ + asm volatile ("vst $vr28, %0" :"=m"(restore_lsx[28])); \ + asm volatile ("vst $vr29, %0" :"=m"(restore_lsx[29])); \ + asm volatile ("vst $vr30, %0" :"=m"(restore_lsx[30])); \ + asm volatile ("vst $vr31, %0" :"=m"(restore_lsx[31])); \ for (int i = 0; i < 32; i++) \ for (int j = 0; j < 4; j++) \ { \ src_lsx[i][j] = 0x01010101 * (i + 1); \ if (src_lsx[i][j] != restore_lsx[i][j]) \ - abort (); \ + { \ + printf ("LSX registers compare failed!\n"); \ + abort (); \ + } \ } #else #define SAVE_REGISTER_LSX() @@ -267,44 +276,47 @@ #define SAVE_REGISTER_LASX() \ int src_lasx[32][8]; \ int restore_lasx[32][8]; \ - asm volatile ("xvst $xr0, %0" :"=m"(restore_lasx[0]) :); \ - asm volatile ("xvst $xr1, %0" :"=m"(restore_lasx[1]) :); \ - asm volatile ("xvst $xr2, %0" :"=m"(restore_lasx[2]) :); \ - asm volatile ("xvst $xr3, %0" :"=m"(restore_lasx[3]) :); \ - asm volatile ("xvst $xr4, %0" :"=m"(restore_lasx[4]) :); \ - asm volatile ("xvst $xr5, %0" :"=m"(restore_lasx[5]) :); \ - asm volatile ("xvst $xr6, %0" :"=m"(restore_lasx[6]) :); \ - asm volatile ("xvst $xr7, %0" :"=m"(restore_lasx[7]) :); \ - asm volatile ("xvst $xr8, %0" :"=m"(restore_lasx[8]) :); \ - asm volatile ("xvst $xr9, %0" :"=m"(restore_lasx[9]) :); \ - asm volatile ("xvst $xr10, %0" :"=m"(restore_lasx[10]) :); \ - asm volatile ("xvst $xr11, %0" :"=m"(restore_lasx[11]) :); \ - asm volatile ("xvst $xr12, %0" :"=m"(restore_lasx[12]) :); \ - asm volatile ("xvst $xr13, %0" :"=m"(restore_lasx[13]) :); \ - asm volatile ("xvst $xr14, %0" :"=m"(restore_lasx[14]) :); \ - asm volatile ("xvst $xr15, %0" :"=m"(restore_lasx[15]) :); \ - asm volatile ("xvst $xr16, %0" :"=m"(restore_lasx[16]) :); \ - asm volatile ("xvst $xr17, %0" :"=m"(restore_lasx[17]) :); \ - asm volatile ("xvst $xr18, %0" :"=m"(restore_lasx[18]) :); \ - asm volatile ("xvst $xr19, %0" :"=m"(restore_lasx[19]) :); \ - asm volatile ("xvst $xr20, %0" :"=m"(restore_lasx[20]) :); \ - asm volatile ("xvst $xr21, %0" :"=m"(restore_lasx[21]) :); \ - asm volatile ("xvst $xr22, %0" :"=m"(restore_lasx[22]) :); \ - asm volatile ("xvst $xr23, %0" :"=m"(restore_lasx[23]) :); \ - asm volatile ("xvst $xr24, %0" :"=m"(restore_lasx[24]) :); \ - asm volatile ("xvst $xr25, %0" :"=m"(restore_lasx[25]) :); \ - asm volatile ("xvst $xr26, %0" :"=m"(restore_lasx[26]) :); \ - asm volatile ("xvst $xr27, %0" :"=m"(restore_lasx[27]) :); \ - asm volatile ("xvst $xr28, %0" :"=m"(restore_lasx[28]) :); \ - asm volatile ("xvst $xr29, %0" :"=m"(restore_lasx[29]) :); \ - asm volatile ("xvst $xr30, %0" :"=m"(restore_lasx[30]) :); \ - asm volatile ("xvst $xr31, %0" :"=m"(restore_lasx[31]) :); \ + asm volatile ("xvst $xr0, %0" :"=m"(restore_lasx[0])); \ + asm volatile ("xvst $xr1, %0" :"=m"(restore_lasx[1])); \ + asm volatile ("xvst $xr2, %0" :"=m"(restore_lasx[2])); \ + asm volatile ("xvst $xr3, %0" :"=m"(restore_lasx[3])); \ + asm volatile ("xvst $xr4, %0" :"=m"(restore_lasx[4])); \ + asm volatile ("xvst $xr5, %0" :"=m"(restore_lasx[5])); \ + asm volatile ("xvst $xr6, %0" :"=m"(restore_lasx[6])); \ + asm volatile ("xvst $xr7, %0" :"=m"(restore_lasx[7])); \ + asm volatile ("xvst $xr8, %0" :"=m"(restore_lasx[8])); \ + asm volatile ("xvst $xr9, %0" :"=m"(restore_lasx[9])); \ + asm volatile ("xvst $xr10, %0" :"=m"(restore_lasx[10])); \ + asm volatile ("xvst $xr11, %0" :"=m"(restore_lasx[11])); \ + asm volatile ("xvst $xr12, %0" :"=m"(restore_lasx[12])); \ + asm volatile ("xvst $xr13, %0" :"=m"(restore_lasx[13])); \ + asm volatile ("xvst $xr14, %0" :"=m"(restore_lasx[14])); \ + asm volatile ("xvst $xr15, %0" :"=m"(restore_lasx[15])); \ + asm volatile ("xvst $xr16, %0" :"=m"(restore_lasx[16])); \ + asm volatile ("xvst $xr17, %0" :"=m"(restore_lasx[17])); \ + asm volatile ("xvst $xr18, %0" :"=m"(restore_lasx[18])); \ + asm volatile ("xvst $xr19, %0" :"=m"(restore_lasx[19])); \ + asm volatile ("xvst $xr20, %0" :"=m"(restore_lasx[20])); \ + asm volatile ("xvst $xr21, %0" :"=m"(restore_lasx[21])); \ + asm volatile ("xvst $xr22, %0" :"=m"(restore_lasx[22])); \ + asm volatile ("xvst $xr23, %0" :"=m"(restore_lasx[23])); \ + asm volatile ("xvst $xr24, %0" :"=m"(restore_lasx[24])); \ + asm volatile ("xvst $xr25, %0" :"=m"(restore_lasx[25])); \ + asm volatile ("xvst $xr26, %0" :"=m"(restore_lasx[26])); \ + asm volatile ("xvst $xr27, %0" :"=m"(restore_lasx[27])); \ + asm volatile ("xvst $xr28, %0" :"=m"(restore_lasx[28])); \ + asm volatile ("xvst $xr29, %0" :"=m"(restore_lasx[29])); \ + asm volatile ("xvst $xr30, %0" :"=m"(restore_lasx[30])); \ + asm volatile ("xvst $xr31, %0" :"=m"(restore_lasx[31])); \ for (int i = 0; i < 32; i++) \ for (int j = 0; j < 8; j++) \ { \ src_lasx[i][j] = 0x01010101 * (i + 1); \ if (src_lasx[i][j] != restore_lasx[i][j]) \ - abort (); \ + { \ + printf ("LASX registers compare failed!\n"); \ + abort (); \ + } \ } #else #define SAVE_REGISTER_LASX() @@ -314,9 +326,6 @@ uint64_t src; \ double src_float[32]; \ uint64_t src_fcc[8]; \ - for (int i = 0; i < 32; i++) \ - src_float[i] = i + 1; \ - \ SAVE_REGISTER (src); \ LOAD_REGISTER_FCSR (); \ SAVE_REGISTER_FCC(src_fcc) \ @@ -336,8 +345,6 @@ #define AFTER_TLSDESC_CALL() \ uint64_t restore; \ - uint64_t src_fcsr = 0x01010101; \ - uint64_t restore_fcsr; \ uint64_t restore_fcc[8]; \ SAVE_REGISTER (restore); \ SAVE_REGISTER_FCSR (); \ @@ -355,22 +362,33 @@ } \ else \ { \ - double restore_float[32]; \ SAVE_REGISTER_FLOAT (); \ \ for (int i = 0; i < 32; i++) \ if (src_float[i] != restore_float[i]) \ - abort (); \ + { \ + printf ("Float registers compare failed!\n"); \ + abort (); \ + } \ } \ \ if (src_fcsr != restore_fcsr) \ - abort (); \ + { \ + printf ("FCSR registers compare failed!\n"); \ + abort (); \ + } \ \ if (memcmp (src_fcc, restore_fcc, sizeof (src_fcc)) != 0) \ - abort (); \ + { \ + printf ("FCC registers compare failed!\n"); \ + abort (); \ + } \ \ if (src != restore) \ - abort (); + { \ + printf ("General registers compare failed!\n"); \ + abort (); \ + } \ #endif /* #ifdef __loongarch_soft_float */