[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / builtin-cpu-is.c
blobdab6d2f9d11aec915724282122f78a8540e20238
1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm < %s| FileCheck %s
3 // Test that we have the structure definition, the gep offsets, the name of the
4 // global, the bit grab, and the icmp correct.
5 extern void a(const char *);
7 // CHECK: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] }
9 void intel(void) {
10 if (__builtin_cpu_is("intel"))
11 a("intel");
13 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr @__cpu_model
14 // CHECK: = icmp eq i32 [[LOAD]], 1
17 void amd(void) {
18 if (__builtin_cpu_is("amd"))
19 a("amd");
21 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr @__cpu_model
22 // CHECK: = icmp eq i32 [[LOAD]], 2
25 void atom(void) {
26 if (__builtin_cpu_is("atom"))
27 a("atom");
29 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 1)
30 // CHECK: = icmp eq i32 [[LOAD]], 1
33 void amdfam10h(void) {
34 if (__builtin_cpu_is("amdfam10h"))
35 a("amdfam10h");
37 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 1)
38 // CHECK: = icmp eq i32 [[LOAD]], 4
41 void barcelona(void) {
42 if (__builtin_cpu_is("barcelona"))
43 a("barcelona");
45 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 2)
46 // CHECK: = icmp eq i32 [[LOAD]], 4
49 void nehalem(void) {
50 if (__builtin_cpu_is("nehalem"))
51 a("nehalem");
53 // CHECK: [[LOAD:%[^ ]+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 2)
54 // CHECK: = icmp eq i32 [[LOAD]], 1