This site is no longer active and is available for archival purposes only. Registration and login is disabled.

The Microsoft Compiler ain't too great


The Microsoft Compiler ain't too great

Postby Dave » Jun 14, 2002 @ 4:41pm

Dave
 


Postby angedelamort » Jun 14, 2002 @ 5:05pm

User avatar
angedelamort
pm Member
 
Posts: 304
Joined: Mar 7, 2002 @ 11:16pm
Location: Montreal, Quebec


Postby Dave » Jun 14, 2002 @ 7:39pm

Dave
 


Postby angedelamort » Jun 14, 2002 @ 8:01pm

User avatar
angedelamort
pm Member
 
Posts: 304
Joined: Mar 7, 2002 @ 11:16pm
Location: Montreal, Quebec


Postby billcow » Jun 14, 2002 @ 9:04pm

I know what's happening:

The ARM signed stores and loads for halfwords and bytes are pretty crappy (They are less capable than the unisgned versions, and in some casews slower). The compiler is shifting left, and when it shifts back right, the original sign bit is in bit 15 (the high bit of the short), and an unsigned store can be used. Without the shifts, either the sign would be lost, or the signed halfword instruction would need to be used.

In other words, unless you really need to save 8 bytes in your code, it's not hurting to have those there (I'm not sure how slow the signed store halfword is, but if the compiler does something to work around it, it must be slower than the workaround. Even Microsoft must know about the signed store instructions).
Most people don't know that "A highly technical term" is actually a highly technical term used to describe something that doesn't mean anything
User avatar
billcow
pm Member
 
Posts: 81
Joined: Jan 6, 2002 @ 12:22am
Location: Dryden, NY


Postby refractor » Jun 15, 2002 @ 7:48am

The STRSH (signed store) costs an extra cycle over the straight STRH, so the MS version is slower by a single cycle. In that routine it's not worth worrying about (and if it is, just write the whole fn in assembler and have done with it).

(Can't check now, but if you can use writeback with a STRH then there's an extra cycle to kill at the end).

angeldelamort:

So long as you're not waiting a result from a previous instruction for one of the registers (like a from a MUL):
MOV X,Y

will take one cycle.

MUL R,big_number_1, big_number_2
wait between 1 and 3 cycles for R to arrive
MOV X,R

It depends on the numbers you multiply by - the bigger the more goes the (8 bit, IIRC) Booth multiplier needs. IIRC it's also faster to put the smaller number of the two in big_number_2 (if you know which is smaller at compile-time).

Cheers,

Refractor[/quote]
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Dave » Jun 15, 2002 @ 7:05pm

Dave
 


Postby billcow » Jun 15, 2002 @ 7:19pm

Most people don't know that "A highly technical term" is actually a highly technical term used to describe something that doesn't mean anything
User avatar
billcow
pm Member
 
Posts: 81
Joined: Jan 6, 2002 @ 12:22am
Location: Dryden, NY


Postby refractor » Jun 16, 2002 @ 9:45pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby billcow » Jun 16, 2002 @ 10:50pm

Yeah, that site says the SRTSH is a StrongArm extension, the quickref card I have is plain ARM only. Which would indicate that the MS compiler isn't StrongARM specific.

As for the overflow, the compiler can't be sure that the programmer is smart enough to prevent overflow, so it has to cover it's bases. Since MS didn't provide us with very much choices for the level of optimization, the compiler has to take the safe road. In this case, the overflow check is done right before the write, but since there are so many ways to check for overflow, it would be difficult for a compiler to check for any possible overflow check. As a result, the only way to tell it not to would be to use a #pragma statement or something like that, but the MS compiler doesn't have one.

The writeback (I wasn't aware of that term for it, which is why I brought it up after you already did) is probably only used by the compiler when you use "*(p++)=a" instead of "*p=a; p++;". Unlike overflow checks, detecting this is relatively easy, so there isn't really any excuse.

My opinion is that the compiler isn't that bad, but it does have a few issues nonetheless. Most of the problems it does have are excusable for various reasons.
Most people don't know that "A highly technical term" is actually a highly technical term used to describe something that doesn't mean anything
User avatar
billcow
pm Member
 
Posts: 81
Joined: Jan 6, 2002 @ 12:22am
Location: Dryden, NY


Postby refractor » Jun 17, 2002 @ 9:32am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby refractor » Jun 17, 2002 @ 9:33am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Hosed » Jun 17, 2002 @ 9:47am

User avatar
Hosed
pm Member
 
Posts: 249
Joined: Jan 3, 2002 @ 2:51am
Location: Montana, USA


Postby refractor » Jun 17, 2002 @ 10:04am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum