From owner-freebsd-mips@FreeBSD.ORG Sat Jun 13 22:41:35 2015 Return-Path: Delivered-To: freebsd-mips@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61BB0B90 for ; Sat, 13 Jun 2015 22:41:35 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EBAB2E2 for ; Sat, 13 Jun 2015 22:41:35 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iecrd14 with SMTP id rd14so11313981iec.3 for ; Sat, 13 Jun 2015 15:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=+271wmPuRYr+o1bcHhJHwnXZJi8UQZbQQF1pFecKU0o=; b=YhKxXrpWWrCdLsr1P0Jh5OnYwwePtrababyg9XfLe/vqG5LT9RNqPFNoRwsWXvkUi1 S8I00wnuhGsX5NLfZ9yjFD9qi/14r1fW8yzTZczys67lx4abe6P3R+PKDQHotR/GdZfo P+94mfQY3y320UkvsquYk8lrNPvS7B/ZjpGxpj/ZHzpg/KS/gVAlJfZ1rVSUud0Tuqcn Dn6XDdBgqxEuK1IAA5KjLGVOs9gvI19nK74+WA6biZIgguC+55+BLGt1ij1Ecwr2ONNG z4sv/kLmp0ANOUxiW6ZuOl84t/sO7zclh+i8J4aV9Im/lhx//ZEeUZ4GwBzbS58wRnAN dWzg== MIME-Version: 1.0 X-Received: by 10.107.5.210 with SMTP id 201mr25585455iof.88.1434235294444; Sat, 13 Jun 2015 15:41:34 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.38.133 with HTTP; Sat, 13 Jun 2015 15:41:34 -0700 (PDT) Date: Sat, 13 Jun 2015 15:41:34 -0700 X-Google-Sender-Auth: 8G2rYGh26nWLFk6QuCUVytJt3uU Message-ID: Subject: [rfc] fix umul_ppmm() in our libgcc From: Adrian Chadd To: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2015 22:41:35 -0000 Hi, our libgcc in -base is very .. old. It chokes when compiling for mips32. This patch seems to do the right thing. Does anyone have any positive/negative feedback? Thanks, -adrian Index: contrib/gcc/longlong.h =================================================================== --- contrib/gcc/longlong.h (revision 284090) +++ contrib/gcc/longlong.h (working copy) @@ -584,11 +584,11 @@ #if defined (__mips__) && W_TYPE_SIZE == 32 #define umul_ppmm(w1, w0, u, v) \ - __asm__ ("multu %2,%3" \ - : "=l" ((USItype) (w0)), \ - "=h" ((USItype) (w1)) \ - : "d" ((USItype) (u)), \ - "d" ((USItype) (v))) + do { \ + UDItype __ll = (UDItype)(u) * (v); \ + w1 = __ll >> 32; \ + w0 = __ll; \ + } while (0) #define UMUL_TIME 10 #define UDIV_TIME 100 #endif /* __mips__ */