annotate clang/test/CodeGen/aapcs64-align.cpp @ 207:2e18cbf3894f

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