--- /dev/null
+# Compile tests, no torture testing.
+#
+# These tests should all pass.
+
+# Load support procs.
+load_lib gm2-dg.exp
+
+gm2_init_pim4 $srcdir/$subdir -masm=intel
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] "" ""
+
+# All done.
+dg-finish
--- /dev/null
+(* { dg-do assemble { target { x86_64-*-gnu* } } } *)
+(* { dg-options "-masm=intel" } *)
+(* { dg-do run { target x86_64-*-gnu* } } *)
+
+MODULE exampleadd2 ;
+
+FROM libc IMPORT printf, exit ;
+
+
+PROCEDURE Example (foo, bar: LONGCARD) : CARDINAL ;
+VAR
+ myout: LONGCARD ;
+BEGIN
+ ASM VOLATILE (
+ "mov rax, %[left]; add rax, %[right]; mov %[output], rax;"
+ : [output] "=rm" (myout) (* outputs *)
+ : [left] "rm" (foo), [right] "rm" (bar) (* inputs *)
+ : "rax") ; (* we trash *)
+ RETURN( myout )
+END Example ;
+
+VAR
+ a, b, c: CARDINAL ;
+BEGIN
+ a := 1 ;
+ b := 2 ;
+ c := Example (a, b) ;
+ IF c = 3
+ THEN
+ printf ("success result from function is %d\n", c) ;
+ ELSE
+ printf ("example failed to return 3, seen %d\n" , c) ;
+ exit (1)
+ END
+END exampleadd2.
\ No newline at end of file