Am 20.01.2014 01:18, schrieb Martin: > Just been looking at the peehole opt (i386). Other than the 2 items > already mailed, I found that: > > 1) Gode as follows is sometimes generated (at various opt levels) > > .Ll2: > # [36] i := 1; > movl $1,%eax > .Ll3: > # [38] i := i + 1; > movl $2,%eax > > I could not find any code dealing with it,
There is none I think. > and added some. It does catch > a noticeable amount of occurrences during build of fpc and lazarus. Go ahead. According to me experience a good mean besides testing compiler and lazarus to quickly catch errors in the peephole optimizer is to compare assembler before and after. > > 2) > Commented existing code (apparently since revision 1) for > {movl [mem1],reg1 to movl [mem1],reg1 > movl [mem1],reg2 movl reg1,reg2 } The code was commented 15 years ago :) with the comment * split the optimizer by Jonas. So I think such statements were caught by the old assembler cse optimizer which is disabled now. > > It used > (taicpu(p).oper[1]^.reg<>taicpu(hp1).oper[0]^^.ref^.base) and > (taicpu(p).oper[1]^.reg<>taicpu(hp1).oper[0]^^.ref^.index) then > but should only compare the supregister part > I replaced that > not(RegInOp(getsupreg(taicpu(p).oper[1]^.reg),taicpu(hp1).oper[0]^)) then > > uncommented, and tested. > It does catch a big lot of occurrences. Can you post some example code? It might be worth to think about improving this already in at the node level. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel