From patchwork Thu Mar 15 22:38:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 886487 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-474833-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LUdp+tWA"; 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 402NnB5GNhz9sVd for ; Fri, 16 Mar 2018 09:39:24 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=pcNrbarn0t0JjLpnaAHWrOxVr+XdGX77ied20RWrBSW7RqEU0z Zppbw8GozG/5blpPj99S+Tgo6NOjfPPQxf6ApjSv6m/JNDk171xU9XawOqDuTdjW BiAp5DDzYgftj8LxJFfrMPGCRNMcjbt0WKqlhhHNzC7SePtzplyMqA6rc= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=7lfJaYFY4uw7FHxAcbOgN3lrPVI=; b=LUdp+tWA5fGur2TKOYYU Jed1nCaxRkdI5Q+Es0VuPLbu79O17Bh8loJCq8l6nVYJC9Mwsjq9M/P69Zz9Njp1 ubprsLuYP3h4mawdGugQ8yNLTcht2lznuo3s0+7WacVmL5m5ldgNRipeUtq09AtJ zxR5sIvmcYcnB+kf0ZLPr64= Received: (qmail 79793 invoked by alias); 15 Mar 2018 22:39:13 -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 79752 invoked by uid 89); 15 Mar 2018 22:39:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Nios, H*r:0700, our X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Mar 2018 22:38:59 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1ewbWT-0002uv-Qe from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Thu, 15 Mar 2018 15:38:57 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 15 Mar 2018 15:38:55 -0700 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [patch, committed] fix nios2 thinko Message-ID: <75416c63-ca35-ad03-e5bc-2a7ce165cc93@codesourcery.com> Date: Thu, 15 Mar 2018 16:38:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 X-ClientProxiedBy: SVR-ORW-MBX-06.mgc.mentorg.com (147.34.90.206) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) Our friends at Altera spotted a bug in the Nios II backend that was causing different code to be generated randomly for functions involving taking the address of a symbol. The root of the problem was that in r255492 I goofed and introduced some uses of INTVAL that were not guarded by CONST_INT_P so they were randomly grabbing contents of a SYMBOL_REF rtx instead. AFAICT the generated code was not functionally incorrect, just different; the bug caused the movsi_internal splitter to fail to fire when it was supposed to, but I think LRA was subsequently generating the %hi/%lo pair via a different code path. The fix is pretty obvious.... add the missing guard. :-P -Sandra Index: gcc/config/nios2/nios2.md =================================================================== --- gcc/config/nios2/nios2.md (revision 482298) +++ gcc/config/nios2/nios2.md (working copy) @@ -298,9 +298,10 @@ } "(nios2_large_constant_memory_operand_p (operands[0]) || nios2_large_constant_memory_operand_p (operands[1]) - || (nios2_large_constant_p (operands[1]) - && !SMALL_INT_UNSIGNED (INTVAL (operands[1])) - && !UPPER16_INT (INTVAL (operands[1]))))" + || (nios2_large_constant_p (operands[1]) + && !(CONST_INT_P (operands[1]) + && (SMALL_INT_UNSIGNED (INTVAL (operands[1])) + || UPPER16_INT (INTVAL (operands[1]))))))" [(set (match_dup 0) (match_dup 1))] { if (nios2_large_constant_memory_operand_p (operands[0]))