mescc: Support bitwise or.

* module/mes/as-i386.mes (i386:accu-or-base): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): Use it; support bitwise or.
* scaffold/t.c (math_test): Test it.
* scaffold/mini-mes.c (logior): Use it.
This commit is contained in:
Jan Nieuwenhuizen 2017-03-24 23:15:01 +01:00
parent ca633abdda
commit 040b9aedfc
4 changed files with 8 additions and 3 deletions

View File

@ -131,6 +131,9 @@
#x89 #xd1 ; mov %edx,%ecx
#xd3 #xe0)) ; shl %cl,%eax
(define (i386:accu-or-base)
'(#x09 #xd0)) ; or %edx,%eax
(define (i386:accu+accu)
'(#x01 #xc0)) ; add %eax,%eax

View File

@ -46,6 +46,7 @@
i386:accu*base
i386:accu-base
i386:accu-shl
i386:accu-or-base
i386:accu<<base
i386:base-sub
i386:base->accu

View File

@ -1488,9 +1488,7 @@ logior (SCM x) ///((arity . n))
#if __GNUC__
n |= VALUE (car (x));
#else
puts ("FIXME: logior\n");
//FIXME
//n = n | VALUE (car (x));
n = n | VALUE (car (x));
#endif
x = cdr (x);
}

View File

@ -219,6 +219,9 @@ math_test ()
puts ("t: 3 << 4\n");
if (3 << 4 != 48) return 3 << 4;
puts ("t: 1 | 4\n");
if ((1 | 4) != 5) return 1 | 4;
return read_test ();
}