Module Name: src Committed By: matt Date: Sun Jun 19 07:59:47 UTC 2011
Modified Files: src/sys/arch/amigappc/amigappc: pic_amiga.c src/sys/arch/macppc/macppc: pic_heathrow.c pic_ohare.c src/sys/arch/powerpc/oea: pmap.c src/sys/arch/rs6000/rs6000: pic_iocc.c Log Message: Use __builtin_clz instead of cntlzw To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amigappc/amigappc/pic_amiga.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/macppc/pic_heathrow.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/macppc/pic_ohare.c cvs rdiff -u -r1.79 -r1.80 src/sys/arch/powerpc/oea/pmap.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/rs6000/rs6000/pic_iocc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amigappc/amigappc/pic_amiga.c diff -u src/sys/arch/amigappc/amigappc/pic_amiga.c:1.2 src/sys/arch/amigappc/amigappc/pic_amiga.c:1.3 --- src/sys/arch/amigappc/amigappc/pic_amiga.c:1.2 Tue Feb 2 19:15:33 2010 +++ src/sys/arch/amigappc/amigappc/pic_amiga.c Sun Jun 19 07:59:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_amiga.c,v 1.2 2010/02/02 19:15:33 phx Exp $ */ +/* $NetBSD: pic_amiga.c,v 1.3 2011/06/19 07:59:47 matt Exp $ */ /*- * Copyright (c) 2008,2009,2010 Frank Wille. @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic_amiga.c,v 1.2 2010/02/02 19:15:33 phx Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_amiga.c,v 1.3 2011/06/19 07:59:47 matt Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -104,7 +104,7 @@ if (!(dmask & ~(iplmask - 1))) { /* Lower the emulated PPC IPL to the next highest */ - newipl = 31 - cntlzw(dmask); + newipl = 31 - __builtin_clz(dmask); P5write(P5_IPL_EMU, P5_SET_CLEAR | P5_DISABLE_INT | (newipl ^ P5_IPL_MASK)); P5write(P5_IPL_EMU, P5_DISABLE_INT | newipl); Index: src/sys/arch/macppc/macppc/pic_heathrow.c diff -u src/sys/arch/macppc/macppc/pic_heathrow.c:1.5 src/sys/arch/macppc/macppc/pic_heathrow.c:1.6 --- src/sys/arch/macppc/macppc/pic_heathrow.c:1.5 Mon Dec 20 00:25:37 2010 +++ src/sys/arch/macppc/macppc/pic_heathrow.c Sun Jun 19 07:59:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_heathrow.c,v 1.5 2010/12/20 00:25:37 matt Exp $ */ +/* $NetBSD: pic_heathrow.c,v 1.6 2011/06/19 07:59:47 matt Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.5 2010/12/20 00:25:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_heathrow.c,v 1.6 2011/06/19 07:59:47 matt Exp $"); #include "opt_interrupt.h" @@ -232,14 +232,14 @@ return 255; if (heathrow->pending_events_l != 0) { - bit = 31 - cntlzw(heathrow->pending_events_l); + bit = 31 - __builtin_clz(heathrow->pending_events_l); mask = 1 << bit; heathrow->pending_events_l &= ~mask; return bit; } if (heathrow->pending_events_h != 0) { - bit = 31 - cntlzw(heathrow->pending_events_h); + bit = 31 - __builtin_clz(heathrow->pending_events_h); mask = 1 << bit; heathrow->pending_events_h &= ~mask; return bit + 32; Index: src/sys/arch/macppc/macppc/pic_ohare.c diff -u src/sys/arch/macppc/macppc/pic_ohare.c:1.8 src/sys/arch/macppc/macppc/pic_ohare.c:1.9 --- src/sys/arch/macppc/macppc/pic_ohare.c:1.8 Mon Dec 20 00:25:37 2010 +++ src/sys/arch/macppc/macppc/pic_ohare.c Sun Jun 19 07:59:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_ohare.c,v 1.8 2010/12/20 00:25:37 matt Exp $ */ +/* $NetBSD: pic_ohare.c,v 1.9 2011/06/19 07:59:47 matt Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic_ohare.c,v 1.8 2010/12/20 00:25:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_ohare.c,v 1.9 2011/06/19 07:59:47 matt Exp $"); #include "opt_interrupt.h" @@ -236,7 +236,7 @@ if (ohare->pending_events == 0) return 255; - bit = 31 - cntlzw(ohare->pending_events); + bit = 31 - __builtin_clz(ohare->pending_events); mask = 1 << bit; if ((ohare->pending_events & ~mask) == 0) { @@ -252,7 +252,7 @@ evt = ohare->pending_events & ~mask; prio = ohare->priority_masks[bit]; while (evt != 0) { - bit = 31 - cntlzw(evt); + bit = 31 - __builtin_clz(evt); prio |= ohare->priority_masks[bit]; evt &= ~(1 << bit); #ifdef OHARE_DEBUG @@ -261,7 +261,7 @@ panic("hanging in ohare_get_irq"); #endif } - lvl = 31 - cntlzw(prio); + lvl = 31 - __builtin_clz(prio); evt = ohare->pending_events & ohare->irqs[lvl]; if (evt == 0) { @@ -270,7 +270,7 @@ evt = ohare->pending_events; } - bit = 31 - cntlzw(evt); + bit = 31 - __builtin_clz(evt); mask = 1 << bit; ohare->pending_events &= ~mask; return bit; @@ -306,7 +306,7 @@ for (i = 0; i < OHARE_NIRQ; i++) { if (ohare->priority_masks[i] == 0) continue; - level = 31 - cntlzw(ohare->priority_masks[i]); + level = 31 - __builtin_clz(ohare->priority_masks[i]); ohare->irqs[level] |= (1 << i); } } Index: src/sys/arch/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.79 src/sys/arch/powerpc/oea/pmap.c:1.80 --- src/sys/arch/powerpc/oea/pmap.c:1.79 Mon May 2 01:49:23 2011 +++ src/sys/arch/powerpc/oea/pmap.c Sun Jun 19 07:59:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.79 2011/05/02 01:49:23 matt Exp $ */ +/* $NetBSD: pmap.c,v 1.80 2011/06/19 07:59:47 matt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.79 2011/05/02 01:49:23 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.80 2011/06/19 07:59:47 matt Exp $"); #define PMAP_NOOPNAMES @@ -83,10 +83,11 @@ #include <uvm/uvm.h> -#include <machine/pcb.h> #include <machine/powerpc.h> -#include <powerpc/spr.h> #include <powerpc/bat.h> +#include <powerpc/pcb.h> +#include <powerpc/psl.h> +#include <powerpc/spr.h> #include <powerpc/stdarg.h> #include <powerpc/oea/spr.h> #include <powerpc/oea/sr_601.h> @@ -3416,7 +3417,7 @@ :: "r"((uintptr_t)pmap_pteg_table | (pmap_pteg_mask >> 10))); #elif defined (PMAP_OEA64) || defined (PMAP_OEA64_BRIDGE) __asm __volatile ("sync; mtsdr1 %0; isync" - :: "r"((uintptr_t)pmap_pteg_table | (32 - cntlzw(pmap_pteg_mask >> 11)))); + :: "r"((uintptr_t)pmap_pteg_table | (32 - __builtin_clz(pmap_pteg_mask >> 11)))); #endif tlbia(); Index: src/sys/arch/rs6000/rs6000/pic_iocc.c diff -u src/sys/arch/rs6000/rs6000/pic_iocc.c:1.2 src/sys/arch/rs6000/rs6000/pic_iocc.c:1.3 --- src/sys/arch/rs6000/rs6000/pic_iocc.c:1.2 Mon Apr 28 20:23:34 2008 +++ src/sys/arch/rs6000/rs6000/pic_iocc.c Sun Jun 19 07:59:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_iocc.c,v 1.2 2008/04/28 20:23:34 martin Exp $ */ +/* $NetBSD: pic_iocc.c,v 1.3 2011/06/19 07:59:46 matt Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.2 2008/04/28 20:23:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.3 2011/06/19 07:59:46 matt Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -93,7 +93,7 @@ if (rv == 0) return 255; - irq = 31 - cntlzw(rv); + irq = 31 - __builtin_clz(rv); if (irq >= 0 && irq < 16) return irq; return 255;