* [patch] xstormy16 semantics
@ 2003-01-20 23:22 DJ Delorie
0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2003-01-20 23:22 UTC (permalink / raw)
To: cgen, sid
This fixes numerous bugs found by Sanyo. Ok?
2003-01-20 DJ Delorie <dj@redhat.com>
* xstormy16.cpu (set-psw-rrotate17): New. Choose the correct set
of 16 patterns from the set-psw-rotate17 function.
(movgrigr, movgripostincgr, movgripredecgr, movgriigr,
movgriipostincgr, movgriipredecgr): Set psw correctly.
(movfgrigr, movfgripostincgr, movfgripredecgr, movfgriigr,
movfgriipostincgr, movfgriipredecgr): Fix semantics.
(rrcgrgr, rrcgrimm4): Use new set-psw-rrotate17 function.
Index: xstormy16.cpu
===================================================================
RCS file: /cvs/src/src/cgen/cpu/xstormy16.cpu,v
retrieving revision 1.5
diff -p -3 -r1.5 xstormy16.cpu
*** xstormy16.cpu 17 Dec 2002 03:54:41 -0000 1.5
--- xstormy16.cpu 20 Jan 2003 23:20:39 -0000
***************
*** 1,5 ****
; xstormy16 CPU core description. -*- Scheme -*-
! ; Copyright (C) 2001, 2002 Red Hat, Inc.
; This file is part of CGEN.
; See file COPYING.CGEN for details.
--- 1,5 ----
; xstormy16 CPU core description. -*- Scheme -*-
! ; Copyright (C) 2001, 2002, 2003 Red Hat, Inc.
; This file is part of CGEN.
; See file COPYING.CGEN for details.
***************
*** 488,493 ****
--- 488,498 ----
(set tmpfoo (rol tmpfoo (and rot #x1F)))
(set-psw-carry (reg HI h-gr index) index (trunc HI tmpfoo) (and (srl tmpfoo 16) 1))))
+ ; We have to be careful to get the right group of 16 shifts from the above.
+ (define-pmacro (set-psw-rrotate17 Rd index src c rot)
+ (set-psw-rotate17 Rd index src c (sub 47 (mod (add (and rot #xf) 15) 17)))
+ )
+
\f
; Move Operations
***************
*** 619,625 ****
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm))
! (set-psw-nowrite (index-of Rs) Rs))
()
)
--- 624,630 ----
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm))
()
)
***************
*** 632,638 ****
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm))
! (set-psw Rs (index-of Rs) (add Rs (add ws2 1))))
()
)
--- 637,644 ----
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm)
! (set Rs (add Rs (add ws2 1))))
()
)
***************
*** 642,648 ****
("mov$ws2 (--$Rs),$Rdm")
(+ OP1_6 OP2A_A ws2 Rs OP4M_0 Rdm)
(sequence ()
! (set-psw Rs (index-of Rs) (sub Rs (add ws2 1)))
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm)))
--- 648,655 ----
("mov$ws2 (--$Rs),$Rdm")
(+ OP1_6 OP2A_A ws2 Rs OP4M_0 Rdm)
(sequence ()
! (set Rs (sub Rs (add ws2 1)))
! (set-psw-nowrite (index-of Rdm) Rdm)
(if ws2
(set-alignfix-mem Rs Rdm)
(set (mem QI Rs) Rdm)))
***************
*** 695,701 ****
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm))
! (set-psw Rs (index-of Rs) Rs))
()
)
--- 702,708 ----
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm))
()
)
***************
*** 708,714 ****
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm))
! (set-psw Rs (index-of Rs) (add Rs 1)))
()
)
--- 715,722 ----
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm)
! (set Rs (add Rs 1)))
()
)
***************
*** 718,724 ****
("mov$ws2 (--$Rs,$imm12),$Rdm")
(+ OP1_6 OP2A_A ws2 Rs OP4M_1 Rdm OP5_0 imm12)
(sequence ()
! (set-psw Rs (index-of Rs) (sub Rs 1))
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm)))
--- 726,733 ----
("mov$ws2 (--$Rs,$imm12),$Rdm")
(+ OP1_6 OP2A_A ws2 Rs OP4M_1 Rdm OP5_0 imm12)
(sequence ()
! (set Rs (sub Rs 1))
! (set-psw-nowrite (index-of Rdm) Rdm)
(if ws2
(set-alignfix-mem (add Rs imm12) Rdm)
(set (mem QI (add Rs imm12)) Rdm)))
***************
*** 844,852 ****
(+ OP1_7 OP2A_6 ws2 Rs OP4M_0 Rdm)
(sequence ()
(if ws2
! (set-psw Rs (index-of Rs) (alignfix-mem (join SI HI R8 Rdm)))
! (set-psw Rs (index-of Rs) (and #xFF (mem QI (join SI HI R8 Rdm)))))
! (set-psw Rs (index-of Rs) Rs))
()
)
--- 853,861 ----
(+ OP1_7 OP2A_6 ws2 Rs OP4M_0 Rdm)
(sequence ()
(if ws2
! (set-alignfix-mem (join SI HI R8 Rs) Rdm)
! (set (mem QI (join SI HI R8 Rs)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm))
()
)
***************
*** 857,865 ****
(+ OP1_6 OP2A_6 ws2 Rs OP4M_0 Rdm)
(sequence ()
(if ws2
! (set-psw Rs (index-of Rs) (alignfix-mem (join SI HI R8 Rdm)))
! (set-psw Rs (index-of Rs) (and #xFF (mem QI (join SI HI R8 Rdm)))))
! (set-psw Rs (index-of Rs) (add Rs (add ws2 1))))
()
)
--- 866,875 ----
(+ OP1_6 OP2A_6 ws2 Rs OP4M_0 Rdm)
(sequence ()
(if ws2
! (set-alignfix-mem (join SI HI R8 Rs) Rdm)
! (set (mem QI (join SI HI R8 Rs)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm)
! (set Rs (add Rs (add ws2 1))))
()
)
***************
*** 869,878 ****
("movf$ws2 (--$Rs),$Rdm")
(+ OP1_6 OP2A_E ws2 Rs OP4M_0 Rdm)
(sequence ()
! (set-psw Rs (index-of Rs) (sub Rs (add ws2 1)))
(if ws2
! (set-psw Rs (index-of Rs) (alignfix-mem (join SI HI R8 Rdm)))
! (set-psw Rs (index-of Rs) (and #xFF (mem QI (join SI HI R8 Rdm))))))
()
)
--- 879,889 ----
("movf$ws2 (--$Rs),$Rdm")
(+ OP1_6 OP2A_E ws2 Rs OP4M_0 Rdm)
(sequence ()
! (set-psw-nowrite (index-of Rdm) Rdm)
! (set Rs (sub Rs (add ws2 1)))
(if ws2
! (set-alignfix-mem (join SI HI R8 Rs) Rdm)
! (set (mem QI (join SI HI R8 Rs)) Rdm)))
()
)
***************
*** 923,929 ****
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE))
Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm))
! (set-psw Rs (index-of Rs) Rs))
()
)
--- 934,940 ----
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE))
Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm))
()
)
***************
*** 937,943 ****
(if ws2
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE)) Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm))
! (set-psw Rs (index-of Rs) (add Rs (add ws2 1))))
()
)
--- 948,955 ----
(if ws2
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE)) Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm))
! (set-psw-nowrite (index-of Rdm) Rdm)
! (set Rs (add Rs (add ws2 1))))
()
)
***************
*** 947,953 ****
("movf$ws2 ($Rb,--$Rs,$imm12),$Rdm")
(+ OP1_6 OP2A_E ws2 Rs OP4M_1 Rdm OP5A_0 Rb imm12)
(sequence ()
! (set-psw Rs (index-of Rs) (sub Rs 1))
(if ws2
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE)) Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm)))
--- 959,966 ----
("movf$ws2 ($Rb,--$Rs,$imm12),$Rdm")
(+ OP1_6 OP2A_E ws2 Rs OP4M_1 Rdm OP5A_0 Rb imm12)
(sequence ()
! (set Rs (sub Rs 1))
! (set-psw-nowrite (index-of Rdm) Rdm)
(if ws2
(set (mem HI (and (add (join SI HI Rb Rs) imm12) #xFFFFFFFE)) Rdm)
(set (mem QI (add (join SI HI Rb Rs) imm12)) Rdm)))
***************
*** 1302,1308 ****
()
("rrc $Rd,$Rs")
(+ OP1_3 OP2_8 Rs Rd)
! (set-psw-rotate17 Rd (index-of Rd) Rd psw-cy (neg (and Rs #xF)))
()
)
--- 1315,1321 ----
()
("rrc $Rd,$Rs")
(+ OP1_3 OP2_8 Rs Rd)
! (set-psw-rrotate17 Rd (index-of Rd) Rd psw-cy Rs)
()
)
***************
*** 1311,1317 ****
()
("rrc $Rd,#$imm4")
(+ OP1_3 OP2_9 imm4 Rd)
! (set-psw-rotate17 Rd (index-of Rd) Rd psw-cy (neg imm4))
()
)
--- 1324,1330 ----
()
("rrc $Rd,#$imm4")
(+ OP1_3 OP2_9 imm4 Rd)
! (set-psw-rrotate17 Rd (index-of Rd) Rd psw-cy imm4)
()
)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-20 23:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-20 23:22 [patch] xstormy16 semantics DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).