'mpyd' instruction gets odd register pair as argument
Closed this issue · 7 comments
xxkent commented
Steps to reproduce:
git clone https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git -b abrodkin-arc64-5.15.y --single-branch
wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2023.09-release/arc_gnu_2023.09_prebuilt_arc32_uclibc_linux_install.tar.bz2
tar -xvf arc_gnu_2023.09_prebuilt_arc32_uclibc_linux_install.tar.bz2
cd linux/
make ARCH=arc CROSS_COMPILE=~/toolchain/arc32-linux-uclibc/bin/arc32-linux- haps_hs5x_defconfig
make ARCH=arc CROSS_COMPILE=~/toolchain/arc32-linux-uclibc/bin/arc32-linux- menuconfig
Here we enable the following options:
CONFIG_MTD=y
CONFIG_MTD_UBI=y
Copy mpyd_tes
t folder to Linux src
folder.
cd mpyd_test
set paths for CC and OD in make.sh
./make.sh
vim io_test.list
int ubi_io_is_bad(const struct ubi_device *ubi, int pnum)
{
struct mtd_info *mtd = ubi->mtd;
int ret;
ubi_assert(pnum >= 0 && pnum < ubi->peb_count);
ret = mtd_block_isbad(mtd, (loff_t)pnum * ubi->peb_size);
return ret;
}
00000000 <ubi_io_is_bad>:
0: 1cfc b408 st.aw r16,[sp,-4]
4: 1cf8 b38e std.aw r14r15,[sp,-8]
8: c0f1 push_s blink
a: 260a 9040 mov.f r14,r1
e: 2030 0f90 0000 0d10 ld r16,[r0,0xd10]
16: 0030 0024 bn.d 48 ;44 <ubi_io_is_bad+0x44>
1a: 4708 mov_s r15,r0
1c: 2030 0f80 0000 0cc4 ld r0,[r0,0xcc4]
24: 0e21 1003 brge r14,r0,32 ;44 <ubi_io_is_bad+0x44>
28: 2730 1f81 0000 0cc8 ld r1,[r15,0xcc8]
30: 4002 mov_s r0,r16
32: c0d1 pop_s blink
34: 2e18 1041 mpyd r1,r14,r1 <-- HERE
38: 1408 358e ldd.ab r14r15,[sp,8]
3c: 0001 0020 b.d 0 ;3c <ubi_io_is_bad+0x3c>
40: 1404 3410 ld.ab r16,[sp,4]
44: 168d 3603 ld.as r3,[r30,141]
48: 41c3 0000 0000 mov_s r1,0
4e: 40c3 0000 0000 mov_s r0,0
54: 0802 0020 bl.d 0 ;54 <ubi_io_is_bad+0x54>
58: da08 mov_s r2,0x8
5a: 0802 0000 bl 0 ;58 <ubi_io_is_bad+0x58>
5e: f1e6 b_s -52 ;28 <ubi_io_is_bad+0x28>
34: mpyd r1,r14,r1
according to PRM:
MPYD <.f> A,b,c where A is a register pair representing a 64-bit operand, and should be specified as an even numbered register.
abrodkin commented
xxkent commented
abrodkin commented
@xxkent please try the fix from foss-for-synopsys-dwc-arc-processors/gcc@54777a6
xxkent commented
It helped.
before:
2e18 1041 mpyd r1,r14,r1
after:
2e18 104e mpyd r14,r14,r1
shahab-vahedi commented
@xxkent could you elaborate on helped? To me, it looks like it is fixed. Am I missing something?
xxkent commented
@shahab-vahedi Yes, based on the specific test case above, the issue is fixed. I think we can close the topic.
abrodkin commented