diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/vectorcall.c | 4 | ||||
-rw-r--r-- | clang/test/CodeGen/windows-struct-abi.c | 6 | ||||
-rw-r--r-- | clang/test/CodeGen/x86_32-arguments-win32.c | 6 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | 31 |
5 files changed, 36 insertions, 15 deletions
diff --git a/clang/test/CodeGen/vectorcall.c b/clang/test/CodeGen/vectorcall.c index 9ee35b1a02b..b38d5e5fbc5 100644 --- a/clang/test/CodeGen/vectorcall.c +++ b/clang/test/CodeGen/vectorcall.c @@ -9,9 +9,9 @@ void __vectorcall v2(char a, char b) {} // CHECK: define x86_vectorcallcc void @"\01v2@@8"(i8 inreg signext %a, i8 inreg signext %b) // X64: define x86_vectorcallcc void @"\01v2@@16"(i8 %a, i8 %b) -struct Small { int a; }; +struct Small { int x; }; void __vectorcall v3(int a, struct Small b, int c) {} -// CHECK: define x86_vectorcallcc void @"\01v3@@12"(i32 inreg %a, %struct.Small* byval align 4 %b, i32 inreg %c) +// CHECK: define x86_vectorcallcc void @"\01v3@@12"(i32 inreg %a, i32 %b.0, i32 inreg %c) // X64: define x86_vectorcallcc void @"\01v3@@24"(i32 %a, i32 %b.coerce, i32 %c) struct Large { int a[5]; }; diff --git a/clang/test/CodeGen/windows-struct-abi.c b/clang/test/CodeGen/windows-struct-abi.c index 4b4a6f1b5db..1631f61db90 100644 --- a/clang/test/CodeGen/windows-struct-abi.c +++ b/clang/test/CodeGen/windows-struct-abi.c @@ -10,7 +10,7 @@ struct f1 return_f1(void) { while (1); } void receive_f1(struct f1 a0) { } -// CHECK: define void @receive_f1(%struct.f1* byval align 4 %a0) +// CHECK: define void @receive_f1(float %a0.0) struct f2 { float f; @@ -23,7 +23,7 @@ struct f2 return_f2(void) { while (1); } void receive_f2(struct f2 a0) { } -// CHECK: define void @receive_f2(%struct.f2* byval align 4 %a0) +// CHECK: define void @receive_f2(float %a0.0, float %a0.1) struct f4 { float f; @@ -38,5 +38,5 @@ struct f4 return_f4(void) { while (1); } void receive_f4(struct f4 a0) { } -// CHECK: define void @receive_f4(%struct.f4* byval align 4 %a0) +// CHECK: define void @receive_f4(float %a0.0, float %a0.1, float %a0.2, float %a0.3) diff --git a/clang/test/CodeGen/x86_32-arguments-win32.c b/clang/test/CodeGen/x86_32-arguments-win32.c index f8b09957b36..7b27fc74647 100644 --- a/clang/test/CodeGen/x86_32-arguments-win32.c +++ b/clang/test/CodeGen/x86_32-arguments-win32.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -w -triple i386-pc-win32 -emit-llvm -o - %s | FileCheck %s // CHECK-LABEL: define i64 @f1_1() -// CHECK-LABEL: define void @f1_2(%struct.s1* byval align 4 %a0) +// CHECK-LABEL: define void @f1_2(i32 %a0.0, i32 %a0.1) struct s1 { int a; int b; @@ -31,7 +31,7 @@ struct s4 { struct s4 f4_1(void) { while (1) {} } // CHECK-LABEL: define i64 @f5_1() -// CHECK-LABEL: define void @f5_2(%struct.s5* byval align 4) +// CHECK-LABEL: define void @f5_2(double %a0.0) struct s5 { double a; }; @@ -39,7 +39,7 @@ struct s5 f5_1(void) { while (1) {} } void f5_2(struct s5 a0) {} // CHECK-LABEL: define i32 @f6_1() -// CHECK-LABEL: define void @f6_2(%struct.s6* byval align 4 %a0) +// CHECK-LABEL: define void @f6_2(float %a0.0) struct s6 { float a; }; diff --git a/clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp b/clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp index da58c461dcc..6da7a50b617 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp @@ -2,10 +2,10 @@ // PR15768 -// A trivial 12 byte struct is returned indirectly. +// A trivial 20 byte struct is returned indirectly and taken as byval. struct S { S(); - int a, b, c; + int a, b, c, d, e; }; struct C { diff --git a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp index 4c2d8506af7..a5cb98d41b2 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp @@ -22,6 +22,16 @@ struct SmallWithCtor { int x; }; +struct Multibyte { + char a, b, c, d; +}; + +struct Packed { + short a; + int b; + short c; +}; + struct SmallWithDtor { SmallWithDtor(); ~SmallWithDtor(); @@ -102,19 +112,30 @@ Big big_return() { return Big(); } void small_arg(Small s) {} // LINUX-LABEL: define void @_Z9small_arg5Small(i32 %s.0) -// WIN32: define void @"\01?small_arg@@YAXUSmall@@@Z"(%struct.Small* byval align 4 %s) +// WIN32: define void @"\01?small_arg@@YAXUSmall@@@Z"(i32 %s.0) // WIN64: define void @"\01?small_arg@@YAXUSmall@@@Z"(i32 %s.coerce) void medium_arg(Medium s) {} // LINUX-LABEL: define void @_Z10medium_arg6Medium(i32 %s.0, i32 %s.1) -// WIN32: define void @"\01?medium_arg@@YAXUMedium@@@Z"(%struct.Medium* byval align 4 %s) +// WIN32: define void @"\01?medium_arg@@YAXUMedium@@@Z"(i32 %s.0, i32 %s.1) // WIN64: define void @"\01?medium_arg@@YAXUMedium@@@Z"(i64 %s.coerce) void small_arg_with_ctor(SmallWithCtor s) {} // LINUX-LABEL: define void @_Z19small_arg_with_ctor13SmallWithCtor(%struct.SmallWithCtor* byval align 4 %s) -// WIN32: define void @"\01?small_arg_with_ctor@@YAXUSmallWithCtor@@@Z"(%struct.SmallWithCtor* byval align 4 %s) +// WIN32: define void @"\01?small_arg_with_ctor@@YAXUSmallWithCtor@@@Z"(i32 %s.0) // WIN64: define void @"\01?small_arg_with_ctor@@YAXUSmallWithCtor@@@Z"(i32 %s.coerce) +// FIXME: We could coerce to a series of i32s here if we wanted to. +void multibyte_arg(Multibyte s) {} +// LINUX-LABEL: define void @_Z13multibyte_arg9Multibyte(%struct.Multibyte* byval align 4 %s) +// WIN32: define void @"\01?multibyte_arg@@YAXUMultibyte@@@Z"(%struct.Multibyte* byval align 4 %s) +// WIN64: define void @"\01?multibyte_arg@@YAXUMultibyte@@@Z"(i32 %s.coerce) + +void packed_arg(Packed s) {} +// LINUX-LABEL: define void @_Z10packed_arg6Packed(%struct.Packed* byval align 4 %s) +// WIN32: define void @"\01?packed_arg@@YAXUPacked@@@Z"(%struct.Packed* byval align 4 %s) +// WIN64: define void @"\01?packed_arg@@YAXUPacked@@@Z"(%struct.Packed* %s) + // Test that dtors are invoked in the callee. void small_arg_with_dtor(SmallWithDtor s) {} // WIN32: define void @"\01?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} { @@ -230,12 +251,12 @@ class Class { void thiscall_method_arg(Small s) {} // LINUX: define {{.*}} void @_ZN5Class19thiscall_method_argE5Small(%class.Class* %this, i32 %s.0) - // WIN32: define {{.*}} void @"\01?thiscall_method_arg@Class@@QAEXUSmall@@@Z"(%class.Class* %this, %struct.Small* byval align 4 %s) + // WIN32: define {{.*}} void @"\01?thiscall_method_arg@Class@@QAEXUSmall@@@Z"(%class.Class* %this, i32 %s.0) // WIN64: define linkonce_odr void @"\01?thiscall_method_arg@Class@@QEAAXUSmall@@@Z"(%class.Class* %this, i32 %s.coerce) void thiscall_method_arg(SmallWithCtor s) {} // LINUX: define {{.*}} void @_ZN5Class19thiscall_method_argE13SmallWithCtor(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s) - // WIN32: define {{.*}} void @"\01?thiscall_method_arg@Class@@QAEXUSmallWithCtor@@@Z"(%class.Class* %this, %struct.SmallWithCtor* byval align 4 %s) + // WIN32: define {{.*}} void @"\01?thiscall_method_arg@Class@@QAEXUSmallWithCtor@@@Z"(%class.Class* %this, i32 %s.0) // WIN64: define linkonce_odr void @"\01?thiscall_method_arg@Class@@QEAAXUSmallWithCtor@@@Z"(%class.Class* %this, i32 %s.coerce) void thiscall_method_arg(Big s) {} |