• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple s390x-linux-gnu -emit-llvm %s -o - | FileCheck %s
2 
3 // SystemZ prefers to align all global variables to two bytes.
4 
5 struct test {
6    signed char a;
7 };
8 
9 char c;
10 // CHECK-DAG: @c = common global i8 0, align 2
11 
12 struct test s;
13 // CHECK-DAG: @s = common global %struct.test zeroinitializer, align 2
14 
15 extern char ec;
16 // CHECK-DAG: @ec = external global i8, align 2
17 
18 extern struct test es;
19 // CHECK-DAG: @es = external global %struct.test, align 2
20 
21 // Dummy function to make sure external symbols are used.
func(void)22 void func (void)
23 {
24   c = ec;
25   s = es;
26 }
27 
28 
29 // Alignment should be respected for coerced argument loads
30 
31 struct arg { long y __attribute__((packed, aligned(4))); };
32 
33 extern struct arg x;
34 void f(struct arg);
35 
test(void)36 void test (void)
37 {
38   f(x);
39 }
40 
41 // CHECK-LABEL: @test
42 // CHECK: load i64, i64* getelementptr inbounds (%struct.arg, %struct.arg* @x, i32 0, i32 0), align 4
43 
44