Craig Topper | 699ae0c | 2017-08-10 20:28:30 +0000 | [diff] [blame^] | 1 | // 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. |
| 5 | extern void a(const char *); |
| 6 | |
| 7 | void 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 | |
| 15 | void 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 | |
| 23 | void 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 | |
| 31 | void 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 | |
| 39 | void 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 | |
| 47 | void 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 | } |