This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug optimization/14287] New: [tree-ssa] does not remove unnecessary extensions


/* test.c */

short g, h;

void
foo (long a)
{
  short b = a & 3;
  long c = b;
  g = c;
  h = c;
}

test.c.t20.dom1 looks like so:

foo (a)
{
  long int c;
  short int b;
  short int T.1;
  short int T.0;

<bb 0>:
  T.0_2 = (short int)a_1;
  b_3 = T.0_2 & 3;
  c_4 = (long int)b_3;
  T.1_5 = (short int)c_4; <- Hey, T.1_5 == b_3!
  g = T.1_5;
  T.1_6 = T.1_5;
  h = T.1_5;
  return;
}

Here is the asm:

foo:
	movl	4(%esp), %eax
	andl	$3, %eax
	cwtl                   <- ugly
	movw	%ax, g
	movw	%ax, h
	ret

I inserted "g" and "h" to kill the combiner as it performs badly
when there are multiple uses of variables. :-)
The exactly same problem appears on H8.

-- 
           Summary: [tree-ssa] does not remove unnecessary extensions
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu, h8300-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14287


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