From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joern Rennecke To: egcs@cygnus.com Subject: combiner vs. USE Date: Tue, 19 Aug 1997 02:36:07 -0000 Message-id: <199708190147.CAA24576@phal.cygnus.co.uk> X-SW-Source: 1997-08/0122.html combine.c currently poses unnecessarily strict constraints on instructions that feed the last insn. It allows a single SET with one or more CLOBBERS, but it doesn't allow a USE. Consider this testcase: double f(double d) { int i = 7; return (double)i + d; } When compiled with ss-970803, configured for target rs6000-ibm-aix4.1, the int->double conversion uses a pattern that contains some USEs. Hence, combine refuses to use it as a combined-in feeding instruction for the floating point addition. A fix is quite simple and has a profound effect on the compiled code (using -O2): --- floatsidf.s-970803 Tue Aug 19 01:37:03 1997 +++ floatsidf.s Tue Aug 19 02:13:03 1997 @@ -14,7 +14,7 @@ __gnu_compiled_c: .toc LC..0: - .tc FD_43300000_80000000[TC],1127219200,-2147483648 + .tc FD_401c0000_0[TC],1075576832,0 .csect .text[PR] .align 2 .globl f @@ -30,15 +30,8 @@ .extern __divus .extern __quoss .extern __quous - li 0,7 - xoris 0,0,0x8000 - stw 0,28(1) - lis 0,0x4330 - stw 0,24(1) - lfd 13,24(1) lfd 0,LC..0(2) - fsub 13,13,0 - fadd 1,1,13 + fadd 1,1,0 blr LT..f: .long 0 Here is the gcc source patch. Most is just updating comments... Tue Aug 19 02:11:26 1997 J"orn Rennecke * combine.c (can_combine_p): Allow USEs. *** combine.c-970803-bugfixed Wed Aug 13 22:37:54 1997 --- combine.c Tue Aug 19 02:11:26 1997 *************** can_combine_p (insn, i3, pred, succ, pde *** 826,832 **** : next_active_insn (insn) == i3); /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0. ! or a PARALLEL consisting of such a SET and CLOBBERs. If INSN has CLOBBER parallel parts, ignore them for our processing. By definition, these happen during the execution of the insn. When it --- 826,832 ---- : next_active_insn (insn) == i3); /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0. ! or a PARALLEL consisting of such a SET and CLOBBERs / USEs. If INSN has CLOBBER parallel parts, ignore them for our processing. By definition, these happen during the execution of the insn. When it *************** can_combine_p (insn, i3, pred, succ, pde *** 851,858 **** switch (GET_CODE (elt)) { ! /* We can ignore CLOBBERs. */ case CLOBBER: break; case SET: --- 851,859 ---- switch (GET_CODE (elt)) { ! /* We can ignore CLOBBERs and USEs. */ case CLOBBER: + case USE: break; case SET: