Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /MLRISC/trunk/amd64/instructions/amd64InstrExt.sml
ViewVC logotype

View of /MLRISC/trunk/amd64/instructions/amd64InstrExt.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2811 - (download) (annotate)
Thu Oct 25 20:36:09 2007 UTC (11 years, 10 months ago) by mrainey
File size: 1400 byte(s)
  Added support for the atomic XCHG instruction.
(* amd64InstrExt.sml
 *
 * COPYRIGHT (c) 2007 The Fellowship of SML/NJ (http://smlnj.org)
 *
 * emit code for extensions to the amd64 instruction set.
 *)

structure AMD64InstrExt =
  struct

    datatype fsz = SINGLE | DOUBLE

    datatype ('s, 'r, 'f, 'c) sext 
	= PUSHQ of 'r
 	| POP of 'r 
        | LEAVE
        | RET of 'r
    (* atomic fetch and add operations
     *   XADD (src, dst)            tmp = src + dst
     *                              src = dst
     *                              dst := tmp
     *)
        | LOCK_XADDL of ('r * 'r)	(* 32-bit atomic fetch and add *)
        | LOCK_XADDQ of ('r * 'r)	(* 64-bit atomic fetch and add *)
    (* atomic compare and exchange instructions.
     *   CMPXCHG(src, dst)	compares dst with %eax (or %rax) register.
     *				if they are equal, then the ZF flag is set and
     *				src is stored in dst; otherwise dst is loaded
     *				into %eax (or %rax) and ZF is cleared.
     *)
        | LOCK_CMPXCHGL of ('r * 'r)	(* 32-bit compare and exchange *)
        | LOCK_CMPXCHGQ of ('r * 'r)	(* 64-bit compare and exchange *)
    (* atomic exchange instructions.
     *   XCHG(src, dst)	       tmp = *dst
     *                         *dst := src
     *                         src := tmp
     *)
        | LOCK_XCHGL of ('r * 'r)	(* 32-bit exchange *)
        | LOCK_XCHGQ of ('r * 'r)	(* 64-bit exchange *)

  end (* AMD64InstrExt *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0