Change dumb DELAY(9) macro into inline version with asm like

other mips ports for gcc4's aggressive optimization.
This commit is contained in:
tsutsui 2006-09-10 11:12:20 +00:00
parent f4ec8156e1
commit aca8f57145
3 changed files with 31 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.10 2005/12/11 12:17:33 christos Exp $ */
/* $NetBSD: param.h,v 1.11 2006/09/10 11:12:20 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -134,9 +134,17 @@
#ifdef _KERNEL
#ifndef _LOCORE
extern void delay(int);
void delay(int);
extern int cpuspeed;
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
static __inline void __attribute__((__unused__))
DELAY(int n)
{
register int __N = cpuspeed * n;
do {
__asm("addiu %0,%1,-1" : "=r" (__N) : "0" (__N));
} while (__N > 0);
}
#include <machine/intr.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.5 2005/12/11 12:18:13 christos Exp $ */
/* $NetBSD: param.h,v 1.6 2006/09/10 11:12:20 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -136,7 +136,15 @@
extern void delay __P((int n));
extern int cpuspeed;
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
static __inline void __attribute__((__unused__))
DELAY(int n)
{
register int __N = cpuspeed * n;
do {
__asm("addiu %0,%1,-1" : "=r" (__N) : "0" (__N));
} while (__N > 0);
}
#endif /* !_LOCORE */
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.37 2005/12/11 12:18:39 christos Exp $ */
/* $NetBSD: param.h,v 1.38 2006/09/10 11:12:20 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -133,11 +133,18 @@
void delay __P((int n));
extern int cpuspeed;
#define DELAY(n) { int N = cpuspeed * (n); while (--N > 0); }
static __inline void __attribute__((__unused__))
DELAY(int n)
{
register int __N = cpuspeed * n;
do {
__asm("addiu %0,%1,-1" : "=r" (__N) : "0" (__N));
} while (__N > 0);
}
#include <machine/intr.h>
#endif /* !_LOCORE */
#endif /* _KERNEL */