From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 7A5F34BA2E2D for ; Fri, 8 May 2026 09:47:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A5F34BA2E2D 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 7A5F34BA2E2D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778233658; cv=none; b=ZuMR1cwkAWJhgWGgw4dA1OF6oHS2PZPWxZFJRtGRrm7aEkaFdnWOYwZtbOwbaAztYXE3Wx5qdcLemBULpIYn5e5Gbr6Mbx3nEyQDCutoDqTM3JkYZrxY2nEn+ja20//0u1kvyAY9hskp+fAIRl7GxXSpDMpKTdsojETopdU0qL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778233658; c=relaxed/simple; bh=wi0s6YpF+YKshgNGY2VJk/U31W/0Phy7jiGChW1snLs=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=u4xUHVS9lzgV/BFjG1QHnSUjI+vq9IiP5VPr3dwQ1MKG87nAkRyIiTwngmIm216dsqG1+e+KTcKQOK+gIFBAogJObSqDzhphsUWBvhkCVTwD3KV4vyC8YtYv6upDcW34ODuESIHGngS8iEMffMvmFIBVJ16u2wAqo/g6hcohSMc= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A5F34BA2E2D Received: from loongson.cn (unknown [111.9.175.10]) by gateway (Coremail) with SMTP id _____8DxBOkusf1pTdYHAA--.19086S3; Fri, 08 May 2026 17:47:26 +0800 (CST) Received: from [10.136.14.13] (unknown [111.9.175.10]) by front1 (Coremail) with SMTP id qMiowJDx6+Assf1podV8AA--.41907S3; Fri, 08 May 2026 17:47:25 +0800 (CST) Subject: Re: [PATCH] LoongArch: Optimize math barriers To: Xi Ruoyao , Andreas Schwab Cc: adhemerval.zanella@linaro.org, libc-alpha@sourceware.org, caiyinyu@loongson.cn, i.swmail@xen0n.name, joseph_myers@mentor.com, carlos@redhat.com, xuchenghua@loongson.cn References: <20260507021740.16572-1-dengjianbo@loongson.cn> <87jytf90o2.fsf@igel.home> <93c7e2b9-423b-46bf-b95c-6b456d5b1da5@loongson.cn> <460de7efbecb99e8ee40d21d5ed3c451da89d5a8.camel@xry111.site> From: dengjianbo Message-ID: <75617e1e-54db-c3cb-1601-7dab304020e7@loongson.cn> Date: Fri, 8 May 2026 17:47:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <460de7efbecb99e8ee40d21d5ed3c451da89d5a8.camel@xry111.site> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID:qMiowJDx6+Assf1podV8AA--.41907S3 X-CM-SenderInfo: pghqwyxldqu0o6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBj9xXoWrKF4DWFWxZF1fKFy7KFW5CFX_yoWkuFgE9F Z5trn7Cw15WF47WFn7tFs8u3WDKa1qkry3JrZ5Xr9xW3sxX398W3WkurZ29r1rGr4a9r90 krn0vw1Iq34akosvyTuYvTs0mTUanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUbfAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WUJVW8JwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1ln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y 6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr4 1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWU JVW8JwCFI7km07C267AKxVWUXVWUAwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8hiSPUUUUU== X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,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 sourceware.org List-Id: On 5/8/26 5:29 PM, Xi Ruoyao wrote: > On Thu, 2026-05-07 at 17:30 +0800, dengjianbo wrote: >> Yes, unnecessary moves can occur if the value is already in a general >> reg. For example, when invoking math_opt_barrier with fixed-point >> parameters. However, in glibc, these two macros are invoked with >> floating-point parameters, and I didn’t find the unnecessary moves >> being generated. For other architectures, aarch64 and s390 also do >> not include the 'r' constraint. >> >> For gcc part, to my understanding, when 'fr' is present, GCC selects the >> union of FP_REGS and GR_REGS as the destination register class, which is >> initialized to GR_REGS. Then compute the cost of choosing different >> register classes, choosing GR_REGS incurs no extra cost, while choosing >> FP_REGS adds an extra move cost. I am not sure if it's a strategy here. > > Where does this issue manifest (i.e. in which glibc source file)? I'll > try to reduce a test case from that. To me this seems a compiler bug > too. >> > One example is the xflow function, compiler generates the unnecessary moves for this function, the source file is sysdeps/ieee754/dbl-64/math_err.c.