use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertNegatedBaseAndNegatedShiftedIndexToDisplacement.
@Test
public void convertNegatedBaseAndNegatedShiftedIndexToDisplacement() {
ValueNode base = graph.addOrUniqueWithInputs(new NegateNode(const64(1000)));
ValueNode index = graph.addOrUniqueWithInputs(new NegateNode(new LeftShiftNode(const64(10), const32(2))));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times4, -1040);
}
use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertNegatedShiftedBaseAndNegatedIndexToDisplacement.
@Test
public void convertNegatedShiftedBaseAndNegatedIndexToDisplacement() {
ValueNode base = graph.addOrUniqueWithInputs(new NegateNode(new LeftShiftNode(const64(10), const32(2))));
ValueNode index = graph.addOrUniqueWithInputs(new NegateNode(const64(1000)));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times4, -1040);
}
use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class AMD64AddressLoweringTest method convertTwoLevelsOfNegatedShiftedBaseAndNegatedIndexToDisplacement.
@Test
public void convertTwoLevelsOfNegatedShiftedBaseAndNegatedIndexToDisplacement() {
ValueNode base = graph.addOrUniqueWithInputs(new NegateNode(new LeftShiftNode(new NegateNode(new LeftShiftNode(const64(500), const32(1))), const32(1))));
ValueNode index = graph.addOrUniqueWithInputs(new NegateNode(new AddNode(new NegateNode(const64(13)), const64(3))));
AddressNode result = lowering.lower(base, index);
assertAddress(result, null, null, Scale.Times4, 2010);
}
use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class CheckcastArrayCopyCallNode method computeBase.
private ValueNode computeBase(ValueNode base, ValueNode pos) {
FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
graph().addBeforeFixed(this, basePtr);
int shift = CodeUtil.log2(getArrayIndexScale(JavaKind.Object));
ValueNode extendedPos = IntegerConvertNode.convert(pos, StampFactory.forKind(runtime.getTarget().wordJavaKind), graph(), NodeView.DEFAULT);
ValueNode scaledIndex = graph().unique(new LeftShiftNode(extendedPos, ConstantNode.forInt(shift, graph())));
ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forIntegerBits(PrimitiveStamp.getBits(scaledIndex.stamp(NodeView.DEFAULT)), getArrayBaseOffset(JavaKind.Object), graph())));
return graph().unique(new OffsetAddressNode(basePtr, offset));
}
use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class HotSpotGraphBuilderPlugins method readMetaspaceConstantPoolElement.
/**
* Emits a node representing an element in a metaspace {@code ConstantPool}.
*
* @param constantPoolOop value of the {@code constantPoolOop} field in a ConstantPool value
*/
private static boolean readMetaspaceConstantPoolElement(GraphBuilderContext b, ValueNode constantPoolOop, ValueNode index, JavaKind elementKind, WordTypes wordTypes, GraalHotSpotVMConfig config) {
ValueNode constants = getMetaspaceConstantPool(b, constantPoolOop, wordTypes, config);
int shift = CodeUtil.log2(wordTypes.getWordKind().getByteCount());
ValueNode scaledIndex = b.add(new LeftShiftNode(IntegerConvertNode.convert(index, StampFactory.forKind(JavaKind.Long), NodeView.DEFAULT), b.add(ConstantNode.forInt(shift))));
ValueNode offset = b.add(new AddNode(scaledIndex, b.add(ConstantNode.forLong(config.constantPoolSize))));
AddressNode elementAddress = b.add(new OffsetAddressNode(constants, offset));
boolean notCompressible = false;
ValueNode elementValue = WordOperationPlugin.readOp(b, elementKind, elementAddress, NamedLocationIdentity.getArrayLocation(elementKind), BarrierType.NONE, notCompressible);
b.addPush(elementKind, elementValue);
return true;
}
Aggregations