xref: /llvm-project/clang/test/CodeGen/LoongArch/attributes.cpp (revision 4df566290751403f470fea3b27aa148ab1ddf144)
1 // RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
2 
3 // CHECK: @_ZL2v1 ={{.*}} global i32 0, code_model "small"
4 static int v1 __attribute__((model("normal")));
5 
use1()6 void use1() {
7   v1 = 1;
8 }
9 
10 // CHECK: @v2 ={{.*}} global i32 0, code_model "medium"
11 int v2 __attribute__((model("medium")));
12 
13 // CHECK: @v3 ={{.*}} global float 0.000000e+00, code_model "large"
14 float v3 __attribute__((model("extreme")));
15 
16 // CHECK: @_ZL2v4IiE ={{.*}} global i32 0, code_model "medium"
17 template <typename T>
18 static T v4 __attribute__((model("medium")));
19 
use2()20 void use2() {
21   v4<int> = 1;
22 }
23 
24 struct S {
25   double d;
26 };
27 
28 // CHECK: @v5 ={{.*}} global {{.*}}, code_model "medium"
29 S v5 __attribute__((model("medium")));
30 
31 typedef void (*F)();
32 
33 // CHECK: @v6 ={{.*}} global ptr null, code_model "large"
34 F v6 __attribute__((model("extreme")));
35