From patchwork Mon Jun 13 23:58:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9174751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFACB6044F for ; Tue, 14 Jun 2016 00:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B040F27D45 for ; Tue, 14 Jun 2016 00:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1FA428047; Tue, 14 Jun 2016 00:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C956C27D45 for ; Tue, 14 Jun 2016 00:20:12 +0000 (UTC) Received: from localhost ([::1]:60097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCc5T-0004g4-66 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 13 Jun 2016 20:20:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCblC-0002O9-Hg for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCblB-0004VI-Ic for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:14 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:36400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCblB-0004VC-F7 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:13 -0400 Received: by mail-qt0-x241.google.com with SMTP id z36so5816017qtb.3 for ; Mon, 13 Jun 2016 16:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=U0/xdsPggTjIMbkjLBtF45ed7yRP53hEec4SPCI7kqo=; b=c0JxwSUB9CyVnLJHti4AUFr1URvvUqxmnzrK2oP7nrNSDo+Y2prrlPIlN6pPSSxzq1 LcQOYsHEAZlx4Wcx3yM+6k9+z/Xp1E0M/K3Iewfyna/24vmQlgKKI5pxdkz2YFNEGSld 8zwsQWEr5iFWi60vK/5U8583GbEK0+ILExup5HJqfaPZuGGnAV/DdITsJTwpoaxdViWS bmSq486LfkrH8CR4QxcnWdi3z5+DXHiMaYY8ykkOjpttDBWFgWv2nhNa4ZPwu1VsuECF muQbTAw+32f2nyLcJDAK0Waf5DgySJb6szpIBZ5k5psz9t+f7EXM/+pQ8F1sgPJr3MXD SX4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=U0/xdsPggTjIMbkjLBtF45ed7yRP53hEec4SPCI7kqo=; b=CEq1JsLvZtQvkaQucYuP+T1BaiuNzeKB13ASaXpjOLzvlxCp+rDKpaJjziWaYcuDQt /vUgZVT6FwkP/u+yTsFJSCTlDNh3zpa9mhW57kDQ13c5QGARc+N1lEosT5I59pwWEaEX LyzIQshLdApDVCI/derv0NHF88M+AGOz6K0Eh4aaxrPJfpjlbsg8WDie1L0c0l3yV0G5 jnHuy6vdK7STtIwOdirW7DAtYTNI/uM/m061UkaWKBMqh7aVK0458lLWOzkCtILOttmx eYpyIhdOCc8KrL1Xby5rJ4+u+6PGKSlFKRBqaykzELGDO6yBrGZnRKyPGrp9L9AlYANo yzVQ== X-Gm-Message-State: ALyK8tJAiAiNVXIerL9bIQOPicA8Opx8Heoj/v+3sZzrK1HCRvgtXe6hyF5kVyDi4IZmMg== X-Received: by 10.200.50.77 with SMTP id y13mr17149160qta.5.1465862353041; Mon, 13 Jun 2016 16:59:13 -0700 (PDT) Received: from bigtime.com (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id q200sm7547234qke.31.2016.06.13.16.59.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jun 2016 16:59:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 Jun 2016 16:58:20 -0700 Message-Id: <1465862305-14090-21-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465862305-14090-1-git-send-email-rth@twiddle.net> References: <1465862305-14090-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 20/25] target-openrisc: Optimize l.jal to next X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This allows the tcg optimizer to see, and fold, all of the constants involved in a GOT base register load sequence. Signed-off-by: Richard Henderson --- target-openrisc/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c index 70aadbc..31f4307 100644 --- a/target-openrisc/translate.c +++ b/target-openrisc/translate.c @@ -189,7 +189,11 @@ static void gen_jump(DisasContext *dc, int32_t n26, uint32_t reg, uint32_t op0) tcg_gen_movi_tl(jmp_pc, tmp_pc); break; case 0x01: /* l.jal */ - tcg_gen_movi_tl(cpu_R[9], (dc->pc + 8)); + tcg_gen_movi_tl(cpu_R[9], dc->pc + 8); + /* Optimize jal being used to load the PC for PIC. */ + if (tmp_pc == dc->pc + 8) { + return; + } tcg_gen_movi_tl(jmp_pc, tmp_pc); break; case 0x03: /* l.bnf */