blob: a3ef35a3faadc928c77f4c7103074be7a5079a11 [file] [log] [blame]
Aaron Ballman674cf262015-05-26 19:44:52 +00001// RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -fms-volatile -o - < %s | FileCheck %s
David Majnemera5b195a2015-02-14 01:35:12 +00002struct foo {
3 volatile int x;
4};
5struct bar {
6 int x;
7};
8typedef _Complex float __declspec(align(8)) baz;
9
David Majnemera38c9f12016-05-24 16:09:25 +000010#pragma pack(push)
11#pragma pack(1)
12struct qux {
13 volatile int f;
14};
15#pragma pack(pop)
16
David Majnemera5b195a2015-02-14 01:35:12 +000017void test1(struct foo *p, struct foo *q) {
18 *p = *q;
19 // CHECK-LABEL: @test1
20 // CHECK: load atomic volatile {{.*}} acquire
21 // CHECK: store atomic volatile {{.*}}, {{.*}} release
22}
23void test2(volatile int *p, volatile int *q) {
24 *p = *q;
25 // CHECK-LABEL: @test2
26 // CHECK: load atomic volatile {{.*}} acquire
27 // CHECK: store atomic volatile {{.*}}, {{.*}} release
28}
29void test3(struct foo *p, struct foo *q) {
30 p->x = q->x;
31 // CHECK-LABEL: @test3
32 // CHECK: load atomic volatile {{.*}} acquire
33 // CHECK: store atomic volatile {{.*}}, {{.*}} release
34}
35void test4(volatile struct foo *p, volatile struct foo *q) {
36 p->x = q->x;
37 // CHECK-LABEL: @test4
38 // CHECK: load atomic volatile {{.*}} acquire
39 // CHECK: store atomic volatile {{.*}}, {{.*}} release
40}
41void test5(volatile struct foo *p, volatile struct foo *q) {
42 *p = *q;
43 // CHECK-LABEL: @test5
44 // CHECK: load atomic volatile {{.*}} acquire
45 // CHECK: store atomic volatile {{.*}}, {{.*}} release
46}
47void test6(struct bar *p, struct bar *q) {
48 *p = *q;
49 // CHECK-LABEL: @test6
50 // CHECK-NOT: load atomic volatile {{.*}}
51 // CHECK-NOT: store atomic volatile {{.*}}, {{.*}}
52}
53void test7(volatile struct bar *p, volatile struct bar *q) {
54 *p = *q;
55 // CHECK-LABEL: @test7
56 // CHECK: load atomic volatile {{.*}} acquire
57 // CHECK: store atomic volatile {{.*}}, {{.*}} release
58}
59void test8(volatile double *p, volatile double *q) {
60 *p = *q;
61 // CHECK-LABEL: @test8
David Majnemerfc80b6e2016-01-22 16:36:44 +000062 // CHECK: load volatile {{.*}}
63 // CHECK: store volatile {{.*}}, {{.*}}
David Majnemera5b195a2015-02-14 01:35:12 +000064}
65void test9(volatile baz *p, baz *q) {
66 *p = *q;
67 // CHECK-LABEL: @test9
David Majnemera38c9f12016-05-24 16:09:25 +000068 // CHECK: store volatile {{.*}}, {{.*}}
69 // CHECK: store volatile {{.*}}, {{.*}}
David Majnemera5b195a2015-02-14 01:35:12 +000070}
David Majnemerfc80b6e2016-01-22 16:36:44 +000071void test10(volatile long long *p, volatile long long *q) {
72 *p = *q;
73 // CHECK-LABEL: @test10
74 // CHECK: load volatile {{.*}}
75 // CHECK: store volatile {{.*}}, {{.*}}
76}
77void test11(volatile float *p, volatile float *q) {
78 *p = *q;
79 // CHECK-LABEL: @test11
80 // CHECK: load atomic volatile {{.*}} acquire
81 // CHECK: store atomic volatile {{.*}}, {{.*}} release
82}
David Majnemera38c9f12016-05-24 16:09:25 +000083int test12(struct qux *p) {
84 return p->f;
85 // CHECK-LABEL: @test12
86 // CHECK: load volatile {{.*}}
87}