From patchwork Sun May 5 04:35:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 241501 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 C28D12C00D7 for ; Sun, 5 May 2013 14:35: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:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=e8GUv0cABKdMWsfZihHJq9YCTZVIa5 GXg3v0WRmyo26Q5BRJVUTURxppnQTSRZZjmPfqhAlwPY3DoHF5Hb9R8OoeuS7ugc qKKK7DHaOmidbbuUOEGdgyYCDB1ZQkFKWI3lJSTRiHE2J4D70gfT6DZirv6fIHxe CNSSHxQrgJ1/I= 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:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=vtqMpgfpAwK+yUunGg06l9r7qJY=; b=Kvpn mHDxvL6RTIvLNVF7UtySd4hEOatJvmlVLreQ5ChJq0FaBTW3KyoY5QZxF6RR5nhC DdfwlriNn+nNccq1LSQMTtC2V8iA2qMJf0j1Ih+7VAcstn4s5p3pCaTAkV8gYAO9 bvAaT3N5MBHDQwSc4NbXazFpxiimWGebGT3GFW8= Received: (qmail 26505 invoked by alias); 5 May 2013 04:35:12 -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 26474 invoked by uid 89); 5 May 2013 04:35:09 -0000 X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_SR autolearn=ham version=3.3.1 Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 05 May 2013 04:35:08 +0000 Received: by mail-pa0-f48.google.com with SMTP id kp6so1511490pab.7 for ; Sat, 04 May 2013 21:35:07 -0700 (PDT) X-Received: by 10.68.125.135 with SMTP id mq7mr1454153pbb.159.1367728506988; Sat, 04 May 2013 21:35:06 -0700 (PDT) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id bt6sm13369894pad.20.2013.05.04.21.35.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 May 2013 21:35:06 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 9943FEA2C6B; Sun, 5 May 2013 14:05:00 +0930 (CST) Date: Sun, 5 May 2013 14:05:00 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org, David Edelsohn Subject: Re: powerpc64le-linux support Message-ID: <20130505043500.GX5221@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn References: <20130424104744.GO22536@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130424104744.GO22536@bubble.grove.modra.org> User-Agent: Mutt/1.5.21 (2010-09-15) This fixes a couple more little-endian bugs. bswapdi stores when !TARGET_LDBRX were being split to two bswapsi but written to the wrong words because we word swapped twice. ashrdi3 resulted in a libcall. I think I have ashrdi3_no_power correct. For LE, the first reg of a register pair is the low word, the second the high word, and you use %L to select the high reg. (For BE the second reg is the low word and %L really does stand for low). So a quick rule of thumb for converting big-endian register pair patterns to little-endian is replace all the reg pair %n with %Ln and all %Ln with %n. * config/rs6000/rs6000.md (bswapdi 2nd splitter): Don't swap words twice for little-endian. (ashrdi3_no_power, ashrdi3): Support little-endian. Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 198274) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -2329,16 +2330,14 @@ { word_high = change_address (dest, SImode, addr1); word_low = change_address (dest, SImode, addr2); - emit_insn (gen_bswapsi2 (word_high, src_si)); - emit_insn (gen_bswapsi2 (word_low, op3_si)); } else { word_high = change_address (dest, SImode, addr2); word_low = change_address (dest, SImode, addr1); - emit_insn (gen_bswapsi2 (word_low, src_si)); - emit_insn (gen_bswapsi2 (word_high, op3_si)); } + emit_insn (gen_bswapsi2 (word_high, src_si)); + emit_insn (gen_bswapsi2 (word_low, op3_si)); }") (define_split @@ -6634,10 +6633,25 @@ [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r") (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") (match_operand:SI 2 "const_int_operand" "M,i")))] - "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN" - "@ - srawi %0,%1,31\;srawi %L0,%1,%h2 - srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2" + "!TARGET_POWERPC64" + "* +{ + switch (which_alternative) + { + default: + gcc_unreachable (); + case 0: + if (WORDS_BIG_ENDIAN) + return \"srawi %0,%1,31\;srawi %L0,%1,%h2\"; + else + return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\"; + case 1: + if (WORDS_BIG_ENDIAN) + return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\"; + else + return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\"; + } +}" [(set_attr "type" "two,three") (set_attr "length" "8,12")]) @@ -7734,13 +7748,12 @@ [(set (match_operand:DI 0 "gpc_reg_operand" "") (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "") (match_operand:SI 2 "reg_or_cint_operand" "")))] - "WORDS_BIG_ENDIAN" + "" " { if (TARGET_POWERPC64) ; - else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT - && WORDS_BIG_ENDIAN) + else if (GET_CODE (operands[2]) == CONST_INT) { emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2])); DONE;