From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102157 invoked by alias); 4 Sep 2017 21:05:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 102144 invoked by uid 89); 4 Sep 2017 21:05:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=2s, uwi X-HELO: mail-ua0-f180.google.com Received: from mail-ua0-f180.google.com (HELO mail-ua0-f180.google.com) (209.85.217.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Sep 2017 21:05:37 +0000 Received: by mail-ua0-f180.google.com with SMTP id s15so3990146uag.1 for ; Mon, 04 Sep 2017 14:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DZo7XoIwC6fWomtUqwC3u+uzPNXc2nrFB1akbvcDshw=; b=VqQi1Tmea/iOJO34JyAtEKlGV5VE31XeWufVDOGdCIoBu7qOlI994QCxYrVmBybcT1 NBjgEd74S6M94KIgJLx0UHDJm0MO/jhYIy1Shs/9G9/zMrTGQRLFomKkg2KNFaS5sIFn qK80XsLYlMcdAjXFYnguDdn92UKkXRTFjJJkpe8CXuYH+ujKwJtBEW3dHOvhMbM/RQ4q 9U1ix7gQm5GMYAQyaW2ZtPDy5CNmrCCU5FQo4ERYlLpmS6W8GCbfuvRf6WDVpvo77ozi puQv/DNfuhcXP2bufxNv0KWZyrjcUBBq2V61Q+rZSVI4q5YK4YXBnUTzZmQ1zGUPwl1h 4AaQ== X-Gm-Message-State: AHPjjUjnt50HATuPhivoRNydeYNJizqf8yF39OOAYOJToRY+jJz62LAU vWVpHEJ1oD1nZ/lHAHD3uaVKlngTlg== X-Google-Smtp-Source: ADKCNb4yMxEroQvJY3JviXsVaoEBdMx2XOLRpKS+uNn0hpok123uAT3PCLFKZ+hIvqODKVpvOlLaGxT30JH8DaNaXNQ= X-Received: by 10.159.33.195 with SMTP id 61mr1158025uac.63.1504559135688; Mon, 04 Sep 2017 14:05:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.48.136 with HTTP; Mon, 4 Sep 2017 14:05:15 -0700 (PDT) In-Reply-To: <928e7c188eeeff635bc129ba7042d21b@polymtl.ca> References: <700407e5797b8b9b9f76b2dba026d1b06978987b.1496066478.git.shorne@gmail.com> <928e7c188eeeff635bc129ba7042d21b@polymtl.ca> From: Stafford Horne Date: Mon, 04 Sep 2017 21:05:00 -0000 Message-ID: Subject: Re: [PATCH v4 2/5] sim: cgen: add MUL2OFSI and MUL1OFSI macros (needed for OR1K l.mul[u]) To: Simon Marchi Cc: GDB patches , Openrisc , Mike Frysinger , Peter Gavin Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00069.txt.bz2 On Tue, Sep 5, 2017 at 5:32 AM, Simon Marchi wrote: >> --- a/sim/common/cgen-ops.h >> +++ b/sim/common/cgen-ops.h >> @@ -631,6 +631,22 @@ SUBOFQI (QI a, QI b, BI c) >> return res; >> } >> >> +SEMOPS_INLINE BI >> +MUL2OFSI (SI a, SI b) >> +{ >> + DI tmp = MULDI (EXTSIDI(a), EXTSIDI(b)); >> + BI res = tmp < -0x80000000LL || tmp > 0x7fffffffLL; >> + return res; >> +} >> + >> +SEMOPS_INLINE BI >> +MUL1OFSI (USI a, USI b) >> +{ >> + UDI tmp = MULDI (ZEXTSIDI(a), ZEXTSIDI(b)); >> + BI res = (tmp > 0xFFFFFFFFULL); >> + return res; >> +} > > > What are these functions expected to return? They seem to return 1 when the > result would overflow 32-bits, but just to be sure. They do just return 1 when there is overflow. They are used in: cpu/or1korbis.cpu To calculate the overflow and carry flags. ; 2's complement overflow (set sys-sr-ov (mul-o2flag WI rA (ext WI simm16))) ; 1's complement overflow (set sys-sr-cy (mul-o1flag UWI rA (ext UWI simm16))) Thanks for pointing this out though the ChangeLog says "New macro, 1's complement." I think it should mention "New macro, 1's complement _overflow_."