From patchwork Mon Mar 13 20:50:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1756527 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=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=W0pLQP/9; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pb82c38p2z1yWr for ; Tue, 14 Mar 2023 07:51:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2CEAE3858C1F for ; Mon, 13 Mar 2023 20:51:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CEAE3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678740678; bh=BIIgWk5/+gUBv7A7KTWDQc3cobzFch9wJsaM6l2bM0s=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=W0pLQP/9ZAZ4yFnWVritMcjdsY0ttS3fHoQFpO99iGR/BXH5SCfUsn3dVk/cA/3RE fREsxD6TTTmWS1PCP8QkUAx9hkrPGkuRE4IgRcsOtoGwkZCDCuarXdBydr5DxRoUBi siQL9qEdiwNVsZl3C06tsj1v0infEyseW6gbP8Rc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by sourceware.org (Postfix) with ESMTPS id BBE503858D32 for ; Mon, 13 Mar 2023 20:51:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBE503858D32 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-177b78067ffso3947866fac.7 for ; Mon, 13 Mar 2023 13:51:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678740660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIIgWk5/+gUBv7A7KTWDQc3cobzFch9wJsaM6l2bM0s=; b=hv9FAoSsBLFZZ710DyfX0tEOQ1RsaATGZ1Y0bXRel9oSecwXK5fYhCYpA1svuMa4xg KFHWXLN+QeECxYFM8BHXwKpBkVgyyTPMLmYIs/W9SPosfgRrNge25P9GqZ0ot8OLxXlg nkxjJ7bsfFtkyfHd6DfmaOfQvT7dDs2jAP5gJQFWj7bDL2wXdKIzvemLySvArrUNrKt0 Qr8GLrPeGG8JQOpRR2ikk3DyZbPzQvLH447L9gvcMQ1uZzWeLuAbYMEHc6P1kK8uCRKH SI4xUOQ5GpIoEWMtnU/ovtz6JCzRsDLIBxUlja8GNo5YMld6Ao3k+rzs5hdpPPD3TZtd JMIA== X-Gm-Message-State: AO0yUKWWwxBlY8B3ieJfbBNNsIobfXVJWeBc22zsMYPWqp3Qe3RV2oBy nXxzqLTtdG0Fy216TDZv+mEFYEECeCk= X-Google-Smtp-Source: AK7set8QZfivotFCNTN3GzMh24z1OH2jQemZQiIA+kdfRtbvwmh+aF/IGX3EATvgr78UchrJkYOY0A== X-Received: by 2002:a05:6870:f113:b0:16e:e87c:1454 with SMTP id k19-20020a056870f11300b0016ee87c1454mr20225220oac.20.1678740660480; Mon, 13 Mar 2023 13:51:00 -0700 (PDT) Received: from noahgold-desk.lan (2603-8080-1301-76c6-dbcf-4449-c0ff-4e9d.res6.spectrum.com. [2603:8080:1301:76c6:dbcf:4449:c0ff:4e9d]) by smtp.gmail.com with ESMTPSA id s44-20020a05687050ec00b001729072f759sm433470oaf.0.2023.03.13.13.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 13:51:00 -0700 (PDT) To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: [PATCH v2] x86-64: Replace `and %ah` write with `test %ah` read Date: Mon, 13 Mar 2023 15:50:56 -0500 Message-Id: <20230313205056.419587-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310024420.521941-1-goldstein.w.n@gmail.com> References: <20230310024420.521941-1-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" High8 partial registers can incur a stall when being modified (if not renamed seperately), or at the very least incur extra backend uops (if renamed seperately). Either way read only `testl $0x4, %ah` is preferable to `andb $0x4, %ah`. Function size is unchanged when accounting for 16-byte padding. --- sysdeps/x86_64/fpu/e_fmodl.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/x86_64/fpu/e_fmodl.S b/sysdeps/x86_64/fpu/e_fmodl.S index d754668bce..e9a76178f9 100644 --- a/sysdeps/x86_64/fpu/e_fmodl.S +++ b/sysdeps/x86_64/fpu/e_fmodl.S @@ -13,7 +13,7 @@ ENTRY(__ieee754_fmodl) fldt 8(%rsp) 1: fprem fstsw %ax - and $04,%ah + testb $0x4,%ah jnz 1b fstp %st(1) ret