This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Enable SSE2 math intrinsics for fpmath=sse and fast-math


On Wed, Jun 08, 2005 at 10:30:03PM +0200, Richard Guenther wrote:
> This is because during patching of the decls I need access to
> both __builtin_sin and sin decl.  In builtin_function_2 we
> only return __builtin_sin decl and it to both built_in_decls
> and implicit_built_in_decls table.  I changed it so we get
> one in built_in_decls and the other in implicit_built_in_decls.
> 
> I'll add commentary for the new parameter.

Hmm.  I'm kinda surprised that you have to do anything special.

Why do you need to modify the original "sin" decl anyway?  I'd
have thought that modifying __builtin_sin would be sufficient.

Indeed, if it's *not* sufficient, then we may need to go to a
different scheme.  The problem case I'm thinking of is

	#include <math.h>

	double (*f) (double);
	double g (double x) { return f(x); }
	void s(void) { f = sin; }

	int main ()
	{
	  s();
	  g();
	}

We should not be calling __libm_sse2_sin here.

> As we have both __builtin_sin and sin decls we need to adjust both
> assembler names.  The types(!) happen to be shared - so attaching
> the attribute once is enough.  I verified the type gets not shared
> further, though I am not exactly sure... maybe you can confirm
> my observation.

All of the builtin functions share types through builtin-types.def.
It's for certain that you don't want to be modifying that shared copy.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]