From bf3cfae61078c10cd4f964862a27b97e2de6d120 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 14 Mar 1988 13:56:33 +0000 Subject: [PATCH] CMI was translated wrongly; corrected --- mach/ns/ncg/table | 11 +++++++++-- mach/pdp/cg/table | 19 ++++++++++--------- mach/pdp/ncg/table | 15 ++++++++++----- mach/z8000/cg/table | 17 ++++++++++++++++- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/mach/ns/ncg/table b/mach/ns/ncg/table index 9e71a5fb1..5107f3a12 100644 --- a/mach/ns/ncg/table +++ b/mach/ns/ncg/table @@ -1854,8 +1854,15 @@ pat tge ior $2==4 call txxior("bgt") pat tgt ior $2==4 call txxior("bge") pat cmi $1==4 -with src4 REG - gen subd %1, %2 yields %2 +with src4 src4 + uses REG={const4, 0} + gen cmpd %2, %1 + blt {label, "1f"} + shid %a + br {label, "2f"} + 1: + addd {const4, 0-1}, %a + 2: yields %a #ifndef NOFLOAT pat cmf $1==4 diff --git a/mach/pdp/cg/table b/mach/pdp/cg/table index 92be84d3b..ca7bc9036 100644 --- a/mach/pdp/cg/table +++ b/mach/pdp/cg/table @@ -1804,15 +1804,16 @@ lar !defined($1) | | remove(all) * group 12 : Compare instructions * ****************************************/ -cmi $1==2 | source2 SCR_REG | - "sub %[1],%[2]" - setcc(%[2]) - erase(%[2]) | %[2] | | -... | SCR_REG source2 | - "sub %[2],%[1]" - "neg %[1]" - setcc(%[1]) - erase(%[1]) | %[1] | | +cmi $1==2 | source2 source2 | + allocate(REG = {CONST2,0}) + "cmp %[1],%[2]" + "beq 2f" + "bgt 1f" + "inc %[a]" + "br 2f" + "1:\tdec %[a]\n2:" + setcc(%[a]) + erase(%[a]) | %[a] | | ldc cmi zlt highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 | | %[1] | zlt $3 | ldc cmi zge highw(1)==0 && loww(1)==0 && $2==4 | source2 source2 | diff --git a/mach/pdp/ncg/table b/mach/pdp/ncg/table index 7d35b29b7..f1182b1bd 100644 --- a/mach/pdp/ncg/table +++ b/mach/pdp/ncg/table @@ -1632,11 +1632,16 @@ gen jsr pc,{label, "ilar~"} ****************************************/ pat cmi $1==2 -with src2 REG - gen sub %1,%2 yields %2 -with REG src2 - gen sub %2,%1 - neg %1 yields %1 +with src2 src2 +uses REG = {const2,0} +gen cmp %1,%2 + beq {label,2f} + bgt {label,1f} + inc %a + br {label,2f} + 1: + dec %a + 2: yields %a pat cmi $1==4 kills ALL diff --git a/mach/z8000/cg/table b/mach/z8000/cg/table index 97f6aee0d..066991d79 100644 --- a/mach/z8000/cg/table +++ b/mach/z8000/cg/table @@ -1157,7 +1157,22 @@ lae lar defined(rom(1,3)) | | | | lae $1 aar $2 loi rom(1,3) | ******** GROUP 12 ******** ***************************************/ -cmi $1==2 | | | | sbi $1 | +cmi $1==2 | src2 REG | allocate( REG = {im2, 0} ) + "cp %[2], %[1]" + "jr EQ, 2f" + "jr LT, 1f" + "inc %[a]" + "jr 2f" + "1:\tdec %[a]\n2:" + erase(%[a]) nocc | %[a] | | +... | NC im2 src2a | allocate( REG = {im2, 0} ) + "cp %[2], %[1]" + "jr EQ, 2f" + "jr LT, 1f" + "inc %[a]" + "jr 2f" + "1:\tdec %[a]\n2:" + erase(%[a]) nocc | %[a] | | cmi $1==4 | STACK | "calr cmi4" | R0 | | cmi !defined($1)| src2 STACK | move( %[1], R0 ) "calr cmi"