blob: f2a5f54a0c8086ce5d5b117b8b93d9601dc81b49 [file] [log] [blame]
Craig Topper699ae0c2017-08-10 20:28:30 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm < %s| FileCheck %s
2
3// Test that we have the structure definition, the gep offsets, the name of the
4// global, the bit grab, and the icmp correct.
5extern void a(const char *);
6
7void intel() {
8 if (__builtin_cpu_is("intel"))
9 a("intel");
10
11 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 0)
12 // CHECK: = icmp eq i32 [[LOAD]], 1
13}
14
15void amd() {
16 if (__builtin_cpu_is("amd"))
17 a("amd");
18
19 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 0)
20 // CHECK: = icmp eq i32 [[LOAD]], 2
21}
22
23void atom() {
24 if (__builtin_cpu_is("atom"))
25 a("atom");
26
27 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 1)
28 // CHECK: = icmp eq i32 [[LOAD]], 1
29}
30
31void amdfam10h() {
32 if (__builtin_cpu_is("amdfam10h"))
33 a("amdfam10h");
34
35 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 1)
36 // CHECK: = icmp eq i32 [[LOAD]], 4
37}
38
39void barcelona() {
40 if (__builtin_cpu_is("barcelona"))
41 a("barcelona");
42
43 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 2)
44 // CHECK: = icmp eq i32 [[LOAD]], 4
45}
46
47void nehalem() {
48 if (__builtin_cpu_is("nehalem"))
49 a("nehalem");
50
51 // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 2)
52 // CHECK: = icmp eq i32 [[LOAD]], 1
53}