Step
7 - Compiling code
The Quexal development
environment is not
only about easing MMX/SSE
programming: it will turn every programmer into an expert code
optimizer,
without requiring any previous experience. Scheduling instructions by
hand
is a boring and tiresome job, and it requires a deep knowledge of the
micro
architectures. Optimized code is also difficult to read and maintain,
since
it is common to join different execution paths together to maximize the
level of parallelism that can be achieved: the resulting code does not
show a clear logical flow. Even worse, modifying an optimized piece
code
often turns out to be impossible, since any change would likely break
the
carefully planned scheduling strategy: it is often necessary to dump
the
optimized code, modify the original code then repeat the scheduling
phase
from scratch.
All these tasks greatly
reduce the productivity
of MMX/SSE programmers. Quexal provides an optimizing compiler that can
quickly turn the original code into highly tuned assembly instructions,
ready to be pasted into any development environment, even those that do
not support MMX and SSE opcodes thanks to the bytecode compiler. The
benefits
of removing the optimization phase from the development process cannot
be underestimated:
-
the learning curve is
dramatically flattened:
you can ignore most of highly technical micro architectural details,
because
Quexal does the job for you;
-
the development
process is shorter:
aside from the gain of time obtained by avoiding the optimization
phase,
you can easily maintain the source code in its original form using the
comfortable Quexal development environment, and optimize it each time
you
need to;
-
the resulting code is
less likely to have
hard-to-catch bugs, due to incorrect dependency analysis or
register
misallocation. By following a few guidelines, you can be sure that the
optimized code behaves exactly as the original one does.
Performing the
optimization of the code
built in the previous section is as easy as clicking on the red light
button
on the toolbar, or choosing Run|Compile (F9) from the menu. The
compiler
will keep running until you stop it by clicking again on the same
button.
While compiling, you can see some meaningful statistics on the status
bar:
the most important one is the Best Benchmark that shows how many
solutions
provided a performance improvement over the first found one, and how
does
the best solution perform on the Pentium 4 / Pentium
III / Athlon micro architecture.
When the source code has
been optimized,
you can examine it by clicking on the finger button on the toolbar (or
Run|Show Optimized Code from the menu, F10). A new window, named
Compiled
optimized code, pops up showing the assembly code ready to be pasted
into
any development environment: clicking on the Copy button copies all the
optimized code into the Windows clipboard.

|