On Wed, 2020-03-11 at 13:04 +0000, Nidal Faour via Gcc-patches wrote: > This patch is a code density oriented and attempt to remove redundant > sign/zero > extension from assignment statement. > The approach taken is to use VRP data while expanding the assignment to RTL to > determine whether a sign/zero extension is necessary. > Thought the motivation of the patch is code density but it also good for > speed. > > for example: > extern unsigned int func (); > > unsigned char > foo (unsigned int arg) > { > if (arg == 2) > return 0; > > return (func() == arg || arg == 7); > } > > the result of the comparison in the return will yield a False or True, which > will be converted to integer and then casting to unsigned char. > this casting from integer to unsigned char is redundant because the value is > either 0 or 1. > > this patch is targeting the RISCV-32bit only. > This patch has been tested on a real embedded project and saved about 0.2% of > code size. > > P.S. I have an FSF license under Western Digital incorporation. > P.S. I've attached the patch as a file in case my email client corrupted the > patch itself Just an FYI. We're at stage4 in our development cycle, as a result most developers are focused on regression bugfixing until the gcc-10 release is made. I've put your patch into the queue of things to evaluate for gcc-11.
Thanks, jeff >