Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 2 Apr 2002 18:00:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 2 Apr 2002 18:00:06 -0500 Received: from are.twiddle.net ([64.81.246.98]:35992 "EHLO are.twiddle.net") by vger.kernel.org with ESMTP id ; Tue, 2 Apr 2002 17:59:59 -0500 Date: Tue, 2 Apr 2002 14:59:55 -0800 From: Richard Henderson To: Michal Moskal Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gcc-3.1 ffs problem, kernel 2.4.18 Message-ID: <20020402145955.A12932@twiddle.net> Mail-Followup-To: Michal Moskal , torvalds@transmeta.com, linux-kernel@vger.kernel.org In-Reply-To: <20020320174238.GA13533@ep09.kernel.pl> <20020328211025.A30037@twiddle.net> <20020329115731.GA3227@ep09.kernel.pl> <20020329144232.A495@twiddle.net> <20020402114848.GA9004@ep09.kernel.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 02, 2002 at 01:48:48PM +0200, Michal Moskal wrote: > Could you please check if it compiles for you? Ah, I see the bug. I was looking at ffz (which is correct), not ffs (which isn't). > __asm__("bsfl %1,%0\n\t" > "jnz 1f\n\t" > "movl $-1,%0\n" > "1:" : "=r" (r) : "g" (x)); The problem is ^^^ That sez any of register, memory, or immediate is ok. It should be "r" instead, just like in ffz. That said, we should probably be using __builtin_ffs instead. The compiler knows how to do bsfl plus the adjustment. Plus, it knows how to evaluate it at compile-time for constants. r~ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/