1 // RUN: %clang_cc1 -triple x86_64-unknown-nacl -emit-llvm -o - %s| FileCheck %s
3 // Test for x86-64 structure representation (instead of pnacl representation),
4 // in particular for unions. Also crib a few tests from x86 Linux.
15 union PP_VarValue value
;
18 // CHECK: define{{.*}} { i64, i64 } @f0()
19 struct PP_Var
f0(void) {
20 struct PP_Var result
= { 0, 0, 0 };
24 // CHECK-LABEL: define{{.*}} void @f1(i64 %p1.coerce0, i64 %p1.coerce1)
25 void f1(struct PP_Var p1
) { while(1) {} }
27 // long doubles are 64 bits on NaCl
28 // CHECK-LABEL: define{{.*}} double @f5()
29 long double f5(void) {
33 // CHECK-LABEL: define{{.*}} void @f6(i8 noundef signext %a0, i16 noundef signext %a1, i32 noundef %a2, i64 noundef %a3, ptr noundef %a4)
34 void f6(char a0
, short a1
, int a2
, long long a3
, void *a4
) {
37 // CHECK-LABEL: define{{.*}} i64 @f8_1()
38 // CHECK-LABEL: define{{.*}} void @f8_2(i64 %a0.coerce)
43 union u8
f8_1(void) { while (1) {} }
44 void f8_2(union u8 a0
) {}
46 // CHECK-LABEL: define{{.*}} i64 @f9()
47 struct s9
{ int a
; int b
; int : 0; } f9(void) { while (1) {} }
49 // CHECK-LABEL: define{{.*}} void @f10(i64 %a0.coerce)
50 struct s10
{ int a
; int b
; int : 0; };
51 void f10(struct s10 a0
) {}
53 // CHECK-LABEL: define{{.*}} double @f11()
54 union { long double a
; float b
; } f11(void) { while (1) {} }
56 // CHECK-LABEL: define{{.*}} i32 @f12_0()
57 // CHECK-LABEL: define{{.*}} void @f12_1(i32 %a0.coerce)
58 struct s12
{ int a
__attribute__((aligned(16))); };
59 struct s12
f12_0(void) { while (1) {} }
60 void f12_1(struct s12 a0
) {}
62 // Check that sret parameter is accounted for when checking available integer
64 // CHECK: define{{.*}} void @f13(ptr dead_on_unwind noalias writable sret(%struct.s13_0) align 8 %agg.result, i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d, ptr noundef byval({{.*}}) align 8 %e, i32 noundef %f)
66 struct s13_0
{ long long f0
[3]; };
67 struct s13_1
{ long long f0
[2]; };
68 struct s13_0
f13(int a
, int b
, int c
, int d
,
69 struct s13_1 e
, int f
) { while (1) {} }
71 // CHECK-LABEL: define{{.*}} void @f20(ptr noundef byval(%struct.s20) align 32 %x)
72 struct __attribute__((aligned(32))) s20
{
76 void f20(struct s20 x
) {}
79 // CHECK: declare void @func(i64)