|
@@ -51,6 +51,51 @@ Implementation
|
|
|
ait_instruction:
|
|
|
begin
|
|
|
case taicpu(p).opcode of
|
|
|
+ A_SRWI:
|
|
|
+ begin
|
|
|
+ if getnextinstruction(p,next1) and
|
|
|
+ (next1.typ = ait_instruction) and
|
|
|
+ ((taicpu(next1).opcode = A_SLWI) or
|
|
|
+ (taicpu(next1).opcode = A_RLWINM)) and
|
|
|
+ (taicpu(next1).oper[0]^.reg = taicpu(p).oper[0]^.reg) and
|
|
|
+ (taicpu(next1).oper[1]^.reg = taicpu(p).oper[0]^.reg) then
|
|
|
+ case taicpu(next1).opcode of
|
|
|
+ A_SLWI:
|
|
|
+ begin
|
|
|
+ taicpu(p).opcode := A_RLWINM;
|
|
|
+ taicpu(p).ops := 5;
|
|
|
+ taicpu(p).loadconst(2,taicpu(next1).oper[2]^.val-taicpu(p).oper[2]^.val);
|
|
|
+ if (taicpu(p).oper[2]^.val < 0) then
|
|
|
+ begin
|
|
|
+ taicpu(p).loadconst(3,-taicpu(p).oper[2]^.val);
|
|
|
+ taicpu(p).loadconst(4,31-taicpu(next1).oper[2]^.val);
|
|
|
+ inc(taicpu(p).oper[2]^.val,32);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ taicpu(p).loadconst(3,0);
|
|
|
+ taicpu(p).loadconst(4,31-taicpu(next1).oper[2]^.val);
|
|
|
+ end;
|
|
|
+ asml.remove(next1);
|
|
|
+ next1.free;
|
|
|
+ result := true;
|
|
|
+ end;
|
|
|
+ A_RLWINM:
|
|
|
+ begin
|
|
|
+ if (taicpu(next1).oper[2]^.val = 0) then
|
|
|
+ begin
|
|
|
+ { convert srwi to rlwinm and see if the rlwinm }
|
|
|
+ { optimization can do something with it }
|
|
|
+ taicpu(p).opcode := A_RLWINM;
|
|
|
+ taicpu(p).ops := 5;
|
|
|
+ taicpu(p).loadconst(3,taicpu(p).oper[2]^.val);
|
|
|
+ taicpu(p).loadconst(4,31);
|
|
|
+ taicpu(p).loadconst(2,(32-taicpu(p).oper[2]^.val) and 31);
|
|
|
+ result := true;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
A_RLWINM:
|
|
|
begin
|
|
|
if getnextinstruction(p,next1) and
|
|
@@ -78,6 +123,7 @@ Implementation
|
|
|
taicpu(p).clearop(3);
|
|
|
taicpu(p).clearop(4);
|
|
|
taicpu(p).ops := 2;
|
|
|
+ taicpu(p).opercnt := 2;
|
|
|
asml.remove(next1);
|
|
|
next1.free;
|
|
|
end
|