File: m68k-types.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (67 lines) | stat: -rw-r--r-- 1,612 bytes parent folder | download | duplicates (4)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ compile-flags: --target m68k-unknown-linux-gnu
//@ needs-llvm-components: m68k

#![feature(no_core, asm_experimental_arch)]
#![crate_type = "rlib"]
#![no_core]
#![allow(non_camel_case_types)]

extern crate minicore;
use minicore::*;

type ptr = *const u64;

macro_rules! check {
    ($func:ident $ty:ident $class:ident $mov:literal) => {
        #[no_mangle]
        pub unsafe fn $func(x: $ty) -> $ty {
            let y;
            asm!(concat!($mov, " {}, {};"), out($class) y, in($class) x);
            y
        }
    };
}

// CHECK-LABEL: reg_data_i8:
// CHECK: ;APP
// CHECK: move.b %d{{[0-9]}}, %d{{[0-9]}}
// CHECK: ;NO_APP
check!(reg_data_i8 i8 reg_data "move.b");

// CHECK-LABEL: reg_data_i16:
// CHECK: ;APP
// CHECK: move.w %d{{[0-9]}}, %d{{[0-9]}}
// CHECK: ;NO_APP
check!(reg_data_i16 i16 reg_data "move.w");

// CHECK-LABEL: reg_data_i32:
// CHECK: ;APP
// CHECK: move.l %d{{[0-9]}}, %d{{[0-9]}}
// CHECK: ;NO_APP
check!(reg_data_i32 i32 reg_data "move.l");

// CHECK-LABEL: reg_addr_i16:
// CHECK: ;APP
// CHECK: move.w %a{{[0-9]}}, %a{{[0-9]}}
// CHECK: ;NO_APP
check!(reg_addr_i16 i16 reg_addr "move.w");

// CHECK-LABEL: reg_addr_i32:
// CHECK: ;APP
// CHECK: move.l %a{{[0-9]}}, %a{{[0-9]}}
// CHECK: ;NO_APP
check!(reg_addr_i32 i32 reg_addr "move.l");

// CHECK-LABEL: reg_i16:
// CHECK: ;APP
// CHECK: move.w %{{[da][0-9]}}, %{{[da][0-9]}}
// CHECK: ;NO_APP
check!(reg_i16 i16 reg "move.w");

// CHECK-LABEL: reg_i32:
// CHECK: ;APP
// CHECK: move.l %{{[da][0-9]}}, %{{[da][0-9]}}
// CHECK: ;NO_APP
check!(reg_i32 i32 reg "move.l");