From patchwork Thu Oct 18 16:51:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 986072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487822-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qvKJOBqE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Oxh1ZHMy"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bZpQ3qz2z9s2P for ; Fri, 19 Oct 2018 03:52:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=WkfzPLiBhcF/mdE1QZUxFqQBfqw8wiTMj36VpHPzM+I7oe CsFMr4/KAVUTmIeEPfH7S+CtrrMQXJYNWPftMp9XIADl6XKdgI9TgruAgDohiuT0 s4daGMQZtMwCal2vwtGb+Tpuw4iNAlqHCMA6zhjlHIP2F0fUr/GGPh/30kyhE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=+HGPfbBkq+TmNMNacFWdpM3O1gQ=; b=qvKJOBqE05E5hKgZSv5j 56pRcRrEX+Bk8HDRkhdZwd3sGGfeSKWNhXrCINPx164ifBsKAzQVTVZKN+TryuUZ CWgmrNMhceCYoMQsMlUsWzTRUzQbt8dW+z7zaMo7fvYD79u6wW2FetUQzyj/TL6Q ZF6yYTImz+u9toVgk3uL9Ys= Received: (qmail 27195 invoked by alias); 18 Oct 2018 16:52:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 27177 invoked by uid 89); 18 Oct 2018 16:52:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it1-f180.google.com Received: from mail-it1-f180.google.com (HELO mail-it1-f180.google.com) (209.85.166.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Oct 2018 16:52:02 +0000 Received: by mail-it1-f180.google.com with SMTP id l127-v6so2370884ith.1 for ; Thu, 18 Oct 2018 09:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=YCQmeRObGJlEdCXUPGrRkyGaoogFMiPZ0gI5ZN2qehw=; b=Oxh1ZHMykkuB7YpqcfdlOIRygxkGZcURtLtYT4D5VZU8Nvd7r6mejZxqsmY5igsF3X UAgmIJdQImdOxFZafYgvjpv3yGToRKFXnvdEm/hVYYMwEWuMrSNyycsy9C8m2GxM20iU dLrByb/Ea5bFzQm221WDTON3ywNp5964aK+kt7rRL9EFB34wrBodE5g8RvVq55eYYCsx HAQP9Assm9vKFrpLtJaGWn6QtZWB4o/DvXHtOLMbcgFOT+8v+seZ+B+3yaVAB1GQDfFg gGMnHkXXGHdkYMihBfNYJtLPcSXQVO3l5W32Ji2/jewbOFDYkqtX3UgLbMjfIEbc8x8d Si8A== MIME-Version: 1.0 From: Uros Bizjak Date: Thu, 18 Oct 2018 18:51:49 +0200 Message-ID: Subject: [PATCH, i386]: Improve some i387 sequences To: "gcc-patches@gcc.gnu.org" 2018-10-18 Uros Bizjak * config/i386/i386.c (ix86_emit_fp_unordered_jump): Set JUMP_LABEL to the jump insn. (ix86_emit_i387_log1p): Use ix86_expand_branch to expand branch. Predict emitted jump and add label to jump insn. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 3ab6b205eb61..ef46083b04b9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -43879,6 +43879,7 @@ void ix86_emit_fp_unordered_jump (rtx label) { rtx reg = gen_reg_rtx (HImode); + rtx_insn *insn; rtx temp; emit_insn (gen_x86_fnstsw_1 (reg)); @@ -43901,10 +43902,9 @@ ix86_emit_fp_unordered_jump (rtx label) temp = gen_rtx_IF_THEN_ELSE (VOIDmode, temp, gen_rtx_LABEL_REF (VOIDmode, label), pc_rtx); - temp = gen_rtx_SET (pc_rtx, temp); - - emit_jump_insn (temp); + insn = emit_jump_insn (gen_rtx_SET (pc_rtx, temp)); predict_jump (REG_BR_PROB_BASE * 10 / 100); + JUMP_LABEL (insn) = label; } /* Output code to perform a log1p XFmode calculation. */ @@ -43915,27 +43915,36 @@ void ix86_emit_i387_log1p (rtx op0, rtx op1) rtx_code_label *label2 = gen_label_rtx (); rtx tmp = gen_reg_rtx (XFmode); - rtx tmp2 = gen_reg_rtx (XFmode); - rtx test; + rtx res = gen_reg_rtx (XFmode); + rtx cst, cstln2, cst1; + rtx_insn *insn; + + cst = const_double_from_real_value + (REAL_VALUE_ATOF ("0.29289321881345247561810596348408353", XFmode), XFmode); + cstln2 = force_reg (XFmode, standard_80387_constant_rtx (4)); /* fldln2 */ emit_insn (gen_absxf2 (tmp, op1)); - emit_move_insn (tmp2, standard_80387_constant_rtx (4)); /* fldln2 */ - test = gen_rtx_GE (VOIDmode, tmp, - const_double_from_real_value ( - REAL_VALUE_ATOF ("0.29289321881345247561810596348408353", XFmode), - XFmode)); - emit_jump_insn - (gen_cbranchxf4 (test, XEXP (test, 0), XEXP (test, 1), label1)); - - emit_insn (gen_fyl2xp1xf3_i387 (op0, op1, tmp2)); + + cst = force_reg (XFmode, cst); + ix86_expand_branch (GE, tmp, cst, label1); + predict_jump (REG_BR_PROB_BASE * 10 / 100); + insn = get_last_insn (); + JUMP_LABEL (insn) = label1; + + emit_insn (gen_fyl2xp1xf3_i387 (res, op1, cstln2)); emit_jump (label2); emit_label (label1); - emit_move_insn (tmp, CONST1_RTX (XFmode)); - emit_insn (gen_addxf3 (tmp, op1, tmp)); - emit_insn (gen_fyl2xxf3_i387 (op0, tmp, tmp2)); + LABEL_NUSES (label1) = 1; + + cst1 = force_reg (XFmode, CONST1_RTX (XFmode)); + emit_insn (gen_rtx_SET (tmp, gen_rtx_PLUS (XFmode, op1, cst1))); + emit_insn (gen_fyl2xxf3_i387 (res, tmp, cstln2)); emit_label (label2); + LABEL_NUSES (label2) = 1; + + emit_move_insn (op0, res); } /* Emit code for round calculation. */ @@ -43952,7 +43961,8 @@ void ix86_emit_i387_round (rtx op0, rtx op1) rtx_code_label *jump_label = gen_label_rtx (); rtx (*floor_insn) (rtx, rtx); rtx (*neg_insn) (rtx, rtx); - rtx insn, tmp; + rtx_insn *insn; + rtx tmp; switch (inmode) {