[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
https://github.com/michaelmaitland updated https://github.com/llvm/llvm-project/pull/79929 >From fafae54117daf3d871e9df63cc4f1430a433edf0 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Mon, 29 Jan 2024 12:33:59 -0800 Subject: [PATCH 1/3] [RISCV] Add support for RISC-V Pointer Masking This patch implements the v0.8.1 specification. This includes support of the `Ssnpm`, `Smnpm`, `Smmpm`, `Sspm` and `Supm` extensions that make up RISC-V pointer masking. All of these extensions only require emitting attribute containing correct `march` string. `Ssnpm`, `Smnpm`, `Smmpm` extensions introduce a 2-bit WARL field (PMM). The extension does not specify how PMM is set, and therefore this patch does not need to address this. One example of how it *could* be set is using the Zicsr instructions to update the PMM bits of the described registers. The full specification can be found at https://github.com/riscv/riscv-j-extension/blob/master/zjpm-spec.pdf --- .../test/Preprocessor/riscv-target-features.c | 45 +++ llvm/docs/RISCVUsage.rst | 3 ++ llvm/docs/ReleaseNotes.rst| 2 + llvm/lib/Support/RISCVISAInfo.cpp | 6 +++ llvm/lib/Target/RISCV/RISCVFeatures.td| 34 ++ llvm/test/CodeGen/RISCV/attributes.ll | 20 + llvm/unittests/Support/RISCVISAInfoTest.cpp | 5 +++ 7 files changed, 115 insertions(+) diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index f81ec7ac4532f2..add96c0046cc73 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -159,6 +159,11 @@ // Experimental extensions +// CHECK-NOT: __riscv_smmpm{{.*$}} +// CHECK-NOT: __riscv_smnpm{{.*$}} +// CHECK-NOT: __riscv_ssnpm{{.*$}} +// CHECK-NOT: __riscv_sspm{{.*$}} +// CHECK-NOT: __riscv_supm{{.*$}} // CHECK-NOT: __riscv_zaamo {{.*$}} // CHECK-NOT: __riscv_zacas {{.*$}} // CHECK-NOT: __riscv_zalasr {{.*$}} @@ -1567,6 +1572,46 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s // CHECK-ZICFISS-EXT: __riscv_zicfiss 4000{{$}} +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// CHECK-SSNPM-EXT: __riscv_ssnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// CHECK-SMNPM-EXT: __riscv_smnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// CHECK-SMMPM-EXT: __riscv_smmpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sspm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_sspm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// CHECK-SSPM-EXT: __riscv_sspm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_supm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_supm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// CHECK-SUPM-EXT: __riscv_supm 8000{{$}} + // Misaligned // RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \ diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index e6d1f41849302e..ae043315aaae20 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -243,6 +243,9 @@ LLVM supports (to various degrees) a number of experimental extensions. All exp The primary goal of experimental support is to assist in the process of ratification by providing an existence proof of an implementation, and simplifying efforts to validate the value of a proposed extension against large code bases. Experimental extensions are expected to either transition to ratified status, or be eventually removed. The decision on whether to accept an experimental extension is currently done on an entirely case by case basis; if you want to propose on
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
@@ -797,6 +797,40 @@ def FeatureStdExtSvpbmt : SubtargetFeature<"svpbmt", "HasStdExtSvpbmt", "true", "'Svpbmt' (Page-Based Memory Types)">; +// Pointer Masking extensions + +// A supervisor-level extension that provides pointer masking for the next lower +// privilege mode (U-mode), and for VS- and VU-modes if the H extension is +// present. +def FeatureStdExtSsnpm +: SubtargetFeature<"experimental-ssnpm", "HasStdExtSsnpm", "true", + "'Ssnpm' (Supervisor-level Pointer Masking)">; topperc wrote: Please add "for Next Lower Privilege Level" to ssnpm and smnpm description. I think that's important and the meaning of the 'n' in the extension name. https://github.com/llvm/llvm-project/pull/79929 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
https://github.com/jaidTw approved this pull request. https://github.com/llvm/llvm-project/pull/79929 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
jaidTw wrote: > > Should you also update the riscv32-toolchain-extra.c and > > riscv64-toolchain-extra.c? > > It is not immediately obvious to me what you had in mind for changing those > tests. Could you please clarify? I found I messed up the configuration so there were some test errors on my end. It works after I fixed it, never mind https://github.com/llvm/llvm-project/pull/79929 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
https://github.com/michaelmaitland updated https://github.com/llvm/llvm-project/pull/79929 >From 0d1c71afab487cc1028fcfc678c111205140ac21 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Mon, 29 Jan 2024 12:33:59 -0800 Subject: [PATCH 1/2] [RISCV] Add support for RISC-V Pointer Masking This patch implements the v0.8.1 specification. This includes support of the `Ssnpm`, `Smnpm`, `Smmpm`, `Sspm` and `Supm` extensions that make up RISC-V pointer masking. All of these extensions only require emitting attribute containing correct `march` string. `Ssnpm`, `Smnpm`, `Smmpm` extensions introduce a 2-bit WARL field (PMM). The extension does not specify how PMM is set, and therefore this patch does not need to address this. One example of how it *could* be set is using the Zicsr instructions to update the PMM bits of the described registers. The full specification can be found at https://github.com/riscv/riscv-j-extension/blob/master/zjpm-spec.pdf --- .../test/Preprocessor/riscv-target-features.c | 45 +++ llvm/docs/RISCVUsage.rst | 3 ++ llvm/docs/ReleaseNotes.rst| 1 + llvm/lib/Support/RISCVISAInfo.cpp | 6 +++ llvm/lib/Target/RISCV/RISCVFeatures.td| 34 ++ llvm/test/CodeGen/RISCV/attributes.ll | 20 + llvm/unittests/Support/RISCVISAInfoTest.cpp | 5 +++ 7 files changed, 114 insertions(+) diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 2361c83a5a6102..82d2efd51a091a 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -142,6 +142,11 @@ // Experimental extensions +// CHECK-NOT: __riscv_smmpm{{.*$}} +// CHECK-NOT: __riscv_smnpm{{.*$}} +// CHECK-NOT: __riscv_ssnpm{{.*$}} +// CHECK-NOT: __riscv_sspm{{.*$}} +// CHECK-NOT: __riscv_supm{{.*$}} // CHECK-NOT: __riscv_zaamo {{.*$}} // CHECK-NOT: __riscv_zacas {{.*$}} // CHECK-NOT: __riscv_zalrsc {{.*$}} @@ -1405,6 +1410,46 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s // CHECK-ZICFISS-EXT: __riscv_zicfiss 4000{{$}} +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// CHECK-SSNPM-EXT: __riscv_ssnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// CHECK-SMNPM-EXT: __riscv_smnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// CHECK-SMMPM-EXT: __riscv_smmpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sspm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_sspm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// CHECK-SSPM-EXT: __riscv_sspm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_supm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_supm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// CHECK-SUPM-EXT: __riscv_supm 8000{{$}} + // Misaligned // RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \ diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index 06292f05b90b82..d07f0480f70240 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -226,6 +226,9 @@ LLVM supports (to various degrees) a number of experimental extensions. All exp The primary goal of experimental support is to assist in the process of ratification by providing an existence proof of an implementation, and simplifying efforts to validate the value of a proposed extension against large code bases. Experimental extensions are expected to either transition to ratified status, or be eventually removed. The decision on whether to accept an experimental extension is currently done on an entirely case by case basis; if you want to propose on
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
llvmbot wrote: @llvm/pr-subscribers-backend-risc-v Author: Michael Maitland (michaelmaitland) Changes This patch implements the v0.8.1 specification. This patch reports version 0.8 in llvm since `RISCVISAInfo::ExtensionVersion` only has a `Major` and `Minor` version number. This patch includes includes support of the `Ssnpm`, `Smnpm`, `Smmpm`, `Sspm` and `Supm` extensions that make up RISC-V pointer masking. All of these extensions require emitting attribute containing correct `march` string. `Ssnpm`, `Smnpm`, `Smmpm` extensions introduce a 2-bit WARL field (PMM). The extension does not specify how PMM is set, and therefore this patch does not need to address this. One example of how it *could* be set is using the Zicsr instructions to update the PMM bits of the described registers. The full specification can be found at https://github.com/riscv/riscv-j-extension/blob/master/zjpm-spec.pdf --- Full diff: https://github.com/llvm/llvm-project/pull/79929.diff 7 Files Affected: - (modified) clang/test/Preprocessor/riscv-target-features.c (+45) - (modified) llvm/docs/RISCVUsage.rst (+3) - (modified) llvm/docs/ReleaseNotes.rst (+1) - (modified) llvm/lib/Support/RISCVISAInfo.cpp (+6) - (modified) llvm/lib/Target/RISCV/RISCVFeatures.td (+34) - (modified) llvm/test/CodeGen/RISCV/attributes.ll (+20) - (modified) llvm/unittests/Support/RISCVISAInfoTest.cpp (+5) ``diff diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 2361c83a5a610..82d2efd51a091 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -142,6 +142,11 @@ // Experimental extensions +// CHECK-NOT: __riscv_smmpm{{.*$}} +// CHECK-NOT: __riscv_smnpm{{.*$}} +// CHECK-NOT: __riscv_ssnpm{{.*$}} +// CHECK-NOT: __riscv_sspm{{.*$}} +// CHECK-NOT: __riscv_supm{{.*$}} // CHECK-NOT: __riscv_zaamo {{.*$}} // CHECK-NOT: __riscv_zacas {{.*$}} // CHECK-NOT: __riscv_zalrsc {{.*$}} @@ -1405,6 +1410,46 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s // CHECK-ZICFISS-EXT: __riscv_zicfiss 4000{{$}} +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// CHECK-SSNPM-EXT: __riscv_ssnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// CHECK-SMNPM-EXT: __riscv_smnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// CHECK-SMMPM-EXT: __riscv_smmpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sspm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_sspm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// CHECK-SSPM-EXT: __riscv_sspm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_supm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_supm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// CHECK-SUPM-EXT: __riscv_supm 8000{{$}} + // Misaligned // RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \ diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst index 06292f05b90b8..d07f0480f7024 100644 --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -226,6 +226,9 @@ LLVM supports (to various degrees) a number of experimental extensions. All exp The primary goal of experimental support is to assist in the process of ratification by providing an existence proof of an implementation, and simplifying efforts to validate the value of a proposed extension against large code bases. Experimental extensions are expected to either transition to ratified status, or be eventually removed. The decision on whether to accept an experimental extension is currently done on an entirely case by case basis; if you want to propose one, attending
[clang] [llvm] [RISCV] Add support for RISC-V Pointer Masking (PR #79929)
https://github.com/michaelmaitland created https://github.com/llvm/llvm-project/pull/79929 This patch implements the v0.8.1 specification. This patch reports version 0.8 in llvm since `RISCVISAInfo::ExtensionVersion` only has a `Major` and `Minor` version number. This patch includes includes support of the `Ssnpm`, `Smnpm`, `Smmpm`, `Sspm` and `Supm` extensions that make up RISC-V pointer masking. All of these extensions require emitting attribute containing correct `march` string. `Ssnpm`, `Smnpm`, `Smmpm` extensions introduce a 2-bit WARL field (PMM). The extension does not specify how PMM is set, and therefore this patch does not need to address this. One example of how it *could* be set is using the Zicsr instructions to update the PMM bits of the described registers. The full specification can be found at https://github.com/riscv/riscv-j-extension/blob/master/zjpm-spec.pdf >From 0d1c71afab487cc1028fcfc678c111205140ac21 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Mon, 29 Jan 2024 12:33:59 -0800 Subject: [PATCH] [RISCV] Add support for RISC-V Pointer Masking This patch implements the v0.8.1 specification. This includes support of the `Ssnpm`, `Smnpm`, `Smmpm`, `Sspm` and `Supm` extensions that make up RISC-V pointer masking. All of these extensions only require emitting attribute containing correct `march` string. `Ssnpm`, `Smnpm`, `Smmpm` extensions introduce a 2-bit WARL field (PMM). The extension does not specify how PMM is set, and therefore this patch does not need to address this. One example of how it *could* be set is using the Zicsr instructions to update the PMM bits of the described registers. The full specification can be found at https://github.com/riscv/riscv-j-extension/blob/master/zjpm-spec.pdf --- .../test/Preprocessor/riscv-target-features.c | 45 +++ llvm/docs/RISCVUsage.rst | 3 ++ llvm/docs/ReleaseNotes.rst| 1 + llvm/lib/Support/RISCVISAInfo.cpp | 6 +++ llvm/lib/Target/RISCV/RISCVFeatures.td| 34 ++ llvm/test/CodeGen/RISCV/attributes.ll | 20 + llvm/unittests/Support/RISCVISAInfoTest.cpp | 5 +++ 7 files changed, 114 insertions(+) diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 2361c83a5a610..82d2efd51a091 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -142,6 +142,11 @@ // Experimental extensions +// CHECK-NOT: __riscv_smmpm{{.*$}} +// CHECK-NOT: __riscv_smnpm{{.*$}} +// CHECK-NOT: __riscv_ssnpm{{.*$}} +// CHECK-NOT: __riscv_sspm{{.*$}} +// CHECK-NOT: __riscv_supm{{.*$}} // CHECK-NOT: __riscv_zaamo {{.*$}} // CHECK-NOT: __riscv_zacas {{.*$}} // CHECK-NOT: __riscv_zalrsc {{.*$}} @@ -1405,6 +1410,46 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s // CHECK-ZICFISS-EXT: __riscv_zicfiss 4000{{$}} +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_ssnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSNPM-EXT %s +// CHECK-SSNPM-EXT: __riscv_ssnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smnpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMNPM-EXT %s +// CHECK-SMNPM-EXT: __riscv_smnpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_smmpm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SMMPM-EXT %s +// CHECK-SMMPM-EXT: __riscv_smmpm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sspm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_sspm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SSPM-EXT %s +// CHECK-SSPM-EXT: __riscv_sspm 8000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_supm0p8 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// RUN: %clang --target=riscv64 \ +// RUN: -march=rv64i_supm0p8 -E -dM %s -menable-experimental-extensions \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SUPM-EXT %s +// CHECK-SUPM-EXT: __riscv_supm 8000{{$}} + // Misaligned // RUN: %clang --target=riscv32