From patchwork Mon Aug 12 23:47:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 266664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 0BD632C0139 for ; Tue, 13 Aug 2013 09:51:19 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=oQ1k5 sVR5NWbYq5/+0Hqr5f8wACPBmIeGqUAxZf9AeNIErIgHJSsCDEUeOFGmbu4aqelR sjubozat3JxAf+z2jt52ui+ILwN6B/4gZDVgHDazP1OSBKd3MuwNmvlO3/t6wL9w 0Jz+xLKYuI3C7kgSQjn2jQxHwsdHClQaTvx+Ao= 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:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=hIaR8DA3MZ3 /ff3+J4/5xQ+DNxY=; b=Or7LKvrBxEwNaiFxaH0UEdxKHSvLK4Vc91urDMWup9Z QXoGIDNzQWS36t7igyHVzY/LrPmRaE4k+abZKyb+WKWDMZZYJdvvKo/Ba4aO5IDq gqetiFzxl0Hf4w20X3gEqLnMUKUzaOHONwqval12m7vJzXAoFjuGXvTPoIxCz/20 = Received: (qmail 6920 invoked by alias); 12 Aug 2013 23:48:28 -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 6842 invoked by uid 89); 12 Aug 2013 23:48:26 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 12 Aug 2013 23:48:25 +0000 From: "Steve Ellcey " Date: Mon, 12 Aug 2013 16:47:39 -0700 To: , Subject: [patch, mips] Fix for loongson prefetching and -mabi=32 User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-ID: <048d0052-0976-4478-85e7-f5e10e36daf1@BAMAIL02.ba.imgtec.org> X-SEF-Processed: 7_3_0_01192__2013_08_13_00_48_23 Someone using buildroot reported a problem to me that I tracked down to compiling a routine containing __builtin_prefetch with '-march=loongson -mabi=32'. When doing this the prefetch instruction on loongson generates 'ld' instead of 'lw' and then tries to put it into a delay slot. This causes the assembler to generate a warning both because 'ld' in 32 bit mode is a macro and GCC put out a '.set nomacro' and because it tries to put the two instructions generated by the macro into a delay slot. My fix is to generate 'lw' in 32 bit mode on loongson, then it doesn't generate a macro and the instruction that is generated can go into a delay slot. OK for checkin? 2013-08-12 Steve Ellcey * config/mips/mips.md (prefetch): Use lw instead of ld on loongson in 32bit mode. diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 397c40a..ad03040 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -6674,7 +6674,10 @@ { if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A) /* Loongson 2[ef] and Loongson 3a use load to $0 to perform prefetching. */ - return "ld\t$0,%a0"; + if (TARGET_64BIT) + return "ld\t$0,%a0"; + else + return "lw\t$0,%a0"; operands[1] = mips_prefetch_cookie (operands[1], operands[2]); return "pref\t%1,%a0"; }