public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: cgen@sources.redhat.com, sid@sources.redhat.com
Subject: [patch] xstormy16 psw semantics
Date: Thu, 13 Feb 2003 20:25:00 -0000	[thread overview]
Message-ID: <200302132025.h1DKPqB31613@greed.delorie.com> (raw)


Sanyo noted that the PSW wasn't getting set right.  It is always set
after the move operation.  Plus, the alignfix macro was basing its
alignment logic on the contents of memory, not the address.  The
alignment logic isn't weird, it just ignores the LSB, so I took the
macro out and hard-coded the mask as needed.  Ok?

Also, I'm still waiting for approval for my previous patches:
http://sources.redhat.com/ml/sid/2003-q1/msg00012.html
http://sources.redhat.com/ml/sid/2003-q1/msg00011.html

[cgen]

	* xstormy16.cpu (set-mem-alignfix-psw): Remove.
	(movlmemimm): Just mask the address.
	(movhmemimm): Likewise.
	(movlmemgr): Likewise.
	(movhmemgr): Likewise.
	(set-psw): Always set the psw last.
	(set-psw-carry): Likewise.
	(set-psw-add): Likewise.
	(set-psw-sub): Likewise.
	
[sid]

	* xstormy16-sem.cxx: Regenerate.
	
  
Index: cgen/cpu/xstormy16.cpu
===================================================================
RCS file: /cvs/src/src/cgen/cpu/xstormy16.cpu,v
retrieving revision 1.5
diff -p -2 -r1.5  cgen/cpu/xstormy16.cpu
*** cgen/cpu/xstormy16.cpu	17 Dec 2002 03:54:41 -0000	1.5
--- cgen/cpu/xstormy16.cpu	13 Feb 2003 20:05:00 -0000
***************
*** 392,399 ****
    (sequence ((HI nvalue))
      (set nvalue value)
      (set psw (or (and psw #x0F9C)
  		 (or (sll index 12)
! 		     (basic-psw nvalue))))
!     (set (reg HI h-gr index) nvalue)))
  
  ; Update the PSW for destination register Rd.
--- 392,399 ----
    (sequence ((HI nvalue))
      (set nvalue value)
+     (set (reg HI h-gr index) nvalue)
      (set psw (or (and psw #x0F9C)
  		 (or (sll index 12)
! 		     (basic-psw nvalue))))))
  
  ; Update the PSW for destination register Rd.
***************
*** 413,440 ****
      (set dest nvalue)))
  
