From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17067 invoked from network); 1 Aug 2021 16:07:55 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 1 Aug 2021 16:07:55 -0000 Received: (qmail 28213 invoked by uid 550); 1 Aug 2021 16:07:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 28183 invoked from network); 1 Aug 2021 16:07:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1627834058; bh=Bhm4xa9mJ8rvhQMkxezOgXVfZQAtH59yM5zcF25hhbc=; h=From:To:Subject:Date; b=IGPNR1s7KyxpIu14WWvziuTbr3+9Chbrbwz78rQMcPbkHUrUbA4P2u5T20P9pQSen wYCJq58lNM+WwA24s1O1acijxmTuIQeelC/2hFGJESrfjr2oGhcvVHuHvbnMFAAWO6 A8G2f9DYPcHdKTUGBknfNemiJuqkTbPLfEZa5SCQ= Message-ID: <04BD4026EE364FF7AFBAF8C593E9A2E7@H270> From: "Stefan Kanthak" To: Date: Sun, 1 Aug 2021 17:59:52 +0200 Organization: Me, myself & IT MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_855B_01D786FF.077A5880" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 3259 X-purgate-ID: 155817::1627834057-0000752D-02A51CB4/0/0 Subject: [musl] [Patch] src/math/i386/remquo.s: remove conditional branch, shorter bit twiddling This is a multi-part message in MIME format. ------=_NextPart_000_855B_01D786FF.077A5880 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Halve the number of instructions (from 12 to 6) to fetch the (3-bit partial) quotient from the FPU flags C0:C3:C1, and perform its negation without conditional branch. --- -/math/i386/remquo.s +++ +/math/i386/remquo.s @@ -2,49 +2,44 @@ .type remquof,@function remquof: mov 12(%esp),%ecx + mov 8(%esp),%eax + xor 4(%esp),%eax flds 8(%esp) flds 4(%esp) - mov 11(%esp),%dh - xor 7(%esp),%dh - jmp 1f + jmp 0f .global remquol .type remquol,@function remquol: mov 28(%esp),%ecx + mov 24(%esp),%eax + xor 12(%esp),%eax + cwtl fldt 16(%esp) fldt 4(%esp) - mov 25(%esp),%dh - xor 13(%esp),%dh - jmp 1f + jmp 0f .global remquo .type remquo,@function remquo: mov 20(%esp),%ecx + mov 16(%esp),%eax + xor 8(%esp),%eax fldl 12(%esp) fldl 4(%esp) - mov 19(%esp),%dh - xor 11(%esp),%dh +0: cltd 1: fprem1 fnstsw %ax sahf jp 1b fstp %st(1) - mov %ah,%dl - shr %dl - and $1,%dl - mov %ah,%al - shr $5,%al - and $2,%al - or %al,%dl - mov %ah,%al - shl $2,%al - and $4,%al - or %al,%dl - test %dh,%dh - jns 1f - neg %dl -1: movsbl %dl,%edx - mov %edx,(%ecx) + adc %al,%al + shl $2,%ah + adc %al,%al + shl $5,%ah + adc %al,%al + and $7,%eax + xor %edx,%eax + sub %edx,%eax + mov %eax,(%ecx) ret ------=_NextPart_000_855B_01D786FF.077A5880 Content-Type: application/octet-stream; name="remquo.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="remquo.patch" --- -remquo.s=0A= +++ +remquo.s=0A= @@ -2,49 +2,44 @@=0A= .type remquof,@function remquof: mov 12(%esp),%ecx + mov 8(%esp),%eax + xor 4(%esp),%eax flds 8(%esp) flds 4(%esp) - mov 11(%esp),%dh - xor 7(%esp),%dh - jmp 1f + jmp 0f =20 .global remquol .type remquol,@function remquol: mov 28(%esp),%ecx + mov 24(%esp),%eax + xor 12(%esp),%eax + cwtl fldt 16(%esp) fldt 4(%esp) - mov 25(%esp),%dh - xor 13(%esp),%dh - jmp 1f + jmp 0f =20 .global remquo .type remquo,@function remquo: mov 20(%esp),%ecx + mov 16(%esp),%eax + xor 8(%esp),%eax fldl 12(%esp) fldl 4(%esp) - mov 19(%esp),%dh - xor 11(%esp),%dh +0: cltd 1: fprem1 fnstsw %ax sahf jp 1b fstp %st(1) - mov %ah,%dl - shr %dl - and $1,%dl - mov %ah,%al - shr $5,%al - and $2,%al - or %al,%dl - mov %ah,%al - shl $2,%al - and $4,%al - or %al,%dl - test %dh,%dh - jns 1f - neg %dl -1: movsbl %dl,%edx - mov %edx,(%ecx) + adc %al,%al + shl $2,%ah + adc %al,%al + shl $5,%ah + adc %al,%al + and $7,%eax + xor %edx,%eax + sub %edx,%eax + mov %eax,(%ecx) ret ------=_NextPart_000_855B_01D786FF.077A5880--