xref: /aosp_15_r20/external/clang/test/CodeGen/builtin-cpu-supports.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm < %s| FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // Test that we have the structure definition, the gep offsets, the name of the
4*67e74705SXin Li // global, the bit grab, and the icmp correct.
5*67e74705SXin Li extern void a(const char *);
6*67e74705SXin Li 
main()7*67e74705SXin Li int main() {
8*67e74705SXin Li   if (__builtin_cpu_supports("sse4.2"))
9*67e74705SXin Li     a("sse4.2");
10*67e74705SXin Li 
11*67e74705SXin Li   // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 3, i32 0)
12*67e74705SXin Li   // CHECK: [[AND:%[^ ]+]] = and i32 [[LOAD]], 256
13*67e74705SXin Li   // CHECK: = icmp ne i32 [[AND]], 0
14*67e74705SXin Li 
15*67e74705SXin Li   return 0;
16*67e74705SXin Li }
17