Piyush Porwal <porwalpiyush@xxxxxxxxxxxxxx> writes: > I would like to request your help in a specific matter which > relates to i386.md (GCC-4.0). A question like this, a specific question about the gcc source code, could reasonably have gone to gcc@xxxxxxxxxxx rather than gcc-help@xxxxxxxxxxxx But gcc-help is fine too. > ---------------------------------------------------------------------- > (define_insn "*adddi_2_rex64" > [(set (reg FLAGS_REG) > (compare > (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0") > (match_operand:DI 2 "x86_64_general_operand" "rme,re")) > (const_int 0))) > (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm") > (plus:DI (match_dup 1) (match_dup 2)))] > ---------------------------------------------------------------------- > > As visible in the template, it contains two 'set' operators. A few > questions that come to mind are: > > - the use of multiple 'set' constructs: in particular, what > aspect(s) of the instruction set, or the target machine, guides us > to choose such a construction, If a single machine instruction changes two registers, then it is reasonable and normal to use a parallel with two sets, as above. This is typical of i386 arithmetic instructions: they set a result register, and they also set the condition code flags. This is generally the case on processors with condition codes. Many RISC processors, by comparison, do not have condition codes, and instead have comparison instructions which set specific registers. > - how does one 'evaluate' the benefits if other patterns with one > 'set' are possible, (this particularly pertains to the decision of > where to place the insn pattern in the overall machine > description, since GCC uses a 'first hit' approach). I'm not sure I entirely understand your question. If the combine pass sees that there are multiple sets in an insn, and, say, sees that all but one are dead, and is able to find a insn pattern which matches the single live set, then it will use that insn pattern. Similarly, if combine sees two related single-set insns, and finds an insn pattern which can do both in one pattern, it will replace both of them with the single pattern. In neither case does the ordering matter. Other than those examples, the compiler rarely chooses between single-set insns and multi-set insns. Ian