[PATCH] add split condition to *fix_trunchi_1

Uros Bizjak uros@kss-loka.si
Thu Nov 18 14:37:00 GMT 2004


Joseph S. Myers wrote:

>>This patch was commited to mainline (bootstrapped on i686-pc-linux-gnu,
>>regtested c,c++:
>>
>>2004-11-18  Uros Bizjak  <uros@kss-loka.si>
>>
>>       * configure/i386/i386.md (*fix_trunch_1): Add "&& 1" to
>>       insn split constraint.
>>       (define_peephole2): Remove unneeded "&& 1" from peephole2
>>       constraints.
>>    
>>
Attached patch should revert the (define_peephole2) part of my commit.

However, adding and removing "&& 1" should have no effect on the code, 
so IMHO a bug is hidden here, and my patch just uncovers it. These two 
patterns are claimed to be the same:

(define_peephole2
  [(match_scratch:DI 2 "r")
   (set (match_operand:DI 0 "push_operand" "")
        (match_operand:DI 1 "immediate_operand" ""))]
  "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
   && !x86_64_immediate_operand (operands[1], DImode)"
  [(set (match_dup 2) (match_dup 1))
   (set (match_dup 0) (match_dup 2))]
  "")

(define_peephole2
  [(set (match_operand:DI 0 "push_operand" "")
        (match_operand:DI 1 "immediate_operand" ""))]
  "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
   && !x86_64_immediate_operand (operands[1], DImode) && 1"
  [(set (match_dup 0) (match_dup 1))
   (set (match_dup 2) (match_dup 3))]
  "split_di (operands + 1, 1, operands + 2, operands + 3);
   operands[1] = gen_lowpart (DImode, operands[2]);
   operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, 
stack_pointer_rtx,
                            GEN_INT (4)));
  ")

This part is actually the same in both patterns:

(set (match_operand:DI 0 "push_operand" "")
        (match_operand:DI 1 "immediate_operand" ""))

It looks that compiler free to process only above part, even when 
sequence of

   (match_scratch:DI 2 "r")
   (set (match_operand:DI 0 "push_operand" "")
        (match_operand:DI 1 "immediate_operand" ""))

is found. Attached patch will enable bootstrap on x86_64 by sweeping 
this possible bug under the carpet...

Uros.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041118/731f0c4e/attachment.ksh>


More information about the Gcc-patches mailing list