diff options
Diffstat (limited to 'clang/test/CodeGen/RISCV/atomics-intrinsics/zawrs.c')
-rw-r--r-- | clang/test/CodeGen/RISCV/atomics-intrinsics/zawrs.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/CodeGen/RISCV/atomics-intrinsics/zawrs.c b/clang/test/CodeGen/RISCV/atomics-intrinsics/zawrs.c new file mode 100644 index 0000000..e3d4899 --- /dev/null +++ b/clang/test/CodeGen/RISCV/atomics-intrinsics/zawrs.c @@ -0,0 +1,42 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// REQUIRES: riscv-registered-target +// RUN: %clang_cc1 -triple riscv32 -target-feature +zawrs -disable-O0-optnone \ +// RUN: -emit-llvm %s -o - | opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefixes=CHECK-RV32 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +zawrs -disable-O0-optnone \ +// RUN: -emit-llvm %s -o - | opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefix=CHECK-RV64 %s + +#include <riscv_atomic.h> + +// CHECK-RV32-LABEL: define dso_local void @zawrs_nto +// CHECK-RV32-SAME: () #[[ATTR0:[0-9]+]] { +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: call void @llvm.riscv.wrs.nto() +// CHECK-RV32-NEXT: ret void +// +// CHECK-RV64-LABEL: define dso_local void @zawrs_nto +// CHECK-RV64-SAME: () #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: call void @llvm.riscv.wrs.nto() +// CHECK-RV64-NEXT: ret void +// +void zawrs_nto() { + __riscv_wrs_nto(); +} + +// CHECK-RV32-LABEL: define dso_local void @zawrs_sto +// CHECK-RV32-SAME: () #[[ATTR0]] { +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: call void @llvm.riscv.wrs.sto() +// CHECK-RV32-NEXT: ret void +// +// CHECK-RV64-LABEL: define dso_local void @zawrs_sto +// CHECK-RV64-SAME: () #[[ATTR0]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: call void @llvm.riscv.wrs.sto() +// CHECK-RV64-NEXT: ret void +// +void zawrs_sto() { + __riscv_wrs_sto(); +} |