Re:Why do RET instructions have a REPZ prepended on x86?
by exDM69 on Tuesday August 27, 2013 @04:55PM
(#6286223)
> Actually it can
Yeah, I found this out the hard way. Turns out it's really ridiculously difficult to get GCC to put the rdtsc instruction where you want it :)
But you get the point, the compiler can optimize better if you use C and intrinsics than inline asm.
Re:Why do RET instructions have a REPZ prepended on x86?
by notacoward on Wednesday August 28, 2013 @03:11PM
(#6292015)
Truth. I only use asm for stuff I can't do in C, like access architecture-specific registers or use instructions for which there are no C operators. Anything else strikes me as a bit of an exercise in machismo at the expense of sound engineering.
Actually it can, if you have a way to specify register usage (gcc does) and the programmer gives the right specification. Unfortunately, that almost never seems to happen in practice.