Forgot your password?
Intel Open Source Programming Software

Comparing G++ and Intel Compilers and Vectorized Code 225

Posted by timothy
from the different-lenses dept.
Nerval's Lobster writes "A compiler can take your C++ loops and create vectorized assembly code for you. It's obviously important that you RTFM and fully understand compiler options (especially since the defaults may not be what you want or think you're getting), but even then, do you trust that the compiler is generating the best code for you? Developer and editor Jeff Cogswell compares the g++ and Intel compilers when it comes to generating vectorized code, building off a previous test that examined the g++ compiler's vectorization abilities, and comes to some definite conclusions. 'The g++ compiler did well up against the Intel compiler,' he wrote. 'I was troubled by how different the generated assembly code was between the 4.7 and 4.8.1 compilers—not just with the vectorization but throughout the code.' Do you agree?"
This discussion has been archived. No new comments can be posted.

Comparing G++ and Intel Compilers and Vectorized Code

Comments Filter:
  • by LordByronStyrofoam (587954) on Thursday December 19, 2013 @01:34PM (#45737837)
    OMG! What's this goatse doing here?? I thought all these images were taken down by a DMCA notice by the original asshole!
  • by DickBreath (207180) on Thursday December 19, 2013 @03:19PM (#45738909) Homepage

    Here is how I do a factorial function. No recursion, no loops, no vectorization needed. It's in Java. Converting this basic idea to C is left as an exercise for advanced readers.

            static public long factorial( int n ) {
                    switch( n ) {
                            case 0:
                            case 1: return 1L;
                            case 2: return 2L;
                            case 3: return 6L;
    . . . cases 4 to 18 omitted to bypass slashdot filters . . .
                            case 19: return 121645100408832000L;
                            case 20: return 2432902008176640000L;
                    return 0L;

Do you suffer painful illumination? -- Isaac Newton, "Optics"