Debian Codegraph @

clang/test/Sema/riscv-interrupt-attr-rnmi.c

raw
1 // RUN: %clang_cc1 -triple riscv32-unknown-elf -target-feature +smrnmi -emit-llvm -DCHECK_IR < %s | FileCheck %s
2 // RUN: %clang_cc1 %s -triple riscv32-unknown-elf -target-feature +smrnmi -verify=enabled,both -fsyntax-only
3 // RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify=disabled,both -fsyntax-only
4 // RUN: %clang_cc1 %s -triple riscv32-unknown-elf -target-feature -srnmi -verify=disabled,both -fsyntax-only
5
6 #if defined(CHECK_IR)
7 // CHECK-LABEL: foo_rnmi_interrupt() #0
8 // CHECK: ret void
9 __attribute__((interrupt("rnmi")))
10 void foo_rnmi_interrupt(void) {}
11
12 // CHECK-LABEL: @foo_rnmi_rnmi_interrupt() #0
13 // CHECK: ret void
14 __attribute__((interrupt("rnmi", "rnmi")))
15 void foo_rnmi_rnmi_interrupt(void) {}
16
17 // CHECK: attributes #0
18 // CHECK: "interrupt"="rnmi"
19 #else
20
21 __attribute__((interrupt("rnmi"))) void test_rnmi(void) {} // disabled-error {{RISC-V 'interrupt' attribute 'rnmi' requires extension 'Smrnmi'}}
22 __attribute__((interrupt("rnmi", "rnmi"))) void test_rnmi_rnmi(void) {} // disabled-error {{RISC-V 'interrupt' attribute 'rnmi' requires extension 'Smrnmi'}}
23
24 __attribute__((interrupt("rnmi", "supervisor"))) void foo_rnmi_supervisor(void) {} // both-error {{RISC-V 'interrupt' attribute contains invalid combination of interrupt types}}
25 __attribute__((interrupt("rnmi", "machine"))) void foo_rnmi_machine(void) {} // both-error {{RISC-V 'interrupt' attribute contains invalid combination of interrupt types}}
26
27 __attribute__((interrupt("RNMI"))) void test_RNMI(void) {} // both-warning {{'interrupt' attribute argument not supported: "RNMI"}}
28 #endif