From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id 5705441259 for ; Thu, 17 Oct 2002 14:36:54 -0400 (EDT) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id g9HIasL02209 for axp-list@listman.redhat.com; Thu, 17 Oct 2002 14:36:54 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g9HIasf02205 for ; Thu, 17 Oct 2002 14:36:54 -0400 Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g9HIG4w04617 for ; Thu, 17 Oct 2002 14:16:04 -0400 Received: from fwd01.sul.t-online.de by mailout02.sul.t-online.com with smtp id 182FVk-0001C4-0A; Thu, 17 Oct 2002 20:36:44 +0200 Received: from juist (520046482682-0001@[217.81.146.91]) by fmrl01.sul.t-online.com with esmtp id 182FVe-1uqhZQC; Thu, 17 Oct 2002 20:36:38 +0200 Received: from falk by juist with local (Exim 3.36 #1 (Debian)) id 182FWR-0007Kg-00; Thu, 17 Oct 2002 20:37:27 +0200 X-Face: "iUeUu$b*W_"w?tV83Y3*r:`rh&dRv}$YnZ3,LVeCZSYVuf[Gpo*5%_=/\_!gc_,SS}[~xZ wY77I-M)xHIx:2f56g%/`SOw"Dx%4Xq0&f\Tj~>|QR|vGlU}TBYhiG(K:2 Cc: axp-list@redhat.com Subject: Re: unaligned traps question References: <01da01c273e4$d5c57320$35de2b09@Viswanadha> <02101615182900.18457@shadowfax.middleearth> <87d6qanp62.fsf@student.uni-tuebingen.de> <02101616080803.18457@shadowfax.middleearth> From: Falk Hueffner Date: 17 Oct 2002 20:37:21 +0200 In-Reply-To: <02101616080803.18457@shadowfax.middleearth> Message-ID: <87d6q87vz2.fsf@student.uni-tuebingen.de> User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.5 (broccoli) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Sender: 520046482682-0001@t-dialin.net X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: --=-=-= George France writes: > On Wednesday 16 October 2002 15:45, Falk Hueffner wrote: > > Note that the code gcc generates for these is pretty inefficient, > > though, so the memcpy method is probably faster. (Incidentally, I have > > a patch lying around that makes better code on Alphas with the BWX > > extension, but I never got around to finishing it... does anybody > > think it is worthwhile?) > > Yup, pretty may not equal fast. :-) Maybe Alvin would like to test this > and let us know? > > Lots of people could take advantage of the BWX extension. For people > with those systems it is probably worthwhile. OK, here it is... if anybody likes it, I could try to submit it to the gcc maintainers. -- Falk --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=unaligned.patch Index: alpha.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v retrieving revision 1.277 diff -u -r1.277 alpha.c --- alpha.c 27 Sep 2002 13:30:07 -0000 1.277 +++ alpha.c 17 Oct 2002 18:10:53 -0000 @@ -4075,9 +4075,15 @@ lda r3,X(r11) lda r3,X+2(r11) extwl r1,r3,r1 extql r1,r3,r1 extwh r2,r3,r2 extqh r2,r3,r2 - or r1.r2.r1 or r1,r2,r1 + or r1,r2,r1 or r1,r2,r1 sra r1,48,r1 + (BWX) ldbu r1,X(a0) ldbu r1,X(a0) + ldbu r2,X+1(a0) ldbu r2,X+1(a0) + sll r2,8,r2 sll r2,8,r2 + or r1,r2,r1 or r1,r2,r1 + sextwl r1,r1 + long: ldq_u r1,X(r11) ldq_u r1,X(r11) ldq_u r2,X+3(r11) ldq_u r2,X+3(r11) lda r3,X(r11) lda r3,X(r11) @@ -4102,6 +4108,26 @@ rtx meml, memh, addr, extl, exth, tmp, mema; enum machine_mode mode; + if (TARGET_BWX && (int) size == 2) + { + rtx lo, hi; + + lo = gen_reg_rtx (QImode); + hi = gen_reg_rtx (QImode); + emit_move_insn (lo, adjust_address (mem, QImode, + ofs + WORDS_BIG_ENDIAN ? 1 : 0)); + emit_move_insn (hi, adjust_address (mem, QImode, + ofs + WORDS_BIG_ENDIAN ? 0 : 1)); + tmp = expand_binop (HImode, ashl_optab, hi, GEN_INT (8), + tgt, 0, OPTAB_WIDEN); + tmp = expand_binop (HImode, ior_optab, lo, tmp, + tgt, 0, OPTAB_WIDEN); + + if (tmp != tgt) + emit_move_insn (tgt, gen_lowpart(GET_MODE (tgt), tmp)); + return; + } + meml = gen_reg_rtx (DImode); memh = gen_reg_rtx (DImode); addr = gen_reg_rtx (DImode); @@ -4225,7 +4251,26 @@ HOST_WIDE_INT size, ofs; { rtx dstl, dsth, addr, insl, insh, meml, memh, dsta; - + + /* For small data types (short and int), it's faster to write out byte-wise, + since that doesn't require any loads. */ + + if (TARGET_BWX && (int) size <= 4) + { + int i; + for (i = 0; i < size; i++) + { + rtx ext = gen_reg_rtx (DImode); + expand_binop (DImode, lshr_optab, src, GEN_INT (i * 8), + ext, 1, OPTAB_WIDEN); + emit_move_insn (adjust_address (dst, QImode, + ofs + (WORDS_BIG_ENDIAN + ? size - i : i)), + gen_lowpart(QImode, ext)); + } + return; + } + dstl = gen_reg_rtx (DImode); dsth = gen_reg_rtx (DImode); insl = gen_reg_rtx (DImode); --=-=-=--