asm in inline function invalidating function attributes?

Jakub Jelinek jakub@redhat.com
Mon Oct 17 04:08:00 GMT 2011


On Sat, Oct 15, 2011 at 05:52:03PM -0400, Ulrich Drepper wrote:
> I think gcc should allow the programmer to tell it something about a
> function return value even if the function is inlined and the compiler
> can see all the code.  Consider the code below.

If this is about e.g.
2011-09-14  Ulrich Drepper  <drepper@gmail.com>

	* sysdeps/x86_64/fpu/bits/mathinline.h (__MATH_INLINE): Use
	__extern_always_inline.
	Define lrint{f,} and llrint{f,} for 64-bit and in some situations for
 	32-bit.
then I'd say these inlines are the wrong direction, gcc (tried 4.6/trunk
only) has lrint{,f,l} builtin, and for -ffast-math it will optimize it into
cvtsd2siq etc. (both for -m64 and for -m32 -msse2 -mfmath=sse). 
It will be handled as const, and furthermore gcc will constant fold it
(lrint (7.5) will be resolved at compile time).

	Jakub



More information about the Gcc mailing list