From: Roger Sayle Date: Fri, 10 Sep 2004 02:29:57 +0000 (+0000) Subject: i386.c (ix86_split_long_move): When optimizing for size... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=903a5059b66d154ec6d064b832d896daf11aacff;p=gcc.git i386.c (ix86_split_long_move): When optimizing for size... * config/i386/i386.c (ix86_split_long_move): When optimizing for size, and the low and high parts of a DImode constant are equal, copy one register to another instead of loading the same immediate value twice. From-SVN: r87270 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d8f266ee91..06bef510120 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-09 Roger Sayle + + * config/i386/i386.c (ix86_split_long_move): When optimizing for + size, and the low and high parts of a DImode constant are equal, + copy one register to another instead of loading the same immediate + value twice. + 2004-09-09 Richard Henderson PR middle-end/17367 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 25fa8d821ae..2a175452a19 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9938,6 +9938,33 @@ ix86_split_long_move (rtx operands[]) operands[6] = part[1][1]; } } + + /* If optimizing for size, attempt to locally unCSE non-zero constants. */ + if (optimize_size) + { + if (GET_CODE (operands[5]) == CONST_INT + && operands[5] != const0_rtx + && REG_P (operands[2])) + { + if (GET_CODE (operands[6]) == CONST_INT + && INTVAL (operands[6]) == INTVAL (operands[5])) + operands[6] = operands[2]; + + if (nparts == 3 + && GET_CODE (operands[7]) == CONST_INT + && INTVAL (operands[7]) == INTVAL (operands[5])) + operands[7] = operands[2]; + } + + if (nparts == 3 + && GET_CODE (operands[6]) == CONST_INT + && operands[6] != const0_rtx + && REG_P (operands[3]) + && GET_CODE (operands[7]) == CONST_INT + && INTVAL (operands[7]) == INTVAL (operands[6])) + operands[7] = operands[3]; + } + emit_move_insn (operands[2], operands[5]); emit_move_insn (operands[3], operands[6]); if (nparts == 3)