[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0811241854520.3793@ftp.linux-mips.org>
Date:	Mon, 24 Nov 2008 19:04:40 +0000 (GMT)
From:	"Maciej W. Rozycki" <macro@...ux-mips.org>
To:	Ralf Baechle <ralf@...ux-mips.org>
cc:	Geert Uytterhoeven <geert@...ux-m68k.org>,
	David Daney <ddaney@...iumnetworks.com>, gcc@....gnu.org,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	linux-mips <linux-mips@...ux-mips.org>,
	linux-kernel@...r.kernel.org,
	Adam Nemet <anemet@...iumnetworks.com>
Subject: Re: [PATCH] MIPS: Make BUG() __noreturn.
On Fri, 21 Nov 2008, Ralf Baechle wrote:
> MIPS ISA newer than MIPS I also have conditional break codes allowing
> something like this:
> 
> #define BUG_ON(condition)                                               \
> do {                                                                    \
>         __asm__ __volatile__("tne $0, %0, %1"                           \
>                              : : "r" (condition), "i" (BRK_BUG));       \
> } while (0)
> 
> that is test of condition and the trap as a single instruction.  Note there
> are break and trap instructions on MIPS and they are basically doing the
> same job ...
 GCC is actually smart enough to combine sequences like:
if (something)
	__builtin_trap();
into appropriate conditional trap instructions on MIPS.  As noted by David 
trap codes other than the default cannot be emitted this way though.
  Maciej
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists