views:

2336

answers:

2

I'm interested in knowing what is "best" free/OSS compiler for MIPS code, GCC or LLVM, or is there anything even better than those?

I'm interested in knowing more about fast and memory constrained generated Assembly code than code size.

In other words, does llvm-opt do the job better than gcc -O3?

+1  A: 

LLVM is generally better than GCC on x86, but I haven't found any benchmarks for MIPS. Because you're asking this question, I assume you have access to a MIPS machine, so why don't you compile the Computer Language Benchmarks Game C code with GCC and LLVM, and see which is faster. I'm guessing GCC will be, since the MIPS backend is relatively new, but the code is much cleaner, and I expect LLVM to eventually win.

Zifre
better on x86 is a big assumtion, see http://leonardo-m.livejournal.com/77877.html it is not that obvious. About MIPS all I have is a old PS2 and a PSP and I cannot really compare since GCC backends have support for SIMD operations using it's internal VFPUs and the LLVM has no support for them yet.
Paulo Lopes
Well then, GCC is probably faster on MIPS right now.
Zifre
The above link compares GCC -O3 to *JITed* LLVM. This is hardly a fair comparison, either. LLVM can compile statically.
nominolo
A: 

I dont know about mips, I tried ARM and llvm code was around 10-20% slower than the current gcc. The tests in question were zlib based. a decompression by itself and a compression then decompression. used both clang and llvm-gcc. I preferred clang because the -m32 actually works on a 64 bit host. For the test in question I found that NOT using -O2 (or -O3) produced the fastest code. linked the bytecode modules into one big module and performed one opt with standard optimisations, to get the fastest code. llc was by default -O2 and that did help performance.

dwelch