Skip to content

Commit f395d82

Browse files
committed
[clang][LoongArch] Pre-commit test for align global. NFC
1 parent 36b2c22 commit f395d82

File tree

1 file changed

+58
-0
lines changed
  • clang/test/CodeGen/LoongArch

1 file changed

+58
-0
lines changed

clang/test/CodeGen/LoongArch/align.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// RUN: %clang_cc1 -triple loongarch32 -target-feature +lsx -target-feature \
2+
// RUN: +lasx -emit-llvm %s -o - | FileCheck %s --check-prefix=LA32
3+
// RUN: %clang_cc1 -triple loongarch64 -target-feature +lsx -target-feature \
4+
// RUN: +lasx -emit-llvm %s -o - | FileCheck %s --check-prefix=LA64
5+
6+
#include <stddef.h>
7+
#include <stdint.h>
8+
9+
char *s1 = "1234";
10+
// LA32: @.str{{.*}} ={{.*}} constant [5 x i8] c"1234\00", align 1
11+
// LA64: @.str{{.*}} ={{.*}} constant [5 x i8] c"1234\00", align 1
12+
13+
char *s2 = "12345678abcd";
14+
// LA32: @.str{{.*}} ={{.*}} constant [13 x i8] c"12345678abcd\00", align 1
15+
// LA64: @.str{{.*}} ={{.*}} constant [13 x i8] c"12345678abcd\00", align 1
16+
17+
char *s3 = "123456789012345678901234567890ab";
18+
// LA32: @.str{{.*}} ={{.*}} constant [33 x i8] c"1234{{.*}}ab\00", align 1
19+
// LA64: @.str{{.*}} ={{.*}} constant [33 x i8] c"1234{{.*}}ab\00", align 1
20+
21+
char *s4 = "123456789012345678901234567890123456789012345678901234567890abcdef";
22+
// LA32: @.str{{.*}} ={{.*}} constant [67 x i8] c"1234{{.*}}cdef\00", align 1
23+
// LA64: @.str{{.*}} ={{.*}} constant [67 x i8] c"1234{{.*}}cdef\00", align 1
24+
25+
int8_t a;
26+
// LA32: @a ={{.*}} global i8 0, align 1
27+
// LA64: @a ={{.*}} global i8 0, align 1
28+
29+
int16_t b;
30+
// LA32: @b ={{.*}} global i16 0, align 2
31+
// LA64: @b ={{.*}} global i16 0, align 2
32+
33+
int32_t c;
34+
// LA32: @c ={{.*}} global i32 0, align 4
35+
// LA64: @c ={{.*}} global i32 0, align 4
36+
37+
int64_t d;
38+
// LA32: @d ={{.*}} global i64 0, align 8
39+
// LA64: @d ={{.*}} global i64 0, align 8
40+
41+
intptr_t e;
42+
// LA32: @e ={{.*}} global i32 0, align 4
43+
// LA64: @e ={{.*}} global i64 0, align 8
44+
45+
float f;
46+
// LA32: @f ={{.*}} global float 0.000000e+00, align 4
47+
// LA64: @f ={{.*}} global float 0.000000e+00, align 4
48+
49+
double g;
50+
// LA32: @g ={{.*}} global double 0.000000e+00, align 8
51+
// LA64: @g ={{.*}} global double 0.000000e+00, align 8
52+
53+
struct H {
54+
int8_t a;
55+
};
56+
struct H h;
57+
// LA32: @h ={{.*}} global %struct.H zeroinitializer, align 1
58+
// LA64: @h ={{.*}} global %struct.H zeroinitializer, align 1

0 commit comments

Comments
 (0)