| 1 |
// RUN: %clang_cc1 -x c -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 2 |
// RUN: -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-cir -o %t.cir %s |
| 3 |
// RUN: FileCheck --check-prefixes=CIR,CIR-X86 --input-file=%t.cir %s |
| 4 |
// RUN: %clang_cc1 -x c++ -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 5 |
// RUN: -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-cir -o %t.cir %s |
| 6 |
// RUN: FileCheck --check-prefixes=CIR,CIR-X86 --input-file=%t.cir %s |
| 7 |
|
| 8 |
// RUN: %clang_cc1 -x c -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 9 |
// RUN: -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-llvm -o %t.ll %s |
| 10 |
// RUN: FileCheck --check-prefixes=LLVM,LLVM-X86 --input-file=%t.ll %s |
| 11 |
// RUN: %clang_cc1 -x c++ -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 12 |
// RUN: -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-llvm -o %t.ll %s |
| 13 |
// RUN: FileCheck --check-prefixes=LLVM,LLVM-X86 --input-file=%t.ll %s |
| 14 |
|
| 15 |
// RUN: %clang_cc1 -x c -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 16 |
// RUN: -triple x86_64-unknown-linux -emit-llvm -Wall -Werror %s -o - \ |
| 17 |
// RUN: | FileCheck %s --check-prefixes=OGCG,OGCG-X86 |
| 18 |
// RUN: %clang_cc1 -x c++ -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 19 |
// RUN: -triple x86_64-unknown-linux -emit-llvm -Wall -Werror %s -o - \ |
| 20 |
// RUN: | FileCheck %s --check-prefixes=OGCG,OGCG-X86 |
| 21 |
|
| 22 |
// This test copies clang/test/CodeGen/ms-barriers-intrinsics.c. |
| 23 |
|
| 24 |
void _ReadWriteBarrier(void); |
| 25 |
void _ReadBarrier(void); |
| 26 |
void _WriteBarrier(void); |
| 27 |
void __faststorefence(void); |
| 28 |
|
| 29 |
void test_ReadWriteBarrier(void) { _ReadWriteBarrier(); } |
| 30 |
// CIR-LABEL: test_ReadWriteBarrier |
| 31 |
// CIR: cir.atomic.fence syncscope(single_thread) seq_cst |
| 32 |
// CIR: cir.return |
| 33 |
|
| 34 |
// LLVM-LABEL: test_ReadWriteBarrier |
| 35 |
// LLVM: fence syncscope("singlethread") seq_cst |
| 36 |
// LLVM: ret void |
| 37 |
|
| 38 |
// OGCG-LABEL: test_ReadWriteBarrier |
| 39 |
// OGCG: fence syncscope("singlethread") seq_cst |
| 40 |
// OGCG: ret void |
| 41 |
|
| 42 |
void test_ReadBarrier(void) { _ReadBarrier(); } |
| 43 |
// CIR-LABEL: test_ReadBarrier |
| 44 |
// CIR: cir.atomic.fence syncscope(single_thread) seq_cst |
| 45 |
// CIR: cir.return |
| 46 |
|
| 47 |
// LLVM-LABEL: test_ReadBarrier |
| 48 |
// LLVM: fence syncscope("singlethread") seq_cst |
| 49 |
// LLVM: ret void |
| 50 |
|
| 51 |
// OGCG-LABEL: test_ReadBarrier |
| 52 |
// OGCG: fence syncscope("singlethread") seq_cst |
| 53 |
// OGCG: ret void |
| 54 |
|
| 55 |
void test_WriteBarrier(void) { _WriteBarrier(); } |
| 56 |
// CIR-LABEL: test_WriteBarrier |
| 57 |
// CIR: cir.atomic.fence syncscope(single_thread) seq_cst |
| 58 |
// CIR: cir.return |
| 59 |
|
| 60 |
// LLVM-LABEL: test_WriteBarrier |
| 61 |
// LLVM: fence syncscope("singlethread") seq_cst |
| 62 |
// LLVM: ret void |
| 63 |
|
| 64 |
// OGCG-LABEL: test_WriteBarrier |
| 65 |
// OGCG: fence syncscope("singlethread") seq_cst |
| 66 |
// OGCG: ret void |
| 67 |
|
| 68 |
#if defined(__x86_64__) |
| 69 |
void test__faststorefence(void) { __faststorefence(); } |
| 70 |
// CIR-X86-LABEL: test__faststorefence |
| 71 |
// CIR-X86: cir.atomic.fence syncscope(system) seq_cst |
| 72 |
// CIR-X86: cir.return |
| 73 |
|
| 74 |
// LLVM-X86-LABEL: test__faststorefence |
| 75 |
// LLVM-X86: fence seq_cst |
| 76 |
// LLVM-X86: ret void |
| 77 |
|
| 78 |
// OGCG-X86-LABEL: test__faststorefence |
| 79 |
// OGCG-X86: fence seq_cst |
| 80 |
// OGCG-X86: ret void |
| 81 |
#endif |
| 82 |
|