|
@@ -635,7 +635,7 @@ TYPE
|
|
|
if not, the location of a runtime is returned **)
|
|
|
PROCEDURE Supported(CONST irInstruction: IntermediateCode.Instruction; VAR moduleName, procedureName: ARRAY OF CHAR): BOOLEAN;
|
|
|
VAR
|
|
|
- result: BOOLEAN;
|
|
|
+ result: BOOLEAN; value: HUGEINT; exp: LONGINT;
|
|
|
BEGIN
|
|
|
CASE irInstruction.opcode OF
|
|
|
| IntermediateCode.add, IntermediateCode.sub, IntermediateCode.mul, IntermediateCode.abs, IntermediateCode.neg:
|
|
@@ -650,9 +650,7 @@ TYPE
|
|
|
result := backend.useFPU32 & IsSinglePrecisionFloat(irInstruction.op1)
|
|
|
OR backend.useFPU64 & IsDoublePrecisionFloat(irInstruction.op1)
|
|
|
OR backend.useFPU64 & IsNonComplexInteger(irInstruction.op1);
|
|
|
- (*
|
|
|
result := result OR IntermediateCode.IsConstantInteger(irInstruction.op3,value) & PowerOf2(value,exp)
|
|
|
- *)
|
|
|
|
|
|
| IntermediateCode.conv:
|
|
|
IF IsInteger64(irInstruction.op1) & IsFloat(irInstruction.op2) THEN (* ENTIERH: REAL/LONGREAL --> HUGEINT*)
|
|
@@ -665,10 +663,8 @@ TYPE
|
|
|
OR backend.useFPU64;
|
|
|
END;
|
|
|
| IntermediateCode.mod:
|
|
|
- result := FALSE;
|
|
|
- (*
|
|
|
result := IntermediateCode.IsConstantInteger(irInstruction.op3,value) & PowerOf2(value,exp)
|
|
|
- *)
|
|
|
+
|
|
|
| IntermediateCode.rol, IntermediateCode.ror:
|
|
|
result := ~IsComplex(irInstruction.op1)
|
|
|
ELSE
|
|
@@ -2202,8 +2198,16 @@ TYPE
|
|
|
|
|
|
PROCEDURE EmitMul(VAR irInstruction: IntermediateCode.Instruction);
|
|
|
VAR
|
|
|
- destination, left, right: ARRAY 2 OF Operand;
|
|
|
+ destination, left, right: ARRAY 2 OF Operand; inst: IntermediateCode.Instruction; value: HUGEINT;exp: LONGINT; op3:IntermediateCode.Operand;
|
|
|
BEGIN
|
|
|
+ IF IntermediateCode.IsConstantInteger(irInstruction.op3,value) & PowerOf2(value,exp) THEN
|
|
|
+ IntermediateCode.InitImmediate(op3, irInstruction.op3.type, exp);
|
|
|
+ IntermediateCode.InitInstruction(inst, -1, IntermediateCode.shl, irInstruction.op1, irInstruction.op2, op3);
|
|
|
+ EmitShiftOrRotation(inst);
|
|
|
+ RETURN;
|
|
|
+ END;
|
|
|
+
|
|
|
+
|
|
|
IF IsSinglePrecisionFloat(irInstruction.op1) THEN
|
|
|
ASSERT(backend.useFPU32);
|
|
|
PrepareDoubleSourceOp(irInstruction, Low, destination[Low], left[Low], right[Low]);
|
|
@@ -2244,8 +2248,18 @@ TYPE
|
|
|
|
|
|
PROCEDURE EmitDiv(VAR irInstruction: IntermediateCode.Instruction);
|
|
|
VAR
|
|
|
- destination, left, right, float, leftd, rightd, fpstatus: Operand;
|
|
|
+ destination, left, right, float, leftd, rightd, fpstatus: Operand;
|
|
|
+ value: HUGEINT; exp: LONGINT; op3: IntermediateCode.Operand;
|
|
|
+ inst: IntermediateCode.Instruction;
|
|
|
BEGIN
|
|
|
+ IF IntermediateCode.IsConstantInteger(irInstruction.op3,value) & PowerOf2(value,exp) THEN
|
|
|
+ IntermediateCode.InitImmediate(op3, irInstruction.op3.type, exp);
|
|
|
+ IntermediateCode.InitInstruction(inst, -1, IntermediateCode.shr, irInstruction.op1, irInstruction.op2, op3);
|
|
|
+ EmitShiftOrRotation(inst);
|
|
|
+ RETURN;
|
|
|
+ END;
|
|
|
+
|
|
|
+
|
|
|
IF IsSinglePrecisionFloat(irInstruction.op1) THEN
|
|
|
ASSERT(backend.useFPU32);
|
|
|
PrepareDoubleSourceOp(irInstruction, Low, destination, left, right);
|