From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id A91A53950C03 for ; Thu, 3 Sep 2020 20:54:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A91A53950C03 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 784D43F2D6FD for ; Thu, 3 Sep 2020 13:54:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NCtbKUff3CJh for ; Thu, 3 Sep 2020 13:54:37 -0700 (PDT) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id EEFDE3F2D68C for ; Thu, 3 Sep 2020 13:54:36 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id AD6D01582201; Thu, 3 Sep 2020 13:54:36 -0700 (PDT) From: Keith Packard To: newlib@sourceware.org Subject: [PATCH 0/2] libm/riscv: Fixing machine-specific fma/sqrt Date: Thu, 3 Sep 2020 13:54:31 -0700 Message-Id: <20200903205433.2108717-1-keithp@keithp.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2020 20:54:40 -0000 RISC-V has a couple of acceleration paths that are designed to repace the general code for sqrt and fma. The sqrt code was using the wrong filenames and ended up replacing the wrong functions (sqrt instead of __ieee754_sqrt). For builds that disabled errno, that code provided an alias for sqrt mapping to __ieee754_sqrt so things "worked". The fma code had the right filenames, but because it only generated code on machines with hardware support, machines lacking it ended up replacing the useful general implementation with an empty object file. To fix this, I've renamed the RISC-V sqrt files then fixed both sqrt and fma to #include the general code when the machine-specific code wasn't used. I tested the result by making sure every libm.a generated for RISC-V contained exactly one of each relevant function.