[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428304366.2775.98.camel@perches.com>
Date: Mon, 06 Apr 2015 00:12:46 -0700
From: Joe Perches <joe@...ches.com>
To: Nicholas Mc Guire <der.herr@...r.at>
Cc: Nicholas Mc Guire <hofrat@...dl.org>,
Michal Marek <mmarek@...e.cz>,
Masahiro Yamada <yamada.m@...panasonic.com>,
Sam Ravnborg <sam@...nborg.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Alvin" <hpa@...or.com>,
John Stultz <john.stultz@...aro.org>,
Andrew Hunter <ahh@...gle.com>, Paul Turner <pjt@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] time: allow gcc to fold constants when using
msecs_to_jiffies
On Mon, 2015-04-06 at 08:40 +0200, Nicholas Mc Guire wrote:
> #define msecs_to_jiffies(m) \
> (__builtin_constant_p (m) \
> ? ((m) * HZ / MSECS_PER_SEC ) : __msecs_to_jiffies(m))
[]
> main:
> .LFB12:
> .cfi_startproc
> subq $8, %rsp #,
> .cfi_def_cfa_offset 16
> movl $10, %esi #,
> movl $.LC0, %edi #,
> xorl %eax, %eax #
> call printf #
vs:
> static inline unsigned long msecs_to_jiffies(int m)
> {
> return __builtin_constant_p (m) ?
> (m) * HZ / MSECS_PER_SEC : __msecs_to_jiffies(m);
> }
[]
> main:
> .LFB13:
> .cfi_startproc
> subq $8, %rsp #,
> .cfi_def_cfa_offset 16
> xorl %esi, %esi #
> movl $.LC0, %edi #,
> xorl %eax, %eax #
> call printf #
>
> giving it another run from scratch somewhere I simply screwed up or
> overlooked some detail.
If the optimizer was doing it's job properly, wouldn't
the macro and inline output object code be the same?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists