1 // REQUIRES: arm-registered-target 2 // RUN: %clang_cc1 -triple aarch64-none-none-eabi \ 3 // RUN: -O2 \ 4 // RUN: -emit-llvm -o - %s | FileCheck %s 5 6 extern "C" { 7 8 // Base case, nothing interesting. 9 struct S { 10 long x, y; 11 }; 12 13 void f0(long, S); 14 void f0m(long, long, long, long, long, S); 15 void g0() { 16 S s = {6, 7}; 17 f0(1, s); 18 f0m(1, 2, 3, 4, 5, s); 19 } 20 // CHECK: define{{.*}} void @g0 21 // CHECK: call void @f0(i64 noundef 1, [2 x i64] [i64 6, i64 7] 22 // CHECK: call void @f0m{{.*}}[2 x i64] [i64 6, i64 7] 23 // CHECK: declare void @f0(i64 noundef, [2 x i64]) 24 // CHECK: declare void @f0m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, [2 x i64]) 25 26 // Aligned struct, passed according to its natural alignment. 27 struct __attribute__((aligned(16))) S16 { 28 long x, y; 29 } s16; 30 31 void f1(long, S16); 32 void f1m(long, long, long, long, long, S16); 33 void g1() { 34 S16 s = {6, 7}; 35 f1(1, s); 36 f1m(1, 2, 3, 4, 5, s); 37 } 38 // CHECK: define{{.*}} void @g1 39 // CHECK: call void @f1{{.*}}[2 x i64] [i64 6, i64 7] 40 // CHECK: call void @f1m{{.*}}[2 x i64] [i64 6, i64 7] 41 // CHECK: declare void @f1(i64 noundef, [2 x i64]) 42 // CHECK: declare void @f1m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, [2 x i64]) 43 44 // Increased natural alignment. 45 struct SF16 { 46 long x __attribute__((aligned(16))); 47 long y; 48 }; 49 50 void f3(long, SF16); 51 void f3m(long, long, long, long, long, SF16); 52 void g3() { 53 SF16 s = {6, 7}; 54 f3(1, s); 55 f3m(1, 2, 3, 4, 5, s); 56 } 57 // CHECK: define{{.*}} void @g3 58 // CHECK: call void @f3(i64 noundef 1, i128 129127208515966861318) 59 // CHECK: call void @f3m(i64 noundef 1, i64 noundef 2, i64 noundef 3, i64 noundef 4, i64 noundef 5, i128 129127208515966861318) 60 // CHECK: declare void @f3(i64 noundef, i128) 61 // CHECK: declare void @f3m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i128) 62 63 64 // Packed structure. 65 struct __attribute__((packed)) P { 66 int x; 67 long u; 68 }; 69 70 void f4(int, P); 71 void f4m(int, int, int, int, int, P); 72 void g4() { 73 P s = {6, 7}; 74 f4(1, s); 75 f4m(1, 2, 3, 4, 5, s); 76 } 77 // CHECK: define{{.*}} void @g4() 78 // CHECK: call void @f4(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0]) 79 // CHECK: void @f4m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0]) 80 // CHECK: declare void @f4(i32 noundef, [2 x i64]) 81 // CHECK: declare void @f4m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64]) 82 83 84 // Packed structure, overaligned, same as above. 85 struct __attribute__((packed, aligned(16))) P16 { 86 int x; 87 long y; 88 }; 89 90 void f5(int, P16); 91 void f5m(int, int, int, int, int, P16); 92 void g5() { 93 P16 s = {6, 7}; 94 f5(1, s); 95 f5m(1, 2, 3, 4, 5, s); 96 } 97 // CHECK: define{{.*}} void @g5() 98 // CHECK: call void @f5(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0]) 99 // CHECK: void @f5m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0]) 100 // CHECK: declare void @f5(i32 noundef, [2 x i64]) 101 // CHECK: declare void @f5m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64]) 102 103 } 104