Debian Codegraph @

lib/mlrisc-lib/MLRISC/amd64/instructions/amd64InstrExt.sml

raw
1 (* amd64InstrExt.sml
2 *
3 * COPYRIGHT (c) 2007 The Fellowship of SML/NJ (http://smlnj.org)
4 *
5 * emit code for extensions to the amd64 instruction set.
6 *)
7
8 structure AMD64InstrExt =
9 struct
10
11 datatype fsz = SINGLE | DOUBLE
12
13 datatype ('s, 'r, 'f, 'c) sext
14 = PUSHQ of 'r
15 | POP of 'r
16 | LEAVE
17 | RET of 'r
18 (* atomic fetch and add operations
19 * XADD (src, dst) tmp = src + dst
20 * src = dst
21 * dst := tmp
22 *)
23 | LOCK_XADDL of ('r * 'r) (* 32-bit atomic fetch and add *)
24 | LOCK_XADDQ of ('r * 'r) (* 64-bit atomic fetch and add *)
25 (* atomic compare and exchange instructions.
26 * CMPXCHG(src, dst) compares dst with %eax (or %rax) register.
27 * if they are equal, then the ZF flag is set and
28 * src is stored in dst; otherwise dst is loaded
29 * into %eax (or %rax) and ZF is cleared.
30 *)
31 | LOCK_CMPXCHGL of ('r * 'r) (* 32-bit compare and exchange *)
32 | LOCK_CMPXCHGQ of ('r * 'r) (* 64-bit compare and exchange *)
33 (* atomic exchange instructions.
34 * XCHG(src, dst) tmp = *dst
35 * *dst := src
36 * src := tmp
37 *)
38 | LOCK_XCHGL of ('r * 'r) (* 32-bit exchange *)
39 | LOCK_XCHGQ of ('r * 'r) (* 64-bit exchange *)
40 | PAUSE (* improves performance of spin-wait loops *)
41 (* performs a serializing operation on all load-from-memory and store-to-memory
42 * operations issued prior to the mfence instruction.
43 *)
44 | MFENCE
45 (* performs a serializing operation on all load-to-memory operations issued prior to
46 * the lfence instruction.
47 *)
48 | LFENCE
49 (* performs a serializing operation on all store-to-memory operations issued prior to
50 * the sfence instruction.
51 *)
52 | SFENCE
53 (* time-stamp counter (TSC) operations
54 * RDTSC edx := <high-order 32 bits of the processor's time-stamp counter>
55 * eax := <low-order 32 bits of the processor's time-stamp counter>
56 *
57 * RDTSCP edx := <high-order 32 bits of the processor's time-stamp counter>
58 * eax := <low-order 32 bits of the processor's time-stamp counter>
59 * ecx := <processor's cpu id>
60 * *** waits until all previous instructions have been executed
61 * before the reading the counter
62 *)
63 | RDTSC
64 | RDTSCP
65
66 end (* AMD64InstrExt *)