NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-vax/46677: gcc bug with builtin ffs on vax.

The following reply was made to PR port-vax/46677; it has been noted by GNATS.

From: <>
To: <>
Cc: <>, 
Subject: Re: port-vax/46677: gcc bug with builtin ffs on vax.
Date: Tue, 10 Jul 2012 21:30:05 +0000

 This seems to help.
 Index: gnu/dist/gcc4/gcc/config/vax/
 --- gnu/dist/gcc4/gcc/config/vax/   (revision 254596)
 +++ gnu/dist/gcc4/gcc/config/vax/   (working copy)
 @@ -25,7 +25,7 @@
    rtx label =3D gen_label_rtx ();
 -  emit_insn (gen_ffssi2_internal (operands[0], operands[1], operands[0]));
 +  emit_insn (gen_ffssi2_internal (operands[0], operands[1], operands[1]));
    emit_jump_insn (gen_bne (label));
    emit_insn (gen_negsi2 (operands[0], const1_rtx));
    emit_label (label);
 @@ -36,6 +36,6 @@
  (define_insn "ffssi2_internal"
    [(set (match_operand:SI 0 "nonimmediate_operand" "=3Dg")
          (ffs:SI (match_operand:SI 1 "general_operand" "nrQ")))
 -   (set (cc0) (match_operand:SI 2 "nonimmediate_operand" "0"))]
 +   (set (cc0) (ffs:SI (match_operand:SI 2 "general_operand" "1")))]
    "ffs $0,$32,%1,%0")
 The reason is that, according to the GCC internals documentation, "parallel=
 " means the operations are done in parallel, i.e., first all the inputs are=
  computed and then all the outputs are set.  So the original code (which se=
 ts cc0 based on the output operand of the FFS) would set cc0 based on the p=
 revious value, NOT based on the result of the ffs.  The changed code says t=
 hat the condition code is set based on the ffs answer.
 It looks like it works correctly, judging by the generated assembly code.

Home | Main Index | Thread Index | Old Index