On 05/28/2018 05:23 AM, Jozef Lawrynowicz wrote: > pr39240.c fails at execution at -O1 and above for msp430, due to an erroneous > > subreg expression in the zero_extendqisi2 msp430 insn pattern. This causes the > > zero extension operation to get optimized out. > > The attached patch fixes the insn pattern, and also removes the msp430x ISA > restriction on zero_extendqisi2 and zero_extendhisi2. The assembly > instructions > > in these patterns can be used in the base MSP430 ISA; they are not MSP430x > specific. > > Successfully regtested the GCC testsuite for msp430-elf in the > -mcpu=msp430x/-mlarge configuration. > > If the patch is acceptable, I would appreciate if someone would commit it for > > me, as I don't have write access. > > > 0001-MSP430-Fix-PR39240-execution-failure-for-msp430-elf.patch > > > From 4f96a05f4849e28064f5c202a55b753b59a106ef Mon Sep 17 00:00:00 2001 > From: Jozef Lawrynowicz <joze...@mittosystems.com> > Date: Sun, 27 May 2018 21:09:49 +0100 > Subject: [PATCH] MSP430: Fix PR39240 execution failure for msp430-elf > > 2018-05-28 Jozef Lawrynowicz <joze...@mittosystems.com> > > * gcc/config/msp430/msp430.md: Remove erroneous subreg expression from > zero_extendqisi2 insn pattern. Remove msp430x ISA restriction on > zero_extend{q,h}isi2. It's not clear why having that subreg is causing incorrect code to be generated, but the subreg is clearly wrong since it's a qisi pattern not a hisi pattern. Based on that I've approved and installed the change.
I'm a big believer that any subreg appearing in an md is fishy and should be reviewed and justified. I've found they're generally a bad idea. Jeff