A few inline assembly questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

A few inline assembly questions

Zack Rusin
Hey,

I'm contemplating adding llvm-gcc as a core platform to Qt, meaning we'd
release Qt unless we would make sure it compiles and works with llvm-gcc but
I have some problems with making it work cleanly so I just wanted to ask a
few simple questions.
The problems refer to llvm and llvm-gcc from respectively cvs/svn which, I'm
assuming, means upcoming 2.0 release.

1) we added a little inline assembly to do runtime detection of a few cpu
features. llvm-g++ crashes on the attached testcase (test.cpp).

2) i have code utilizing whatever vector insructions i can get my hands on to
speed up some very common rendering operations. llvm-gcc doesn't seem to
support mmx intrinsics which makes Qt compiled with llvm-gcc quite a bit
slower when it comes to graphics. test2.cpp shows in essence what we're doing
in Qt. we basically have a very simple class that defines simple static
methods like negate/add/byte_mul/interpolate_pixel. now the question is if
there is any way of getting code like this to utilize vector instructions
with llvm-gcc. i wouldn't mind having llvm specific path there as long as it
works.

Zack

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

test2.cpp (5K) Download Attachment
test.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A few inline assembly questions

Anton Korobeynikov
Hello, Zack.

> 1) we added a little inline assembly to do runtime detection of a few cpu
> features. llvm-g++ crashes on the attached testcase (test.cpp).
I've filled PR1259 in the LLVM Bugzilla. You might want to register
there and add yourself to CC list in order to track progress.

> there is any way of getting code like this to utilize vector instructions
> with llvm-gcc.
Currently - unfortunately, no. However, MMX-support works are in
progress afaik.

--
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: A few inline assembly questions

Chris Lattner
In reply to this post by Zack Rusin
On Sun, 18 Mar 2007, Zack Rusin wrote:
> I'm contemplating adding llvm-gcc as a core platform to Qt, meaning we'd
> release Qt unless we would make sure it compiles and works with llvm-gcc but
> I have some problems with making it work cleanly so I just wanted to ask a
> few simple questions.

Very nice!

> The problems refer to llvm and llvm-gcc from respectively cvs/svn which, I'm
> assuming, means upcoming 2.0 release.

Great, that is very useful.

> 1) we added a little inline assembly to do runtime detection of a few cpu
> features. llvm-g++ crashes on the attached testcase (test.cpp).

Anton filed a bug for this, I'll try to make sure it gets fixed this week.

> 2) i have code utilizing whatever vector insructions i can get my hands on to
> speed up some very common rendering operations. llvm-gcc doesn't seem to
> support mmx intrinsics which makes Qt compiled with llvm-gcc quite a bit
> slower when it comes to graphics.

As Anton mentioned, work is actively underway to add MMX intrinsic
support.  Right now we have very basic support for a few simple operations
like add and multiply.  Bill Wendling is the one working on this, I
forwarded your testcase to him so that he can focus on those operations
first.

> test2.cpp shows in essence what we're doing
> in Qt. we basically have a very simple class that defines simple static
> methods like negate/add/byte_mul/interpolate_pixel. now the question is if
> there is any way of getting code like this to utilize vector instructions
> with llvm-gcc. i wouldn't mind having llvm specific path there as long as it
> works.

Absolutely.  Until now, there hasn't been anything pushing for MMX
intrinsic support (most clients we've worked with so far use SSE2 instead
of MMX).  LLVM definitely needs to support the MMX intrinsics, when Bill
has your testcase working, I'd appreciate it if you could try Qt with MMX
enabled again.  I filed http://llvm.org/PR1260 to track your specific
testcase (PR1222 is the bug for MMX intrinsics in general).  If you want
to see when this is completed, it is easiest to CC yourself on the bug.

If there is anything else we can do, please don't hesitate to email the
list further (or file bugs) :)

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: A few inline assembly questions

Bill Wendling
On Mar 18, 2007, at 5:14 PM, Chris Lattner wrote:

>> 2) i have code utilizing whatever vector insructions i can get my  
>> hands on to
>> speed up some very common rendering operations. llvm-gcc doesn't  
>> seem to
>> support mmx intrinsics which makes Qt compiled with llvm-gcc quite  
>> a bit
>> slower when it comes to graphics.
>
> As Anton mentioned, work is actively underway to add MMX intrinsic
> support.  Right now we have very basic support for a few simple  
> operations
> like add and multiply.  Bill Wendling is the one working on this, I
> forwarded your testcase to him so that he can focus on those  
> operations
> first.
>
Got 'em. :-) I think my schedule's slightly more open this week, so I  
should be able to add the missing operators easily.

>> test2.cpp shows in essence what we're doing
>> in Qt. we basically have a very simple class that defines simple  
>> static
>> methods like negate/add/byte_mul/interpolate_pixel. now the  
>> question is if
>> there is any way of getting code like this to utilize vector  
>> instructions
>> with llvm-gcc. i wouldn't mind having llvm specific path there as  
>> long as it
>> works.
>
> Absolutely.  Until now, there hasn't been anything pushing for MMX
> intrinsic support (most clients we've worked with so far use SSE2  
> instead
> of MMX).  LLVM definitely needs to support the MMX intrinsics, when  
> Bill
> has your testcase working, I'd appreciate it if you could try Qt  
> with MMX
> enabled again.  I filed http://llvm.org/PR1260 to track your specific
> testcase (PR1222 is the bug for MMX intrinsics in general).  If you  
> want
> to see when this is completed, it is easiest to CC yourself on the  
> bug.
>
Also, if you could do some performance comparisons between GCC and  
LLVM, it would be a good measurement of how we're doing. From the few  
instructions I've added, we tend to generate better code. :-)

-bw

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: A few inline assembly questions

Zack Rusin
On Monday 19 March 2007 06:44, Bill Wendling wrote:

> > As Anton mentioned, work is actively underway to add MMX intrinsic
> > support.  Right now we have very basic support for a few simple
> > operations
> > like add and multiply.  Bill Wendling is the one working on this, I
> > forwarded your testcase to him so that he can focus on those
> > operations
> > first.
>
> Got 'em. :-) I think my schedule's slightly more open this week, so I
> should be able to add the missing operators easily.

Ah, that would be wonderful :)

> Also, if you could do some performance comparisons between GCC and
> LLVM, it would be a good measurement of how we're doing. From the few
> instructions I've added, we tend to generate better code. :-)

I'll definitely do that :)
I'm planning to run some of the other benchmarks we have here but I'm afraid I
won't get to it until Friday. We have a few text decoding/manipulation
benchmarks where GCC is generating suboptimal code (Visual C++ on identical
machine manged to outperform it by almost two-fold) so I'm eager to see how
LLVM stacks up. As soon as I have some results I'll post them here.

Zack
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev