diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2005-07-26 08:07:40 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2005-07-26 08:07:40 +0000 |
commit | 897e6187cf9e656bcc47a0b6a18fe3e662681442 (patch) | |
tree | 20fc7fed30cb4d4f4a55794adaca188c30def5b5 /sys | |
parent | 419143651f705d739b23c94295dc1168df5d7b68 (diff) |
In splraise, change an:
if (x > foo->bar)
foo->bar = x;
to:
foo->bar = MAX(x, foo->bar);
This forces gcc to generate much better code even though both
experessions are equivalent. Normally I wouldn't bother with
microoptimizations like this, but I needed some generated assembler
that uses cmov and splraise used so often..
ok toby@ (well, he ok:ed a diff that didn't use the MAX macro, but it's
the same code)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/intr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c index d8b96d185f7..d04ebb5cdfe 100644 --- a/sys/arch/amd64/amd64/intr.c +++ b/sys/arch/amd64/amd64/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.9 2005/07/18 02:43:24 fgsch Exp $ */ +/* $OpenBSD: intr.c,v 1.10 2005/07/26 08:07:39 art Exp $ */ /* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */ /* @@ -721,8 +721,7 @@ splraise(int nlevel) struct cpu_info *ci = curcpu(); olevel = ci->ci_ilevel; - if (nlevel > olevel) - ci->ci_ilevel = nlevel; + ci->ci_ilevel = MAX(ci->ci_ilevel, nlevel); return (olevel); } |