Skip to content
This repository was archived by the owner on Mar 16, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
package org.graalvm.vm.x86.isa.instruction;

import org.graalvm.vm.math.LongMultiplication;
import org.graalvm.vm.x86.ArchitecturalState;
import org.graalvm.vm.x86.RegisterAccessFactory;
import org.graalvm.vm.x86.isa.AMD64Instruction;
Expand All @@ -54,6 +53,7 @@
import org.graalvm.vm.x86.node.WriteFlagNode;
import org.graalvm.vm.x86.node.WriteNode;

import com.oracle.truffle.api.ExactMath;
import com.oracle.truffle.api.frame.VirtualFrame;

public abstract class Imul extends AMD64Instruction {
Expand Down Expand Up @@ -212,7 +212,7 @@ public long executeInstruction(VirtualFrame frame) {
long a = readOp.executeI64(frame);
long b = readA.executeI64(frame);
long resultL = a * b;
long resultH = LongMultiplication.multiplyHigh(a, b);
long resultH = ExactMath.multiplyHigh(a, b);
writeA.executeI64(frame, resultL);
writeD.executeI64(frame, resultH);
boolean overflow = resultH != 0 && resultH != -1;
Expand Down Expand Up @@ -345,7 +345,7 @@ public long executeInstruction(VirtualFrame frame) {
long op1 = readOp1.executeI64(frame);
long op2 = readOp2.executeI64(frame);
long resultL = op1 * op2;
long resultH = LongMultiplication.multiplyHigh(op1, op2);
long resultH = ExactMath.multiplyHigh(op1, op2);
writeDst.executeI64(frame, resultL);
boolean ok1 = resultH != 0 || resultL >= 0; // resultH == 0 -> resultL >= 0;
boolean ok2 = resultH != -1 || resultL < 0; // resultH == -1 -> resultL < 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
package org.graalvm.vm.x86.isa.instruction;

import org.graalvm.vm.math.LongMultiplication;
import org.graalvm.vm.x86.ArchitecturalState;
import org.graalvm.vm.x86.RegisterAccessFactory;
import org.graalvm.vm.x86.isa.AMD64Instruction;
Expand All @@ -53,6 +52,7 @@
import org.graalvm.vm.x86.node.WriteFlagNode;
import org.graalvm.vm.x86.node.WriteNode;

import com.oracle.truffle.api.ExactMath;
import com.oracle.truffle.api.frame.VirtualFrame;

public abstract class Mul extends AMD64Instruction {
Expand Down Expand Up @@ -223,7 +223,7 @@ public long executeInstruction(VirtualFrame frame) {
long rax = readRAX.executeI64(frame);
long op = readOp.executeI64(frame);
long resultL = rax * op;
long resultH = LongMultiplication.multiplyHighUnsigned(rax, op);
long resultH = ExactMath.multiplyHighUnsigned(rax, op);
writeRAX.executeI64(frame, resultL);
writeRDX.executeI64(frame, resultH);
boolean of = resultH != 0;
Expand Down