Aaron Ballman | 674cf26 | 2015-05-26 19:44:52 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -fms-volatile -o - < %s | FileCheck %s |
David Majnemer | a5b195a | 2015-02-14 01:35:12 +0000 | [diff] [blame] | 2 | struct foo { |
| 3 | volatile int x; |
| 4 | }; |
| 5 | struct bar { |
| 6 | int x; |
| 7 | }; |
| 8 | typedef _Complex float __declspec(align(8)) baz; |
| 9 | |
David Majnemer | a38c9f1 | 2016-05-24 16:09:25 +0000 | [diff] [blame] | 10 | #pragma pack(push) |
| 11 | #pragma pack(1) |
| 12 | struct qux { |
| 13 | volatile int f; |
| 14 | }; |
| 15 | #pragma pack(pop) |
| 16 | |
David Majnemer | a5b195a | 2015-02-14 01:35:12 +0000 | [diff] [blame] | 17 | void 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 | } |
| 23 | void 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 | } |
| 29 | void 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 | } |
| 35 | void 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 | } |
| 41 | void 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 | } |
| 47 | void 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 | } |
| 53 | void 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 | } |
| 59 | void test8(volatile double *p, volatile double *q) { |
| 60 | *p = *q; |
| 61 | // CHECK-LABEL: @test8 |
David Majnemer | fc80b6e | 2016-01-22 16:36:44 +0000 | [diff] [blame] | 62 | // CHECK: load volatile {{.*}} |
| 63 | // CHECK: store volatile {{.*}}, {{.*}} |
David Majnemer | a5b195a | 2015-02-14 01:35:12 +0000 | [diff] [blame] | 64 | } |
| 65 | void test9(volatile baz *p, baz *q) { |
| 66 | *p = *q; |
| 67 | // CHECK-LABEL: @test9 |
David Majnemer | a38c9f1 | 2016-05-24 16:09:25 +0000 | [diff] [blame] | 68 | // CHECK: store volatile {{.*}}, {{.*}} |
| 69 | // CHECK: store volatile {{.*}}, {{.*}} |
David Majnemer | a5b195a | 2015-02-14 01:35:12 +0000 | [diff] [blame] | 70 | } |
David Majnemer | fc80b6e | 2016-01-22 16:36:44 +0000 | [diff] [blame] | 71 | void 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 | } |
| 77 | void 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 Majnemer | a38c9f1 | 2016-05-24 16:09:25 +0000 | [diff] [blame] | 83 | int test12(struct qux *p) { |
| 84 | return p->f; |
| 85 | // CHECK-LABEL: @test12 |
| 86 | // CHECK: load volatile {{.*}} |
| 87 | } |