1b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -fms-volatile -o - < %s | FileCheck %s
20e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesstruct foo {
30e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  volatile int x;
40e2c34f92f00628d48968dfea096d36381f494cbStephen Hines};
50e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesstruct bar {
60e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  int x;
70e2c34f92f00628d48968dfea096d36381f494cbStephen Hines};
80e2c34f92f00628d48968dfea096d36381f494cbStephen Hinestypedef _Complex float __declspec(align(8)) baz;
90e2c34f92f00628d48968dfea096d36381f494cbStephen Hines
100e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test1(struct foo *p, struct foo *q) {
110e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
120e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test1
130e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
140e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
150e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
160e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test2(volatile int *p, volatile int *q) {
170e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
180e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test2
190e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
200e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
210e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
220e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test3(struct foo *p, struct foo *q) {
230e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  p->x = q->x;
240e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test3
250e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
260e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
270e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
280e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test4(volatile struct foo *p, volatile struct foo *q) {
290e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  p->x = q->x;
300e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test4
310e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
320e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
330e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
340e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test5(volatile struct foo *p, volatile struct foo *q) {
350e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
360e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test5
370e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
380e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
390e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
400e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test6(struct bar *p, struct bar *q) {
410e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
420e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test6
430e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-NOT: load atomic volatile {{.*}}
440e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-NOT: store atomic volatile {{.*}}, {{.*}}
450e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
460e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test7(volatile struct bar *p, volatile struct bar *q) {
470e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
480e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test7
490e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
500e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
510e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
520e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test8(volatile double *p, volatile double *q) {
530e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
540e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test8
550e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: load atomic volatile {{.*}} acquire
560e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
570e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
580e2c34f92f00628d48968dfea096d36381f494cbStephen Hinesvoid test9(volatile baz *p, baz *q) {
590e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  *p = *q;
600e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK-LABEL: @test9
610e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  // CHECK: store atomic volatile {{.*}}, {{.*}} release
620e2c34f92f00628d48968dfea096d36381f494cbStephen Hines}
63