summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/inline/inline-instruction-set.rs
blob: be36ff50c7ef13316cf3a442fc3d70249a986911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Checks that only functions with the compatible instruction_set attributes are inlined.
//
// compile-flags: --target thumbv4t-none-eabi
// needs-llvm-components: arm

#![crate_type = "lib"]
#![feature(rustc_attrs)]
#![feature(no_core, lang_items)]
#![feature(isa_attribute)]
#![no_core]

#[rustc_builtin_macro]
#[macro_export]
macro_rules! asm {
    ("assembly template",
        $(operands,)*
        $(options($(option),*))?
    ) => {
        /* compiler built-in */
    };
}

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

#[instruction_set(arm::a32)]
#[inline]
fn instruction_set_a32() {}

#[instruction_set(arm::t32)]
#[inline]
fn instruction_set_t32() {}

#[inline]
fn instruction_set_default() {}

// EMIT_MIR inline_instruction_set.t32.Inline.diff
#[instruction_set(arm::t32)]
pub fn t32() {
    instruction_set_a32();
    instruction_set_t32();
    // The default instruction set is currently
    // conservatively assumed to be incompatible.
    instruction_set_default();
}

// EMIT_MIR inline_instruction_set.default.Inline.diff
pub fn default() {
    instruction_set_a32();
    instruction_set_t32();
    instruction_set_default();
}