[cfe-commits] r173375 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGen/mips64-padding-arg.c
Akira Hatanaka
ahatanaka at mips.com
Thu Jan 24 13:47:33 PST 2013
Author: ahatanak
Date: Thu Jan 24 15:47:33 2013
New Revision: 173375
URL: http://llvm.org/viewvc/llvm-project?rev=173375&view=rev
Log:
[mips] Do not emit i32 padding if target ABI is O32. This was causing backend
to pass floating point arguments to be passed in integer registers.
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/mips64-padding-arg.c
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=173375&r1=173374&r2=173375&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Jan 24 15:47:33 2013
@@ -4022,7 +4022,8 @@
if (Ty->isPromotableIntegerType())
return ABIArgInfo::getExtend();
- return ABIArgInfo::getDirect(0, 0, getPaddingType(Align, OrigOffset));
+ return ABIArgInfo::getDirect(0, 0,
+ IsO32 ? 0 : getPaddingType(Align, OrigOffset));
}
llvm::Type*
Modified: cfe/trunk/test/CodeGen/mips64-padding-arg.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mips64-padding-arg.c?rev=173375&r1=173374&r2=173375&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/mips64-padding-arg.c (original)
+++ cfe/trunk/test/CodeGen/mips64-padding-arg.c Thu Jan 24 15:47:33 2013
@@ -1,4 +1,5 @@
-// RUN: %clang -target mips64el-unknown-linux -O3 -S -mabi=n64 -o - -emit-llvm %s | FileCheck %s
+// RUN: %clang -target mipsel-unknown-linux -O3 -S -o - -emit-llvm %s | FileCheck %s -check-prefix=O32
+// RUN: %clang -target mips64el-unknown-linux -O3 -S -mabi=n64 -o - -emit-llvm %s | FileCheck %s -check-prefix=N64
typedef struct {
double d;
@@ -7,9 +8,9 @@
// Insert padding to ensure arguments of type S0 are aligned to 16-byte boundaries.
-// CHECK: define void @foo1(i32 %a0, i64, double %a1.coerce0, i64 %a1.coerce1, i64 %a1.coerce2, i64 %a1.coerce3, double %a2.coerce0, i64 %a2.coerce1, i64 %a2.coerce2, i64 %a2.coerce3, i32 %b, i64, double %a3.coerce0, i64 %a3.coerce1, i64 %a3.coerce2, i64 %a3.coerce3)
-// CHECK: tail call void @foo2(i32 1, i32 2, i32 %a0, i64 undef, double %a1.coerce0, i64 %a1.coerce1, i64 %a1.coerce2, i64 %a1.coerce3, double %a2.coerce0, i64 %a2.coerce1, i64 %a2.coerce2, i64 %a2.coerce3, i32 3, i64 undef, double %a3.coerce0, i64 %a3.coerce1, i64 %a3.coerce2, i64 %a3.coerce3)
-// CHECK: declare void @foo2(i32, i32, i32, i64, double, i64, i64, i64, double, i64, i64, i64, i32, i64, double, i64, i64, i64)
+// N64: define void @foo1(i32 %a0, i64, double %a1.coerce0, i64 %a1.coerce1, i64 %a1.coerce2, i64 %a1.coerce3, double %a2.coerce0, i64 %a2.coerce1, i64 %a2.coerce2, i64 %a2.coerce3, i32 %b, i64, double %a3.coerce0, i64 %a3.coerce1, i64 %a3.coerce2, i64 %a3.coerce3)
+// N64: tail call void @foo2(i32 1, i32 2, i32 %a0, i64 undef, double %a1.coerce0, i64 %a1.coerce1, i64 %a1.coerce2, i64 %a1.coerce3, double %a2.coerce0, i64 %a2.coerce1, i64 %a2.coerce2, i64 %a2.coerce3, i32 3, i64 undef, double %a3.coerce0, i64 %a3.coerce1, i64 %a3.coerce2, i64 %a3.coerce3)
+// N64: declare void @foo2(i32, i32, i32, i64, double, i64, i64, i64, double, i64, i64, i64, i32, i64, double, i64, i64, i64)
extern void foo2(int, int, int, S0, S0, int, S0);
@@ -19,9 +20,9 @@
// Insert padding before long double argument.
//
-// CHECK: define void @foo3(i32 %a0, i64, fp128 %a1)
-// CHECK: tail call void @foo4(i32 1, i32 2, i32 %a0, i64 undef, fp128 %a1)
-// CHECK: declare void @foo4(i32, i32, i32, i64, fp128)
+// N64: define void @foo3(i32 %a0, i64, fp128 %a1)
+// N64: tail call void @foo4(i32 1, i32 2, i32 %a0, i64 undef, fp128 %a1)
+// N64: declare void @foo4(i32, i32, i32, i64, fp128)
extern void foo4(int, int, int, long double);
@@ -31,9 +32,9 @@
// Insert padding after hidden argument.
//
-// CHECK: define void @foo5(%struct.S0* noalias sret %agg.result, i64, fp128 %a0)
-// CHECK: call void @foo6(%struct.S0* sret %agg.result, i32 1, i32 2, i64 undef, fp128 %a0)
-// CHECK: declare void @foo6(%struct.S0* sret, i32, i32, i64, fp128)
+// N64: define void @foo5(%struct.S0* noalias sret %agg.result, i64, fp128 %a0)
+// N64: call void @foo6(%struct.S0* sret %agg.result, i32 1, i32 2, i64 undef, fp128 %a0)
+// N64: declare void @foo6(%struct.S0* sret, i32, i32, i64, fp128)
extern S0 foo6(int, int, long double);
@@ -41,3 +42,14 @@
return foo6(1, 2, a0);
}
+// Do not insert padding if ABI is O32.
+//
+// O32: define void @foo7(float %a0, double %a1)
+// O32: declare void @foo8(float, double)
+
+extern void foo8(float, double);
+
+void foo7(float a0, double a1) {
+ foo8(a0 + 1.0f, a1 + 2.0);
+}
+
More information about the cfe-commits
mailing list