- ; Update the PSW for destination non-register dest, set dest to value,
- ; ensuring to write the correct (weird) alignment.
- (define-pmacro (set-mem-alignfix-psw dest value)
-   (sequence ((HI nvalue) (SI ndest))
-     (set nvalue value)
-     (set ndest dest)
-     (set psw (or (and psw #xFF9C)
- 		 (basic-psw nvalue)))
-     (if (and ndest 1)
-       (sequence ()
- 	(set ndest (sub ndest 1))
- 	(set nvalue (or (and (sll nvalue 8) #xFF00)
- 			(and (srl nvalue 8) #xFF)))))
-     (set dest nvalue)))
- 
  ; Update the PSW as with set-psw, but also set the carry flag.
  (define-pmacro (set-psw-carry Rd index value carry)
    (sequence ((HI nvalue))
      (set nvalue value)
      (set psw (or (or (and psw #x0F98)
  		     (sll carry 2))
  		 (or (sll index 12)
! 		     (basic-psw nvalue))))
!     (set (reg HI h-gr index) nvalue)))
  
  ; The all-purpose addition operation.
--- 413,425 ----
      (set dest nvalue)))
  
  ; Update the PSW as with set-psw, but also set the carry flag.
  (define-pmacro (set-psw-carry Rd index value carry)
    (sequence ((HI nvalue))
      (set nvalue value)
+     (set (reg HI h-gr index) nvalue)
      (set psw (or (or (and psw #x0F98)
  		     (sll carry 2))
  		 (or (sll index 12)
! 		     (basic-psw nvalue))))))
  
  ; The all-purpose addition operation.
***************
*** 442,445 ****
--- 427,431 ----
    (sequence ((HI value))
      (set value (addc a b c))
+     (set (reg HI h-gr index) value)
      (set psw (or (or (and psw #x0F80)
  		     (basic-psw value))
***************
*** 448,453 ****
  		     (or (and (srl HI (addc HI (and a #xF) (and b #xF) c) 
  				   1) #x8)
! 			 (sll index 12)))))
!     (set (reg HI h-gr index) value)))
  
  ; Set the PSW for a subtraction of a-b into Rd, but don't actually
--- 434,438 ----
  		     (or (and (srl HI (addc HI (and a #xF) (and b #xF) c) 
  				   1) #x8)
! 			 (sll index 12)))))))
  
  ; Set the PSW for a subtraction of a-b into Rd, but don't actually
***************
*** 470,473 ****
--- 455,459 ----
    (sequence ((HI value))
      (set value (subc a b c))
+     (set (reg HI h-gr index) value)
      (set psw (or (or (and psw #x0F80)
  		     (basic-psw value))
***************
*** 476,481 ****
  		     (or (and (srl HI (subc HI (and a #xF) (and b #xF) c)
  				   1) #x8)
! 			 (sll index 12)))))
!     (set (reg HI h-gr index) value)))
  
  ; A 17-bit rotate-left operation
--- 462,466 ----
  		     (or (and (srl HI (subc HI (and a #xF) (and b #xF) c)
  				   1) #x8)
! 			 (sll index 12)))))))
  
  ; A 17-bit rotate-left operation
***************
*** 517,521 ****
       (+ OP1_7 OP2A_8 ws2 lmem8 imm16)
       (if ws2
! 	 (set-mem-alignfix-psw (mem HI lmem8) imm16)
  	 (set-mem-psw (mem QI lmem8) (and imm16 #xFF)))
       ()
--- 502,506 ----
       (+ OP1_7 OP2A_8 ws2 lmem8 imm16)
       (if ws2
! 	 (set-mem-psw (mem HI (and lmem8 #xFFFE)) imm16)
  	 (set-mem-psw (mem QI lmem8) (and imm16 #xFF)))
       ()
***************
*** 527,531 ****
       (+ OP1_7 OP2A_A ws2 hmem8 imm16)
       (if ws2
! 	 (set-mem-alignfix-psw (mem HI hmem8) imm16)
  	 (set-mem-psw (mem QI hmem8) (and imm16 #xFF)))
       ()
--- 512,516 ----
       (+ OP1_7 OP2A_A ws2 hmem8 imm16)
       (if ws2
! 	 (set-mem-psw (mem HI (and hmem8 #xFFFE)) imm16)
  	 (set-mem-psw (mem QI hmem8) (and imm16 #xFF)))
       ()
***************
*** 559,563 ****
       (+ OP1_9 Rm ws2 lmem8)
       (if ws2 
! 	 (set-mem-alignfix-psw (mem HI lmem8) Rm)
  	 (set-mem-psw (mem QI lmem8) Rm))
       ()
--- 544,548 ----
       (+ OP1_9 Rm ws2 lmem8)
       (if ws2 
! 	 (set-mem-psw (mem HI (and lmem8 #xFFFE)) Rm)
  	 (set-mem-psw (mem QI lmem8) Rm))
       ()
***************
*** 569,573 ****
       (+ OP1_B Rm ws2 hmem8)
       (if ws2 
! 	 (set-mem-alignfix-psw (mem HI lmem8) Rm)
  	 (set-mem-psw (mem QI lmem8) Rm))
       ()
--- 554,558 ----
       (+ OP1_B Rm ws2 hmem8)
       (if ws2 
! 	 (set-mem-psw (mem HI (and lmem8 #xFFFE)) Rm)
  	 (set-mem-psw (mem QI lmem8) Rm))
       ()

             reply	other threads:[~2003-02-13 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-13 20:25 DJ Delorie [this message]
2003-02-14 11:53 ` Frank Ch. Eigler
2003-02-18 22:58   ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302132025.h1DKPqB31613@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=cgen@sources.redhat.com \
    --cc=sid@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).