Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247922: Update Graal
Reviewed-by: kvn
  • Loading branch information
dean-long committed Jul 2, 2020
1 parent ec25b42 commit 8b7c9591646404186b24cbe23f0ce9101f25fee2
Show file tree
Hide file tree
Showing 132 changed files with 2,709 additions and 967 deletions.
@@ -477,6 +477,7 @@ jdk.internal.vm.compiler_EXCLUDES += \
org.graalvm.compiler.options.test \
org.graalvm.compiler.phases.common.test \
org.graalvm.compiler.processor \
org.graalvm.compiler.replacements.jdk10.test \
org.graalvm.compiler.replacements.jdk12.test \
org.graalvm.compiler.replacements.jdk9.test \
org.graalvm.compiler.replacements.processor \
@@ -105,6 +105,7 @@ ifeq ($(INCLUDE_GRAAL), true)
$(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
$(SRC_DIR)/org.graalvm.compiler.options.test/src \
$(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk10.test/src \
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk12.test/src \
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk9.test/src \
$(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
@@ -38,7 +38,7 @@
uses org.graalvm.compiler.hotspot.HotSpotBackendFactory;
uses org.graalvm.compiler.hotspot.HotSpotCodeCacheListener;
uses org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration;
uses org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
uses org.graalvm.compiler.nodes.graphbuilderconf.GeneratedPluginFactory;
uses org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider;
uses org.graalvm.compiler.serviceprovider.JMXService;

@@ -208,7 +208,7 @@ public void ubfm(int size, Register dst, Register src, int r, int s) {
}

@Override
protected void sbfm(int size, Register dst, Register src, int r, int s) {
public void sbfm(int size, Register dst, Register src, int r, int s) {
super.sbfm(size, dst, src, r, s);
}

@@ -1852,7 +1852,7 @@ public void ubfm(int size, Register dst, Register src, int r, int s) {
* @param r must be in the range 0 to size - 1
* @param s must be in the range 0 to size - 1
*/
protected void sbfm(int size, Register dst, Register src, int r, int s) {
public void sbfm(int size, Register dst, Register src, int r, int s) {
bitfieldInstruction(SBFM, dst, src, r, s, generalFromSize(size));
}

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Arm Limited and affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Arm Limited and affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,12 +36,16 @@ public class AArch64BitFieldTest extends AArch64MatchRuleTest {
private static final Predicate<LIRInstruction> predicate = op -> (op instanceof AArch64BitFieldOp);

private void testAndCheckLIR(String method, String negativeMethod, Object input) {
test(method, input);
checkLIR(method, predicate, 1);
testAndCheckLIR(method, input);
test(negativeMethod, input);
checkLIR(negativeMethod, predicate, 0);
}

private void testAndCheckLIR(String method, Object input) {
test(method, input);
checkLIR(method, predicate, 1);
}

/**
* unsigned bit field extract int.
*/
@@ -133,4 +137,174 @@ public static long invalidInsertLong(long input) {
public void testInsertLong() {
testAndCheckLIR("insertLong", "invalidInsertLong", 0xdeadbeefdeadbeefL);
}

// Tests for unsigned bitfield move, with integration of zero extend (I2L) operation.
//
// UBFIZ with I2L.
public static long unsignedInsertExtend(int input) {
return ((long) (input & 0xffff)) << 8;
}

@Test
public void testUnsignedInsertExtend() {
testAndCheckLIR("unsignedInsertExtend", 0x234);
}

// I2L with UBFIZ.
public static long unsignedExtendInsert(int input) {
return (input & 0xfff) << 5;
}

@Test
public void testUnsignedExtendInsert() {
testAndCheckLIR("unsignedExtendInsert", 0x4334);
}

// I2L with UBFX.
public static long unsignedExtendExtract(int input) {
return (input >>> 6) & 0xffffff;
}

@Test
public void testUnsignedExtendExtract() {
testAndCheckLIR("unsignedExtendExtract", 0x325ab);
}

// Signed bitfield insert with extend, generated by (LeftShift (SignExtend value) a) match
// rule.
// SBFIZ with B2L.
public long signedB2LInsert(long input) {
byte b = (byte) input;
return ((long) b) << 2;
}

@Test
public void testSignedB2LInsert() {
testAndCheckLIR("signedB2LInsert", 0xab3213efL);
}

// SBFIZ with S2L.
public long signedS2LInsert(long input) {
short s = (short) input;
return ((long) s) << -5;
}

@Test
public void testSignedS2LInsert() {
testAndCheckLIR("signedS2LInsert", 0x328032bL);
}

// SBFIZ with I2L.
public static long signedI2LInsert(int input) {
return ((long) input) << 1;
}

@Test
public void testSignedI2LInsert() {
testAndCheckLIR("signedI2LInsert", 31);
}

// SBFIZ with B2I.
public int signedB2IInsert(int input) {
byte b = (byte) input;
return b << 31;
}

@Test
public void testSignedB2IInsert() {
testAndCheckLIR("signedB2IInsert", 0x23);
}

// SBFIZ with S2I.
public int signedS2IInsert(int input) {
short s = (short) input;
return s << 2;
}

@Test
public void testSignedS2IInsert() {
testAndCheckLIR("signedS2IInsert", 0x92);
}

// Tests for bitfield move generated by ([Unsigned]RightShift (LeftShift value a) b) match
// rules.
// SBFX for int.
public static int signedExtractInt(int input) {
return (input << 8) >> 15;
}

@Test
public void testSignedExtractInt() {
testAndCheckLIR("signedExtractInt", 0x123);
}

// SBFX for long.
public static long signedExtractLong(long input) {
return (input << 8) >> 15;
}

@Test
public void testSignedExtractLong() {
testAndCheckLIR("signedExtractLong", 0x125L);
}

// SBFIZ for int.
public static int signedInsertInt(int input) {
return (input << 15) >> 8;
}

@Test
public void testSignedInsertInt() {
testAndCheckLIR("signedInsertInt", 0x1253);
}

// SBFIZ for long.
public static long signedInsertLong(long input) {
return (input << 15) >> 8;
}

@Test
public void testSignedInsertLong() {
testAndCheckLIR("signedInsertLong", 0xabcddbc325L);
}

// UBFX for int.
public static int unsignedExtractInt(int input) {
return (input << 8) >>> 31;
}

@Test
public void testUnsignedExtractInt() {
testAndCheckLIR("unsignedExtractInt", 0x125);
}

// UBFX for long.
public static long unsignedExtractLong(long input) {
return (input << 8) >>> 12;
}

@Test
public void testUnsignedExtractLong() {
testAndCheckLIR("unsignedExtractLong", 0x32222e125L);
}

// UBFIZ for int.
public static int unsignedInsertInt(int input) {
return (input << 15) >>> 8;
}

@Test
public void testUnsignedInsertInt() {
testAndCheckLIR("unsignedInsertInt", 125);
}

// UBFIZ for long.
public static long unsignedInsertLong(long input) {
return (input << 63) >>> 1;
}

@Test
public void testUnsignedInsertLong() {
testAndCheckLIR("unsignedInsertLong", 0x2339fb125L);
}
}
@@ -371,7 +371,7 @@ private void emitBinaryVar(Variable result, AArch64ArithmeticOp op, AllocatableV
}
}

private void emitBinaryConst(Variable result, AArch64ArithmeticOp op, AllocatableValue a, JavaConstant b) {
public void emitBinaryConst(Variable result, AArch64ArithmeticOp op, AllocatableValue a, JavaConstant b) {
AllocatableValue x = moveSp(a);
getLIRGen().append(new AArch64ArithmeticOp.BinaryConstOp(op, result, x, b));
}

0 comments on commit 8b7c959

Please sign in to comment.