This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[frv sim] MCPLHI fix


The MWCPLHI opcode was way off, and understandably so - it took me a
while to figure out what the opcode was supposed to do.  Basically, it
takes the (16-N) LSB's of the high word of FR(i), and the N LSB's of
the high word of FR(i+1), and concatentates them into the high word of
FR(k).  It then repeats for the low words.  Examples:

    FR(i)    FR(i+1)  Shift  old       correct

 1) 12345678 9abcdef0 08 => 12344567 : 34bc78f0
     00010010001101001001101010111100  01010110011110001101111011110000
             00110100        10111100          01111000        11110000

 2) ffeca378 060bee6a 05 => fd8b0000 : fd8b6f0a
     11111111111011000000011000001011  10100011011110001110111001101010
          11111101100           01011       01101111000           01010

 3) 1aae50c6 e95ca6aa 03 => d57c0000 : d5748632
     00011010101011101110100101011100  01010000110001101010011010101010
        1101010101110             100     1000011000110             010

	* frv.cpu (mcplhi): Correct logic.

Index: frv.cpu
===================================================================
RCS file: /cvs/src/src/cpu/frv.cpu,v
retrieving revision 1.24
diff -p -U3 -r1.24 frv.cpu
--- frv.cpu	5 Jul 2007 09:49:03 -0000	1.24
+++ frv.cpu	20 Dec 2007 01:38:48 -0000
@@ -8064,18 +8064,25 @@
       (FR400-MAJOR M-2) (FR450-MAJOR M-2))
      "mcplhi$pack $FRinti,$u6,$FRintk"
      (+ pack FRintk OP_78 FRinti OPE1_0C u6)
-     (sequence ((HI arg1) (HI arg2) (HI shift))
-	       (set FRinti (c-raw-call SI "frv_ref_SI" FRinti))
-	       (set FRintk (c-raw-call SI "frv_ref_SI" FRintk))
+     (sequence ((HI arg1) (HI arg2) (HI arg3) (HI arg4) (HI shift))
 	       (set shift (and u6 #xf))
 	       (set arg1 (sll (halfword hi FRinti 0) shift))
+	       (set arg3 (sll (halfword lo FRinti 0) shift))
 	       (if (ne shift 0)
 		   (sequence ()
 			     (set arg2 (halfword hi FRinti 1))
-			     (set arg2 (srl HI (sll HI arg2 (sub 15 shift))
-					    (sub 15 shift)))
-			     (set arg1 (or HI arg1 arg2))))
-	       (set (halfword hi FRintk 0) arg1))
+			     (set arg2 (srl HI (sll HI arg2 (sub 16 shift))
+					    (sub 16 shift)))
+			     (set arg1 (or HI arg1 arg2))
+
+			     (set arg4 (halfword lo FRinti 1))
+			     (set arg4 (srl HI (sll HI arg4 (sub 16 shift))
+					    (sub 16 shift)))
+			     (set arg3 (or HI arg3 arg4)))
+		   )
+	       (set (halfword hi FRintk 0) arg1);
+	       (set (halfword lo FRintk 0) arg3);
+	       )
      ((fr400 (unit u-media-3-dual)) (fr450 (unit u-media-3-dual))
       (fr550 (unit u-media-3-dual)))
 )


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]