[llvm-commits] [llvm-gcc][arm][patch] Lower function signatures a bit more

Chris Lattner clattner at apple.com
Thu Sep 9 09:59:28 PDT 2010


On Sep 8, 2010, at 11:01 PM, Rafael Espindola wrote:

> With the recent improvements Chris did to the optimization of shifts I
> thought that an old patch I wrote for PR6059 might have gained some
> extra usefulness. The patch lowers the function signatures a bit more
> so that it is explicit in the IL that the arguments are being split
> into 32 bit chunks. For example, the C code

I haven't reviewed the patch, but in principle this sounds like a great idea!

What IR does:
 double foo(double X, double Y) { return X+Y; }

get lowered into, and what ARM code ends up generated?

-Chris

> 
> -------------------------------------------------
> struct foo {double a; int b;};
> void f(int, struct foo);
> void g(int a, double b, int c) {
> struct foo x = {b, c};
> f(a, x);
> }
> -------------------------------------------------
> 
> Is currently lowered to
> 
> --------------------------------
> 
> define void @g(i32 %a, double %b, i32 %c) nounwind optsize {
> entry:
>  %tmp11 = bitcast double %b to i64
>  %tmp5 = zext i32 %c to i64
>  tail call void @f(i32 %a, i64 %tmp11, i64 %tmp5) nounwind
>  ret void
> }
> 
> declare void @f(i32, i64, i64)
> 
> ------------------------------
> 
> And with the patch it is lowered to
> 
> --------------------------------------------------------------------------------
> define void @g(i32 %a.0, i32, i32 %b.0, i32 %b.1, i32 %c.0) nounwind optsize {
> entry:
>  tail call void @f(i32 %a.0, i32 undef, i32 %b.0, i32 %b.1, i32 %c.0,
> i32 0) nounwind
>  ret void
> }
> declare void @f(i32, i32, i32, i32, i32, i32)
> -----------------------------------------------------------------------------------
> 
> I tested with Debian's gcc 4.3.2 compatibility test suite:
> 
> make ALT_CC_UNDER_TEST=/home/espindola/llvm-gcc-inst/bin/llvm-gcc
> check-gcc RUNTESTFLAGS="compat.exp"
> 
> I understand if there is not a lot of interest in optimizing llvm-gcc.
> I will just try to remember to to check what clang does when I get the
> time to work with it.
> 
> Cheers,
> -- 
> Rafael Ávila de Espíndola
> <pr6059.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list