From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3496 invoked by alias); 21 May 2003 18:50:39 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 3421 invoked from network); 21 May 2003 18:50:37 -0000 Received: from unknown (HELO ns2.uk.superh.com) (193.128.105.170) by sources.redhat.com with SMTP; 21 May 2003 18:50:37 -0000 Received: from sh-uk-ex01.uk.w2k.superh.com (sh-uk-ex01 [192.168.16.17]) by ns2.uk.superh.com (8.11.6+Sun/8.11.6) with ESMTP id h4LImRb05438; Wed, 21 May 2003 19:48:27 +0100 (BST) Received: from superh.com ([192.168.16.50]) by sh-uk-ex01.uk.w2k.superh.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 21 May 2003 19:50:54 +0100 Message-ID: <3ECBCA79.87C5A04A@superh.com> Date: Wed, 21 May 2003 18:50:00 -0000 From: Joern Rennecke Organization: SuperH UK Ltd. X-Accept-Language: en MIME-Version: 1.0 To: Doug Evans CC: cgen@sources.redhat.com Subject: Re: RFA: sh64-media.cpu : msad.ubq has unsigned inputs. References: <3ECBA8E5.C5CE3F41@superh.com> <16075.45848.115087.832045@casey.transmeta.com> Content-Type: multipart/mixed; boundary="------------A42F8D0F61E9926F93B8FA90" X-OriginalArrivalTime: 21 May 2003 18:50:54.0913 (UTC) FILETIME=[E8AE4B10:01C31FC9] X-SW-Source: 2003-q2/txt/msg00057.txt.bz2 This is a multi-part message in MIME format. --------------A42F8D0F61E9926F93B8FA90 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1376 Doug Evans wrote: > I _think_ the problem centers around the implicit widening > in the original code. The subtraction is done in QImode > and a QImode value is subsequently added to a DImode value. Well, it's more due to a missed explicit widening. > [Digression: > In a world in which Umodes don't exist, implicit widening operations > should probably be disallowed, though part of me will loathe the extra > amount of typing required.] It would be unlogical to have to write zero-extensions different from sign-extensions. So, since the mode doesn't have signedness information, implicit widening would be missing that information. > I don't know the architecture, so I don't know what the desired effect > of (abs DI (some-QI-value)) is. Making a wild guess, what about > something like: > > - (set acc (abs DI (sub (subword QI rm 0) (subword QI rn 0)))) > + (set acc (zext DI (abs QI (sub (subword QI rm 0) (subword QI rn 0))))) > > Or maybe it's > - (set acc (abs DI (sub (subword QI rm 0) (subword QI rn 0)))) > + (set acc (zext DI (sub (subword QI rm 0) (subword QI rn 0)))) > > [and so on for the rest of the bytes] No, the zero-extension should happen before the subtraction. -- -------------------------- SuperH (UK) Ltd. 2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX T:+44 1454 465658 --------------A42F8D0F61E9926F93B8FA90 Content-Type: text/plain; charset=us-ascii; name="msad-diff-2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msad-diff-2" Content-length: 2996 2003-05-21 J"orn Rennecke * sh64-media.cpu (msad.ubq): Inputs are unsigned bytes. Index: sh64-media.cpu =================================================================== RCS file: /cvs/src/src/cgen/cpu/sh64-media.cpu,v retrieving revision 1.5 diff -p -r1.5 sh64-media.cpu *** sh64-media.cpu 21 May 2003 14:10:46 -0000 1.5 --- sh64-media.cpu 21 May 2003 18:48:32 -0000 *************** *** 1,6 **** ; SuperH SHmedia instruction set description. -*- Scheme -*- ; Copyright (C) 2000, 2001 Red Hat, Inc. ! ; Copyright (C) 2002 SuperH Ltd ; This file is part of CGEN. ; See file COPYING.CGEN for details. --- 1,6 ---- ; SuperH SHmedia instruction set description. -*- Scheme -*- ; Copyright (C) 2000, 2001 Red Hat, Inc. ! ; Copyright (C) 2002, 2003 SuperH Ltd ; This file is part of CGEN. ; See file COPYING.CGEN for details. *************** *** 1275,1290 **** () "msad.ubq $rm, $rn, $rd" (+ (f-op 18) rm (f-ext 0) rn rd (f-rsvd 0)) ! (sequence ((DI acc)) ! (set acc (abs DI (sub (subword QI rm 0) (subword QI rn 0)))) ! (set acc (add DI acc (abs (sub (subword QI rm 1) (subword QI rn 1))))) ! (set acc (add DI acc (abs (sub (subword QI rm 2) (subword QI rn 2))))) ! (set acc (add DI acc (abs (sub (subword QI rm 3) (subword QI rn 3))))) ! (set acc (add DI acc (abs (sub (subword QI rm 4) (subword QI rn 4))))) ! (set acc (add DI acc (abs (sub (subword QI rm 5) (subword QI rn 5))))) ! (set acc (add DI acc (abs (sub (subword QI rm 6) (subword QI rn 6))))) ! (set acc (add DI acc (abs (sub (subword QI rm 7) (subword QI rn 7))))) ! (set rd (add rd acc)))) (define-pmacro (-mshaldsl arg) (saturate SI 32 (sll DI arg (and rn 31)))) (dshmi mshaldsl "Multimedia saturating arithmetic left shift (long word)" --- 1275,1298 ---- () "msad.ubq $rm, $rn, $rd" (+ (f-op 18) rm (f-ext 0) rn rd (f-rsvd 0)) ! (sequence ((SI acc)) ! (set acc (abs (sub (zext SI (subword QI rm 0)) ! (zext SI (subword QI rn 0))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 1)) ! (zext SI (subword QI rn 1)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 2)) ! (zext SI (subword QI rn 2)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 3)) ! (zext SI (subword QI rn 3)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 4)) ! (zext SI (subword QI rn 4)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 5)) ! (zext SI (subword QI rn 5)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 6)) ! (zext SI (subword QI rn 6)))))) ! (set acc (add acc (abs (sub (zext SI (subword QI rm 7)) ! (zext SI (subword QI rn 7)))))) ! (set rd (add rd (zext DI acc))))) (define-pmacro (-mshaldsl arg) (saturate SI 32 (sll DI arg (and rn 31)))) (dshmi mshaldsl "Multimedia saturating arithmetic left shift (long word)" --------------A42F8D0F61E9926F93B8FA90--