ANSIify. Use uint<N>_t. Drop trailing whitespace.

Same binary code is generated.
This commit is contained in:
uwe 2005-11-16 23:24:44 +00:00
parent 95355c05c7
commit 8247051e62
8 changed files with 83 additions and 119 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.24 2005/05/31 00:57:40 christos Exp $ */
/* $NetBSD: fpu.c,v 1.25 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2005/05/31 00:57:40 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.25 2005/11/16 23:24:44 uwe Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -72,7 +72,7 @@ fpu_dumpfpn(struct fpn *fp)
printf("%s %c.%x %x %x %xE%d", class[fp->fp_class + 2],
fp->fp_sign ? '-' : ' ',
fp->fp_mant[0], fp->fp_mant[1],
fp->fp_mant[2], fp->fp_mant[3],
fp->fp_mant[2], fp->fp_mant[3],
fp->fp_exp);
}
#endif
@ -294,9 +294,7 @@ fpu_emulate(l, tf, fs)
* multiply two integers this way.
*/
int
fpu_execute(fe, instr)
struct fpemu *fe;
union instr instr;
fpu_execute(struct fpemu *fe, union instr instr)
{
struct fpn *fp;
#ifndef SUN4U
@ -349,7 +347,7 @@ fpu_execute(fe, instr)
#ifdef SUN4U
/*
* Check to see if we're dealing with a fancy cmove and handle
* it first.
* it first.
*/
if (instr.i_op3.i_op3 == IOP3_FPop2 && (opf&0xff0) != (FCMP&0xff0)) {
switch (opf >>= 2) {
@ -383,14 +381,14 @@ fpu_execute(fe, instr)
cond = (curlwp->l_md.md_tf->tf_tstate>>TSTATE_CCR_SHIFT)&PSR_ICC;
if (instr.i_fmovcc.i_cond != cond) return(0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVXC >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVXC\n"));
cond = (curlwp->l_md.md_tf->tf_tstate>>(TSTATE_CCR_SHIFT+XCC_SHIFT))&PSR_ICC;
if (instr.i_fmovcc.i_cond != cond) return(0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRZ\n"));
@ -398,7 +396,7 @@ fpu_execute(fe, instr)
if (rs1 != 0 && (int64_t)curlwp->l_md.md_tf->tf_global[rs1] != 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRLEZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRLEZ\n"));
@ -406,7 +404,7 @@ fpu_execute(fe, instr)
if (rs1 != 0 && (int64_t)curlwp->l_md.md_tf->tf_global[rs1] > 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRLZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRLZ\n"));
@ -414,7 +412,7 @@ fpu_execute(fe, instr)
if (rs1 == 0 || (int64_t)curlwp->l_md.md_tf->tf_global[rs1] >= 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRNZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRNZ\n"));
@ -422,7 +420,7 @@ fpu_execute(fe, instr)
if (rs1 == 0 || (int64_t)curlwp->l_md.md_tf->tf_global[rs1] == 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRGZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRGZ\n"));
@ -430,7 +428,7 @@ fpu_execute(fe, instr)
if (rs1 == 0 || (int64_t)curlwp->l_md.md_tf->tf_global[rs1] <= 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
case FMVRGEZ >> 2:
/* Presume we're curlwp */
DPRINTF(FPE_INSN, ("fpu_execute: FMVRGEZ\n"));
@ -438,10 +436,10 @@ fpu_execute(fe, instr)
if (rs1 != 0 && (int64_t)curlwp->l_md.md_tf->tf_global[rs1] < 0)
return (0); /* success */
rs1 = fs->fs_regs[rs2];
goto mov;
goto mov;
default:
DPRINTF(FPE_INSN,
("fpu_execute: unknown v9 FP inst %x opf %x\n",
DPRINTF(FPE_INSN,
("fpu_execute: unknown v9 FP inst %x opf %x\n",
instr.i_int, opf));
return (NOTFPU);
}
@ -450,7 +448,7 @@ fpu_execute(fe, instr)
switch (opf >>= 2) {
default:
DPRINTF(FPE_INSN,
DPRINTF(FPE_INSN,
("fpu_execute: unknown basic FP inst %x opf %x\n",
instr.i_int, opf));
return (NOTFPU);
@ -474,7 +472,7 @@ fpu_execute(fe, instr)
#else /* SUN4U */
i = 1<<(type-1);
fs->fs_regs[rd++] = rs1;
while (--i > 0)
while (--i > 0)
fs->fs_regs[rd++] = fs->fs_regs[++rs2];
#endif /* SUN4U */
fs->fs_fsr = fe->fe_fsr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_add.c,v 1.5 2003/08/07 16:29:36 agc Exp $ */
/* $NetBSD: fpu_add.c,v 1.6 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.5 2003/08/07 16:29:36 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.6 2005/11/16 23:24:44 uwe Exp $");
#include <sys/types.h>
#ifdef DIAGNOSTIC
@ -62,8 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.5 2003/08/07 16:29:36 agc Exp $");
#include <sparc/fpu/fpu_extern.h>
struct fpn *
fpu_add(fe)
register struct fpemu *fe;
fpu_add(struct fpemu *fe)
{
register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2, *r;
register u_int r0, r1, r2, r3;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_div.c,v 1.4 2003/08/07 16:29:37 agc Exp $ */
/* $NetBSD: fpu_div.c,v 1.5 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.5 2005/11/16 23:24:44 uwe Exp $");
#include <sys/types.h>
@ -150,8 +150,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
*/
struct fpn *
fpu_div(fe)
register struct fpemu *fe;
fpu_div(struct fpemu *fe)
{
register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
register u_int q, bit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_explode.c,v 1.11 2003/08/07 16:29:37 agc Exp $ */
/* $NetBSD: fpu_explode.c,v 1.12 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.11 2003/08/07 16:29:37 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.12 2005/11/16 23:24:44 uwe Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sparc_arch.h"
@ -86,9 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.11 2003/08/07 16:29:37 agc Exp $")
* int -> fpn.
*/
int
fpu_itof(fp, i)
register struct fpn *fp;
register u_int i;
fpu_itof(struct fpn *fp, u_int i)
{
if (i == 0)
@ -113,9 +111,7 @@ fpu_itof(fp, i)
* 64-bit int -> fpn.
*/
int
fpu_xtof(fp, i)
register struct fpn *fp;
register u_int64_t i;
fpu_xtof(struct fpn *fp, uint64_t i)
{
if (i == 0)
@ -175,9 +171,7 @@ fpu_xtof(fp, i)
* format: i.e., needs at most fp_mant[0] and fp_mant[1].
*/
int
fpu_stof(fp, i)
register struct fpn *fp;
register u_int i;
fpu_stof(struct fpn *fp, u_int i)
{
register int exp;
register u_int frac, f0, f1;
@ -195,9 +189,7 @@ fpu_stof(fp, i)
* We assume this uses at most (96-FP_LG) bits.
*/
int
fpu_dtof(fp, i, j)
register struct fpn *fp;
register u_int i, j;
fpu_dtof(struct fpn *fp, u_int i, u_int j)
{
register int exp;
register u_int frac, f0, f1, f2;
@ -216,9 +208,7 @@ fpu_dtof(fp, i, j)
* 128-bit extended -> fpn.
*/
int
fpu_qtof(fp, i, j, k, l)
register struct fpn *fp;
register u_int i, j, k, l;
fpu_qtof(register struct fpn *fp, u_int i, u_int j, u_int k, u_int l)
{
register int exp;
register u_int frac, f0, f1, f2, f3;
@ -244,16 +234,13 @@ fpu_qtof(fp, i, j, k, l)
* operations are performed.)
*/
void
fpu_explode(fe, fp, type, reg)
register struct fpemu *fe;
register struct fpn *fp;
int type, reg;
fpu_explode(struct fpemu *fe, struct fpn *fp, int type, int reg)
{
register u_int s, *space;
#ifdef SUN4U
u_int64_t l, *xspace;
uint64_t l, *xspace;
xspace = (u_int64_t *)&fe->fe_fpstate->fs_regs[reg & ~1];
xspace = (uint64_t *)&fe->fe_fpstate->fs_regs[reg & ~1];
l = xspace[0];
#endif /* SUN4U */
space = &fe->fe_fpstate->fs_regs[reg];
@ -301,10 +288,10 @@ fpu_explode(fe, fp, type, reg)
}
fp->fp_class = s;
DPRINTF(FPE_REG, ("fpu_explode: %%%c%d => ", (type == FTYPE_LNG) ? 'x' :
((type == FTYPE_INT) ? 'i' :
((type == FTYPE_INT) ? 'i' :
((type == FTYPE_SNG) ? 's' :
((type == FTYPE_DBL) ? 'd' :
((type == FTYPE_EXT) ? 'q' : '?')))),
((type == FTYPE_EXT) ? 'q' : '?')))),
reg));
#ifdef DEBUG
if (fpe_debug & FPE_REG) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_extern.h,v 1.7 2003/10/12 19:48:52 pk Exp $ */
/* $NetBSD: fpu_extern.h,v 1.8 2005/11/16 23:24:44 uwe Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@ -54,50 +54,50 @@ struct fpn;
/* fpu.c */
#ifndef SUN4U
int fpu_cleanup __P((struct lwp *, struct fpstate *));
int fpu_emulate __P((struct lwp *, struct trapframe *, struct fpstate *));
int fpu_cleanup(struct lwp *, struct fpstate *);
int fpu_emulate(struct lwp *, struct trapframe *, struct fpstate *);
#else /* SUN4U */
int fpu_cleanup __P((struct lwp *, struct fpstate64 *));
int fpu_emulate __P((struct lwp *, struct trapframe64 *, struct fpstate64 *));
int fpu_cleanup(struct lwp *, struct fpstate64 *);
int fpu_emulate(struct lwp *, struct trapframe64 *, struct fpstate64 *);
#endif /* SUN4U */
int fpu_execute __P((struct fpemu *, union instr));
int fpu_execute(struct fpemu *, union instr);
/* fpu_add.c */
struct fpn *fpu_add __P((struct fpemu *));
struct fpn *fpu_add(struct fpemu *);
/* fpu_compare.c */
void fpu_compare __P((struct fpemu *, int));
void fpu_compare(struct fpemu *, int);
/* fpu_div.c */
struct fpn *fpu_div __P((struct fpemu *));
struct fpn *fpu_div(struct fpemu *);
/* fpu_explode.c */
int fpu_itof __P((struct fpn *, u_int));
int fpu_itof(struct fpn *, u_int);
#ifdef SUN4U
int fpu_xtof __P((struct fpn *, u_int64_t));
int fpu_xtof(struct fpn *, uint64_t);
#endif /* SUN4U */
int fpu_stof __P((struct fpn *, u_int));
int fpu_dtof __P((struct fpn *, u_int, u_int ));
int fpu_qtof __P((struct fpn *, u_int, u_int , u_int , u_int ));
void fpu_explode __P((struct fpemu *, struct fpn *, int, int ));
int fpu_stof(struct fpn *, u_int);
int fpu_dtof(struct fpn *, u_int, u_int );
int fpu_qtof(struct fpn *, u_int, u_int , u_int , u_int );
void fpu_explode(struct fpemu *, struct fpn *, int, int );
/* fpu_implode.c */
u_int fpu_ftoi __P((struct fpemu *, struct fpn *));
u_int fpu_ftoi(struct fpemu *, struct fpn *);
#ifdef SUN4U
u_int fpu_ftox __P((struct fpemu *, struct fpn *, u_int *));
u_int fpu_ftox(struct fpemu *, struct fpn *, u_int *);
#endif /* SUN4U */
u_int fpu_ftos __P((struct fpemu *, struct fpn *));
u_int fpu_ftod __P((struct fpemu *, struct fpn *, u_int *));
u_int fpu_ftoq __P((struct fpemu *, struct fpn *, u_int *));
void fpu_implode __P((struct fpemu *, struct fpn *, int, u_int *));
u_int fpu_ftos(struct fpemu *, struct fpn *);
u_int fpu_ftod(struct fpemu *, struct fpn *, u_int *);
u_int fpu_ftoq(struct fpemu *, struct fpn *, u_int *);
void fpu_implode(struct fpemu *, struct fpn *, int, u_int *);
/* fpu_mul.c */
struct fpn *fpu_mul __P((struct fpemu *));
struct fpn *fpu_mul(struct fpemu *);
/* fpu_sqrt.c */
struct fpn *fpu_sqrt __P((struct fpemu *));
struct fpn *fpu_sqrt(struct fpemu *);
/* fpu_subr.c */
int fpu_shr __P((register struct fpn *, register int));
void fpu_norm __P((register struct fpn *));
struct fpn *fpu_newnan __P((register struct fpemu *));
int fpu_shr(register struct fpn *, register int);
void fpu_norm(register struct fpn *);
struct fpn *fpu_newnan(register struct fpemu *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_implode.c,v 1.12 2003/08/07 16:29:37 agc Exp $ */
/* $NetBSD: fpu_implode.c,v 1.13 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.12 2003/08/07 16:29:37 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.13 2005/11/16 23:24:44 uwe Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sparc_arch.h"
@ -63,8 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.12 2003/08/07 16:29:37 agc Exp $")
#include <sparc/fpu/fpu_emu.h>
#include <sparc/fpu/fpu_extern.h>
static int round __P((register struct fpemu *, register struct fpn *));
static int toinf __P((struct fpemu *, int));
static int round(struct fpemu *, struct fpn *);
static int toinf(struct fpemu *, int);
/*
* Round a number (algorithm from Motorola MC68882 manual, modified for
@ -79,7 +79,7 @@ static int toinf __P((struct fpemu *, int));
* responsibility to fix this if necessary.
*/
static int
round(register struct fpemu *fe, register struct fpn *fp)
round(struct fpemu *fe, struct fpn *fp)
{
register u_int m0, m1, m2, m3;
register int gr, s;
@ -194,9 +194,7 @@ toinf(struct fpemu *fe, int sign)
* of the SPARC instruction set).
*/
u_int
fpu_ftoi(fe, fp)
struct fpemu *fe;
register struct fpn *fp;
fpu_ftoi(struct fpemu *fe, struct fpn *fp)
{
register u_int i;
register int sign, exp;
@ -244,12 +242,9 @@ fpu_ftoi(fe, fp)
* of the SPARC instruction set).
*/
u_int
fpu_ftox(fe, fp, res)
struct fpemu *fe;
register struct fpn *fp;
u_int *res;
fpu_ftox(struct fpemu *fe, struct fpn *fp, u_int *res)
{
register u_int64_t i;
register uint64_t i;
register int sign, exp;
sign = fp->fp_sign;
@ -275,8 +270,8 @@ fpu_ftox(fe, fp, res)
/* NB: the following includes exp < 0 cases */
if (fpu_shr(fp, FP_NMANT - 1 - exp) != 0)
fe->fe_cx |= FSR_NX;
i = ((u_int64_t)fp->fp_mant[2]<<32)|fp->fp_mant[3];
if (i >= ((u_int64_t)0x8000000000000000LL + sign))
i = ((uint64_t)fp->fp_mant[2]<<32)|fp->fp_mant[3];
if (i >= ((uint64_t)0x8000000000000000LL + sign))
break;
if (sign) i = -i;
res[1] = (int)i;
@ -296,9 +291,7 @@ fpu_ftox(fe, fp, res)
* We assume <= 29 bits in a single-precision fraction (1.f part).
*/
u_int
fpu_ftos(fe, fp)
struct fpemu *fe;
register struct fpn *fp;
fpu_ftos(struct fpemu *fe, struct fpn *fp)
{
register u_int sign = fp->fp_sign << 31;
register int exp;
@ -380,10 +373,7 @@ done:
* This code mimics fpu_ftos; see it for comments.
*/
u_int
fpu_ftod(fe, fp, res)
struct fpemu *fe;
register struct fpn *fp;
u_int *res;
fpu_ftod(struct fpemu *fe, struct fpn *fp, u_int *res)
{
register u_int sign = fp->fp_sign << 31;
register int exp;
@ -441,10 +431,7 @@ done:
* so we can avoid a small bit of work.
*/
u_int
fpu_ftoq(fe, fp, res)
struct fpemu *fe;
register struct fpn *fp;
u_int *res;
fpu_ftoq(struct fpemu *fe, struct fpn *fp, u_int *res)
{
register u_int sign = fp->fp_sign << 31;
register int exp;
@ -501,11 +488,7 @@ done:
* Implode an fpn, writing the result into the given space.
*/
void
fpu_implode(fe, fp, type, space)
struct fpemu *fe;
register struct fpn *fp;
int type;
register u_int *space;
fpu_implode(struct fpemu *fe, struct fpn *fp, int type, u_int *space)
{
DPRINTF(FPE_REG, ("\n imploding: "));
@ -541,10 +524,10 @@ fpu_implode(fe, fp, type, space)
panic("fpu_implode");
}
#ifdef SUN4U
DPRINTF(FPE_REG, ("fpu_implode: %x %x %x %x\n",
DPRINTF(FPE_REG, ("fpu_implode: %x %x %x %x\n",
space[0], space[1], space[2], space[3]));
#else
DPRINTF(FPE_REG, ("fpu_implode: %x %x\n",
DPRINTF(FPE_REG, ("fpu_implode: %x %x\n",
space[0], space[1]));
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_mul.c,v 1.4 2003/08/07 16:29:37 agc Exp $ */
/* $NetBSD: fpu_mul.c,v 1.5 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.5 2005/11/16 23:24:44 uwe Exp $");
#include <sys/types.h>
@ -99,8 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
* until we reach a nonzero word.
*/
struct fpn *
fpu_mul(fe)
register struct fpemu *fe;
fpu_mul(struct fpemu *fe)
{
register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
register u_int a3, a2, a1, a0, x3, x2, x1, x0, bit, m;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_sqrt.c,v 1.4 2003/08/07 16:29:37 agc Exp $ */
/* $NetBSD: fpu_sqrt.c,v 1.5 2005/11/16 23:24:44 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.5 2005/11/16 23:24:44 uwe Exp $");
#include <sys/types.h>
@ -186,8 +186,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.4 2003/08/07 16:29:37 agc Exp $");
* this, so we have some justification in assuming it.
*/
struct fpn *
fpu_sqrt(fe)
struct fpemu *fe;
fpu_sqrt(struct fpemu *fe)
{
register struct fpn *x = &fe->fe_f1;
register u_int bit, q, tt;