# HG changeset patch # User Doug Simon # Date 1407265058 -7200 # Node ID a53c26c989d0570fdd9dab6c9ec35cea64dce9e2 # Parent b002c864e974d6033dc7938d45b293b7363a3978 HSAIL: miscellaneous HSAIL test tweaks and fixes: - mark some tests as requiring ObjectAllocation so they will not fail when UseHSAILDeoptimization is turned off - mark some tests as not to run on hardware until some hardware problems are fixed. - Fix code sequence in HSAILHotSpotBackend.java for hardware which has more strict HSAIL assembler (no longer allows ld_u32 into a $d register) - in HSAILAssembler.mapAddress, handle case where there is no base register Contributed-by: Tom Deneau diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java --- a/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java Tue Aug 05 20:57:38 2014 +0200 @@ -324,7 +324,11 @@ } public static String mapAddress(HSAILAddress addr) { - return "[$d" + addr.getBase().encoding() + " + " + addr.getDisplacement() + "]"; + if (addr.getBase().encoding() < 0) { + return "[0x" + Long.toHexString(addr.getDisplacement()) + "]"; + } else { + return "[$d" + addr.getBase().encoding() + " + " + addr.getDisplacement() + "]"; + } } private static String doubleToString(double dval) { diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java --- a/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Tue Aug 05 20:57:38 2014 +0200 @@ -131,6 +131,13 @@ } /** + * Determines if we are running CQE tests (via a -D flag) + */ + public boolean runningCQETests() { + return Boolean.getBoolean("com.amd.CQE"); + } + + /** * Determines if the JVM supports the required typeProfileWidth. */ public boolean typeProfileWidthAtLeast(int val) { diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleCosTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleCosTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleCosTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextAfterTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextAfterTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextAfterTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -39,6 +39,11 @@ }); } + @Override + protected boolean supportsRequiredCapabilities() { + return (runningOnSimulator() || runningCQETests()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextUpTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextUpTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleNextUpTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,11 @@ }); } + @Override + protected boolean supportsRequiredCapabilities() { + return (runningOnSimulator() || runningCQETests()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleSinTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleSinTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleSinTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleTanTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleTanTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/DoubleTanTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatCosTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatCosTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatCosTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextAfterTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextAfterTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextAfterTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -39,6 +39,11 @@ }); } + @Override + protected boolean supportsRequiredCapabilities() { + return (runningOnSimulator() || runningCQETests()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextUpTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextUpTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatNextUpTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,11 @@ }); } + @Override + protected boolean supportsRequiredCapabilities() { + return (runningOnSimulator() || runningCQETests()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatSinTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatSinTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatSinTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatTanTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatTanTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/FloatTanTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -38,6 +38,12 @@ }); } + // internally allocates a Rempiostruct, escape analysis not catching it + @Override + protected boolean supportsRequiredCapabilities() { + return (canHandleObjectAllocation()); + } + @Test public void testUsingLambdaMethod() { testGeneratedHsailUsingLambdaMethod(); diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/StringBuilderTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/StringBuilderTest.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/StringBuilderTest.java Tue Aug 05 20:57:38 2014 +0200 @@ -47,7 +47,7 @@ @Override protected boolean supportsRequiredCapabilities() { - return (canHandleObjectAllocation()); + return (canHandleObjectAllocation() && (runningOnSimulator() || runningCQETests())); } @Test diff -r b002c864e974 -r a53c26c989d0 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Aug 05 15:57:37 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Aug 05 20:57:38 2014 +0200 @@ -686,7 +686,9 @@ String iterationObjArgReg = HSAIL.mapRegister(cc.getArgument(nonConstantParamCount - 1)); /* * iterationObjArgReg will be the highest $d register in use (it is the last parameter) - * so tempReg can be the next higher $d register + * so tempReg can be the next higher $d register. As of 1.0 spec, we cannot use + * ld_global_u32 $dxx, [addr]; so we need a temporary $s register. We can use + * workItemReg+1; */ String tmpReg = "$d" + (asRegister(cc.getArgument(nonConstantParamCount - 1)).encoding() + 1); // Convert gid to long. @@ -699,9 +701,13 @@ asm.emitString("add_u64 " + tmpReg + ", " + tmpReg + ", " + iterationObjArgReg + "; // Add to array ref ptr"); // Load the object into the parameter reg. if (useCompressedOops) { + int workItemRegEncoding = asRegister(cc.getArgument(nonConstantParamCount)).encoding(); + String tmpReg32 = "$s" + Integer.toString(workItemRegEncoding + 1); - // Load u32 into the d 64 reg since it will become an object address - asm.emitString("ld_global_u32 " + tmpReg + ", " + "[" + tmpReg + "]" + "; // Load compressed ptr from array"); + // Load u32 into the temporary $s reg since it will become an object address + + asm.emitString("ld_global_u32 " + tmpReg32 + ", " + "[" + tmpReg + "]" + "; // Load compressed ptr from array"); + asm.emitString("cvt_u64_u32 " + tmpReg + ", " + tmpReg32 + "; // cvt to 64 bits"); long narrowOopBase = config.narrowOopBase; long narrowOopShift = config.narrowOopShift;