Merge x86-64-abi-sret-vs-2word-struct-param.cpp into the generic

x86_64-arguments.cpp test file and be sure to test the coerced
case as well.  Thanks to Wei-Ren Chen for bringing this test
to my attention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2012-05-03 01:34:46 +00:00
Родитель 7b0a3e378c
Коммит 92c6c90e90
2 изменённых файлов: 32 добавлений и 29 удалений

Просмотреть файл

@ -1,29 +0,0 @@
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// XTARGET: x86
// PR4242
// (PR 4242 bug is on 64-bit only, test passes on x86-32 as well)
struct S {
void* data[3];
};
struct T {
void* data[2];
};
// CHECK: %struct.T* byval
extern "C" S fail(int, int, int, int, T t, void* p) {
S s;
s.data[0] = t.data[0];
s.data[1] = t.data[1];
s.data[2] = p;
return s;
}
// CHECK: %struct.T* byval
extern "C" S* succeed(S* sret, int, int, int, int, T t, void* p) {
sret->data[0] = t.data[0];
sret->data[1] = t.data[1];
sret->data[2] = p;
return sret;
}

Просмотреть файл

@ -56,6 +56,7 @@ namespace PR7742 { // Also rdar://8250764
// CHECK: define <2 x float> @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
c2 foo(c2 *P) {
return c2();
}
}
@ -149,3 +150,34 @@ namespace test8 {
foo(b);
}
}
// PR4242
namespace test9 {
// Large enough to be passed indirectly.
struct S { void *data[3]; };
struct T { void *data[2]; };
// CHECK: define void @_ZN5test93fooEPNS_1SEPNS_1TE([[S:%.*]]*, [[T:%.*]]*)
void foo(S*, T*) {}
// CHECK: define void @_ZN5test91aEiiiiNS_1TEPv([[S]]* noalias sret {{%.*}}, i32, i32, i32, i32, [[T]]* byval align 8, i8*)
S a(int, int, int, int, T, void*) {
return S();
}
// CHECK: define [[S]]* @_ZN5test91bEPNS_1SEiiiiNS_1TEPv([[S]]* {{%.*}}, i32, i32, i32, i32, [[T:%.*]]* byval align 8, i8*)
S* b(S* sret, int, int, int, int, T, void*) {
return sret;
}
// CHECK: define void @_ZN5test91cEiiiNS_1TEPv([[S]]* noalias sret {{%.*}}, i32, i32, i32, i8* {{%.*}}, i8* {{%.*}}, i8*)
S c(int, int, int, T, void*) {
return S();
}
// CHECK: define [[S]]* @_ZN5test91dEPNS_1SEiiiNS_1TEPv([[S]]* {{%.*}}, i32, i32, i32, i8* {{%.*}}, i8* {{%.*}}, i8*)
S* d(S* sret, int, int, int, T, void*) {
return sret;
}
}