From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46274 invoked by alias); 27 Jul 2017 06:50:12 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 45391 invoked by uid 89); 27 Jul 2017 06:49:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,FOREIGN_BODY,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 spammy=H*f:nBdyaTNAPMOGd, H*f:yXCZAP3qT9NTr4, H*f:sk:EoBd2w9, fno-builtin X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Jul 2017 06:49:04 +0000 Received: from [88.198.220.131] (helo=sslproxy02.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dacbU-0007c0-GJ; Thu, 27 Jul 2017 08:49:00 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dacbU-0006c6-72; Thu, 27 Jul 2017 08:49:00 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id CC8192A001D; Thu, 27 Jul 2017 08:49:08 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Fo46cVEtMmHJ; Thu, 27 Jul 2017 08:49:06 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 9458B2A004F; Thu, 27 Jul 2017 08:49:06 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uZ0Z9-cVbbu7; Thu, 27 Jul 2017 08:49:06 +0200 (CEST) Received: from [192.168.96.129] (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 7C7242A001D; Thu, 27 Jul 2017 08:49:06 +0200 (CEST) Subject: Re: [PATCH v2 3/3] Add ffsl(), ffsll(), fls(), flsl(), flsll() To: Kito Cheng , newlib@sourceware.org References: <20170704133435.9840-3-sebastian.huber@embedded-brains.de> <20170705085414.12755-1-sebastian.huber@embedded-brains.de> <20170705112609.GD30902@calimero.vinschen.de> From: Sebastian Huber Message-ID: Date: Thu, 27 Jul 2017 06:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00661.txt.bz2 On 27/07/17 03:40, Kito Cheng wrote: > Hi > > I am testing with RISC-V with newlib/trunk and just hang on ffs, > after investigate, I saw gcc just generate a ffs call in ffs for riscv64 > and I guess riscv64 is not the only target will hit this bug, > so maybe we can revert the part of this patch, at least for ffs.c? > > Code gen by riscv64-elf-gcc: > .file "ffs.c" > .option nopic > .globl ffs > .text > .align 1 > .globl ffs > .type ffs, @function > ffs: > add sp,sp,-16 > sd ra,8(sp) > call ffs > ld ra,8(sp) > sext.w a0,a0 > add sp,sp,16 > jr ra > .size ffs, .-ffs > .ident "GCC: (GNU) 8.0.0 20170509 (experimental)" I get: /build/git-build/b-gcc-git-riscv32-rtems4.12/./gcc/xgcc=20 -B/build/git-build/b-gcc-git-riscv32-rtems4.12/./gcc/ -S -o - -O2 ffs.c=20 -fno-builtin .file "ffs.c" .option nopic .globl __ffssi2 .text .align 1 .globl ffs .type ffs, @function ffs: add sp,sp,-16 sw ra,12(sp) call __ffssi2 lw ra,12(sp) add sp,sp,16 jr ra .size ffs, .-ffs .ident "GCC: (GNU) 8.0.0 20170727 (experimental) Why does your GCC emit the call to ffs()? > > On Wed, Jul 5, 2017 at 7:26 PM, Corinna Vinschen wr= ote: >> On Jul 5 10:54, Sebastian Huber wrote: >>> Use compiler builtin for ffs(). Remove duplicate implementation from >>> Cygwin. >>> >>> Signed-off-by: Sebastian Huber >>> --- >>> newlib/libc/misc/ffs.c | 14 ++------- >>> newlib/libc/string/Makefile.am | 5 ++++ >>> newlib/libc/string/Makefile.in | 64 +++++++++++++++++++++++++++++++++= --------- >>> newlib/libc/string/ffsl.c | 34 ++++++++++++++++++++++ >>> newlib/libc/string/ffsll.c | 34 ++++++++++++++++++++++ >>> newlib/libc/string/fls.c | 38 +++++++++++++++++++++++++ >>> newlib/libc/string/flsl.c | 38 +++++++++++++++++++++++++ >>> newlib/libc/string/flsll.c | 38 +++++++++++++++++++++++++ >>> winsup/cygwin/syscalls.cc | 22 --------------- >>> 9 files changed, 240 insertions(+), 47 deletions(-) >>> create mode 100644 newlib/libc/string/ffsl.c >>> create mode 100644 newlib/libc/string/ffsll.c >>> create mode 100644 newlib/libc/string/fls.c >>> create mode 100644 newlib/libc/string/flsl.c >>> create mode 100644 newlib/libc/string/flsll.c >> Patchset looks good, please push. >> >> For Cygwin we also need to add the new fls* entry points to >> common.din and to the docs. I'll do that later, when you >> pushed your patch. >> >> >> Thanks, >> Corinna >> >> -- >> Corinna Vinschen >> Cygwin Maintainer >> Red Hat --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=C3=A4ftliche Mitteilung im Sinne des EHUG.