summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2005-07-26 08:07:39 +0000
committerart <art@openbsd.org>2005-07-26 08:07:39 +0000
commitb8befa4601d82538f76a734d6b2af0120b4c7e4c (patch)
tree98f0a9f5ed1b8f877fe8ccfb7a8dc0105a48379f
parentAdd _PROF_PROLOGUE to Xspllower since it's so common in kernel profiles. (diff)
downloadwireguard-openbsd-b8befa4601d82538f76a734d6b2af0120b4c7e4c.tar.xz
wireguard-openbsd-b8befa4601d82538f76a734d6b2af0120b4c7e4c.zip
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)
-rw-r--r--sys/arch/amd64/amd64/intr.c5
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);
}