Re: Implementation of gcc SIMD builtins

2011-02-10 Thread Mike Farnsworth
Iain Buclaw Wrote: > == Quote from Mike Farnsworth (mike.farnswo...@gmail.com)'s article > > Sorry to start a new thread on this, but I didn't want it to get lost in > > the middle of the previous comments. I have the start of a working > > implementat

Implementation of gcc SIMD builtins

2011-02-10 Thread Mike Farnsworth
Sorry to start a new thread on this, but I didn't want it to get lost in the middle of the previous comments. I have the start of a working implementation in gdc giving access to the __builtin_ia32_* functions. The way I did it so far manages to compile down to very tight SSE code. That's the goo

Re: Cross-module inlining in gdc

2011-02-09 Thread Mike Farnsworth
Trass3r Wrote: > > // Assume __v4sf is defined by the compiler > > pragma(set_attribute, _mm_add_ps, always_inline, artificial); > > __v4sf _mm_add_ps (__v4sf __A, __v4sf __B) > > { > > return __builtin_ia32_addps(__A, __B); > > } > > 2 notes: > Isn't it pragma(GNU_set_attribute? > > And you

Debugging gdc

2011-02-09 Thread Mike Farnsworth
In my adventures with adding gcc __builtin_* functions, I was able to get them to work if I defined any VECTOR_TYPE gcc trees as a D struct (long story, for another post). When adding the builtin structs, if I registered the struct definitions in the gcc.builtins module, and then built phobos2,

Cross-module inlining in gdc

2011-02-09 Thread Mike Farnsworth
So, as I've been working on getting the gcc builtins available to D code (somewhat successfully as of last night, I might add), I've run into a fairly significant inlining problem. Given a function definition in D, where I want to force inlining: // Assume __v4sf is defined by the compiler prag

Re: Support for gcc vector attributes, SIMD builtins

2011-02-06 Thread Mike Farnsworth
On 02/06/2011 02:58 PM, Iain Buclaw wrote: > == Quote from Brad Roberts (bra...@puremagic.com)'s article >> I'd be happy to have gcc finding vectorization opportunities, but there's no > need to add this sort of thing to the >> language. This already has a hook to call a library function: >> float

Re: Support for gcc vector attributes, SIMD builtins

2011-02-05 Thread Mike Farnsworth
On 02/01/2011 10:38 AM, Iain Buclaw wrote: > I haven't given it much thought on how internal representation could be, but > I'd > lean on using unions in D code for usage in the language. As its probably most > portable. > > For example, one of the older 'hello vectors' I know of: > > import std

Re: Support for gcc vector attributes, SIMD builtins

2011-02-01 Thread Mike Farnsworth
Iain Buclaw Wrote: > == Quote from Jerry Quinn (jlqu...@optonline.net)'s article > > Iain Buclaw Wrote: > > > == Quote from Mike Farnsworth (mike.farnswo...@gmail.com)'s article > > > > I built gdc from tip on Fedora 13 (x86-64) and started playing around

Re: Support for gcc vector attributes, SIMD builtins

2011-02-01 Thread Mike Farnsworth
Iain Buclaw Wrote: > == Quote from Mike Farnsworth (mike.farnswo...@gmail.com)'s article > > I built gdc from tip on Fedora 13 (x86-64) and started playing around > > with creating a vector struct (x,y,z,w) to see what kind of optimization > > the code generator di

Re: Support for gcc vector attributes, SIMD builtins

2011-02-01 Thread Mike Farnsworth
Daniel Gibson Wrote: > I'm not sure if that'll help at all, but you may try something like > alias float[4] vec4; // or whatever type you're using > /Maybe/ SSE optimizations work better on arrays than on structs. > Of course, such a type isn't as handy because it'll be vec4[0] instead > of vec4.x

Support for gcc vector attributes, SIMD builtins

2011-02-01 Thread Mike Farnsworth
I built gdc from tip on Fedora 13 (x86-64) and started playing around with creating a vector struct (x,y,z,w) to see what kind of optimization the code generator did with it. It was able to partially drop into SSE registers and instructions, but not as well as I had hoped from writing "regular" D