mescc: Use signed division for x86, x86_64 when appropriate.

This fixes 36-compare-arithmetic.c

* module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Do not reset
signed?.
* module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise.
* lib/tests/scaffold/36-compare-arithmetic.c (main): Use unique exit
value per failure.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-10-06 19:41:14 +02:00
parent 8429a4b0b6
commit fa4147a284
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 12 additions and 16 deletions

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -30,31 +30,31 @@ main ()
oputs ("t: 2 - 1\n");
if (0)
return 1;
return 2;
oputs ("t: 1 << 3\n");
if (1 << 3 != 8)
return 1;
return 3;
oputs ("t: 8 >> 3\n");
if (8 >> 3 != 1)
return 1;
return 4;
oputs ("t: 8 / 4\n");
if (8 / 4 != 2)
return 1;
return 5;
oputs ("t: 8 / -4\n");
if (8 / -4 != -2)
return 1;
return 6;
oputs ("t: -8 / -4\n");
if (-8 / -4 != 2)
return 1;
return 7;
oputs ("t: -8 / 4\n");
if (-8 / 4 != -2)
return 1;
return 8;
return 0;
}

View File

@ -355,8 +355,7 @@
`((,(string-append "and____%" r1 ",%" r0)))))
(define (i386:r0/r1 info signed?)
(let ((signed? #f) ; nobody knows, -- all advice are belong to us?
(allocated (.allocated info))
(let ((allocated (.allocated info))
(r0 (get-r0 info))
(r1 (get-r1 info)))
(if (not (member "edx" allocated))
@ -381,8 +380,7 @@
("pop____%eax")))))
(define (i386:r0%r1 info signed?)
(let ((signed? #f) ; nobody knows, -- all advice are belong to us?
(allocated (.allocated info))
(let ((allocated (.allocated info))
(r0 (get-r0 info))
(r1 (get-r1 info)))
(if (not (member "edx" allocated))

View File

@ -435,8 +435,7 @@
`((,(string-append "and____%" r1 ",%" r0)))))
(define (x86_64:r0/r1 info signed?)
(let ((signed? #f) ; nobody knows, -- all advice are belong to us?
(allocated (.allocated info))
(let ((allocated (.allocated info))
(r0 (get-r0 info))
(r1 (get-r1 info)))
(if (not (member "rdx" allocated))
@ -461,8 +460,7 @@
("pop____%rax")))))
(define (x86_64:r0%r1 info signed?)
(let ((signed? #f) ; nobody knows, -- all advice are belong to us?
(allocated (.allocated info))
(let ((allocated (.allocated info))
(r0 (get-r0 info))
(r1 (get-r1 info)))
(if (not (member "rdx" allocated))