This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
RFA: sh64-media.cpu make-mextr bug fix (Was: PATCH/RFA]: SHmedia trampoline)
- From: Joern Rennecke <amylaar at onetel dot net dot uk>
- To: cgen at sources dot redhat dot com
- Cc: kkojima at rr dot iij4u dot or dot jp (Kaz Kojima), aoliva at redhat dot com
- Date: Fri, 17 Jan 2003 00:02:19 +0000 (GMT)
- Subject: RFA: sh64-media.cpu make-mextr bug fix (Was: PATCH/RFA]: SHmedia trampoline)
Kaz Kojima wrote on gcc-patches:
> With running C testsuite on sh5-linux, I've found that tests using
> nested functions failed. The attached change of the 32-bit SHmedia
> trampoline fixes such regressions on sh64-unknown-linux-gnu for
> mainline.
> 2003-01-15 Kaz Kojima <kkojima@gcc.gnu.org>
>
> * config/sh/sh.c (sh_initialize_trampoline): Emit rotrdi3_mextr
> instead of rotldi3_mextr.
And I replied:
> Good catch. This bug remained undetected for such a long time because
> it mirrors a bug in the cgen simulator.
This is the corresponding patch for cgen:
Thu Jan 16 22:08:57 2003 J"orn Rennecke <amylaar@onetel.net.uk>
* cpu/sh64-media.cpu (make-mextr): Fix setting of count.
Index: cpu/sh64-media.cpu
===================================================================
RCS file: /cvs/src/src/cgen/cpu/sh64-media.cpu,v
retrieving revision 1.2
diff -p -r1.2 sh64-media.cpu
*** cpu/sh64-media.cpu 25 Jun 2002 17:17:45 -0000 1.2
--- cpu/sh64-media.cpu 16 Jan 2003 21:57:17 -0000
***************
*** 1120,1129 ****
(.str "mextr" n " $rm, $rn, $rd")
(+ (f-op op) rm (f-ext extop) rn rd (f-rsvd 0))
(sequence ((QI count) (DI mask) (DI rhs))
! (set count (mul QI 8 (sub QI 8 n)))
(set mask (sll DI (inv 0) count))
(set rhs (srl (and rm mask) count))
! (set count (mul QI 8 n))
(set mask (srl DI (inv 0) count))
(set rd (or DI rhs (sll DI (and rn mask) count))))))
--- 1120,1129 ----
(.str "mextr" n " $rm, $rn, $rd")
(+ (f-op op) rm (f-ext extop) rn rd (f-rsvd 0))
(sequence ((QI count) (DI mask) (DI rhs))
! (set count (mul QI 8 n))
(set mask (sll DI (inv 0) count))
(set rhs (srl (and rm mask) count))
! (set count (mul QI 8 (sub QI 8 n)))
(set mask (srl DI (inv 0) count))
(set rd (or DI rhs (sll DI (and rn mask) count))))))