1 | // Test frontend handling of nontemporal builtins. |
2 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s |
3 | |
4 | signed char sc; |
5 | unsigned char uc; |
6 | signed short ss; |
7 | unsigned short us; |
8 | signed int si; |
9 | unsigned int ui; |
10 | signed long long sll; |
11 | unsigned long long ull; |
12 | float f1, f2; |
13 | double d1, d2; |
14 | float __attribute__((vector_size(16))) vf1, vf2; |
15 | char __attribute__((vector_size(8))) vc1, vc2; |
16 | bool b1, b2; |
17 | |
18 | void test_all_sizes(void) // CHECK-LABEL: test_all_sizes |
19 | { |
20 | __builtin_nontemporal_store(true, &b1); // CHECK: store i8 1, i8* @b1, align 1, !nontemporal |
21 | __builtin_nontemporal_store(b1, &b2); // CHECK: store i8{{.*}}, align 1, !nontemporal |
22 | __builtin_nontemporal_store(1, &uc); // CHECK: store i8{{.*}}align 1, !nontemporal |
23 | __builtin_nontemporal_store(1, &sc); // CHECK: store i8{{.*}}align 1, !nontemporal |
24 | __builtin_nontemporal_store(1, &us); // CHECK: store i16{{.*}}align 2, !nontemporal |
25 | __builtin_nontemporal_store(1, &ss); // CHECK: store i16{{.*}}align 2, !nontemporal |
26 | __builtin_nontemporal_store(1, &ui); // CHECK: store i32{{.*}}align 4, !nontemporal |
27 | __builtin_nontemporal_store(1, &si); // CHECK: store i32{{.*}}align 4, !nontemporal |
28 | __builtin_nontemporal_store(1, &ull); // CHECK: store i64{{.*}}align 8, !nontemporal |
29 | __builtin_nontemporal_store(1, &sll); // CHECK: store i64{{.*}}align 8, !nontemporal |
30 | __builtin_nontemporal_store(1.0, &f1); // CHECK: store float{{.*}}align 4, !nontemporal |
31 | __builtin_nontemporal_store(1.0, &d1); // CHECK: store double{{.*}}align 8, !nontemporal |
32 | __builtin_nontemporal_store(vf1, &vf2); // CHECK: store <4 x float>{{.*}}align 16, !nontemporal |
33 | __builtin_nontemporal_store(vc1, &vc2); // CHECK: store <8 x i8>{{.*}}align 8, !nontemporal |
34 | |
35 | b1 = __builtin_nontemporal_load(&b2); // CHECK: load i8{{.*}}align 1, !nontemporal |
36 | uc = __builtin_nontemporal_load(&sc); // CHECK: load i8{{.*}}align 1, !nontemporal |
37 | sc = __builtin_nontemporal_load(&uc); // CHECK: load i8{{.*}}align 1, !nontemporal |
38 | us = __builtin_nontemporal_load(&ss); // CHECK: load i16{{.*}}align 2, !nontemporal |
39 | ss = __builtin_nontemporal_load(&us); // CHECK: load i16{{.*}}align 2, !nontemporal |
40 | ui = __builtin_nontemporal_load(&si); // CHECK: load i32{{.*}}align 4, !nontemporal |
41 | si = __builtin_nontemporal_load(&ui); // CHECK: load i32{{.*}}align 4, !nontemporal |
42 | ull = __builtin_nontemporal_load(&sll); // CHECK: load i64{{.*}}align 8, !nontemporal |
43 | sll = __builtin_nontemporal_load(&ull); // CHECK: load i64{{.*}}align 8, !nontemporal |
44 | f1 = __builtin_nontemporal_load(&f2); // CHECK: load float{{.*}}align 4, !nontemporal |
45 | d1 = __builtin_nontemporal_load(&d2); // CHECK: load double{{.*}}align 8, !nontemporal |
46 | vf2 = __builtin_nontemporal_load(&vf1); // CHECK: load <4 x float>{{.*}}align 16, !nontemporal |
47 | vc2 = __builtin_nontemporal_load(&vc1); // CHECK: load <8 x i8>{{.*}}align 8, !nontemporal |
48 | } |
49 | |