You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/12/18 16:23:43 UTC

svn commit: r605231 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H5078/ vm/port/src/encoder/ia32_em64t/

Author: gshimansky
Date: Tue Dec 18 07:23:42 2007
New Revision: 605231

URL: http://svn.apache.org/viewvc?rev=605231&view=rev
Log:
Fixed HARMONY-5078. Encoder should be able to encode xmm8-xmm15 registers now and
generally use correct register value when encoding SSE instructions


Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H5078/
    harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_base.h
    harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/encoder.inl

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c?rev=605231&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c Tue Dec 18 07:23:42 2007
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include <jni.h>
+
+JNIEXPORT jboolean JNICALL Java_org_apache_harmony_drlvm_tests_regression_h5078_Test_funcd
+  (JNIEnv *jenv, jobject this, jdouble d1, jdouble d2, jdouble d3, jdouble d4, jdouble d5, jdouble d6, jdouble d7, jdouble d8, jdouble d9)
+{
+    printf("%f %f %f %f %f %f %f %f %f\n", d1, d2, d3, d4, d5, d6, d7, d8, d9);
+    return (d1 == 0.01 &&
+            d2 == 0.02 &&
+            d3 == 0.03 &&
+            d4 == 0.04 &&
+            d5 == 0.05 &&
+            d6 == 0.06 &&
+            d7 == 0.07 &&
+            d8 == 0.08 &&
+            d9 == 0.09) ? JNI_TRUE : JNI_FALSE;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_apache_harmony_drlvm_tests_regression_h5078_Test_funcf
+  (JNIEnv *jenv, jobject this, jfloat f1, jfloat f2, jfloat f3, jfloat f4, jfloat f5, jfloat f6, jfloat f7, jfloat f8, jfloat f9)
+{
+    printf("%f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9);
+    return (f1 == 0.1f &&
+            f2 == 0.2f &&
+            f3 == 0.3f &&
+            f4 == 0.4f &&
+            f5 == 0.5f &&
+            f6 == 0.6f &&
+            f7 == 0.7f &&
+            f8 == 0.8f &&
+            f9 == 0.9f) ? JNI_TRUE : JNI_FALSE;
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java?rev=605231&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java Tue Dec 18 07:23:42 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h5078;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+    static {
+        System.loadLibrary("Test");
+    }
+
+    public native boolean funcd(double d1, double d2, double d3,
+        double d4, double d5, double d6,
+        double d7, double d8, double d9);
+
+    public native boolean funcf(float f1, float f2, float f3,
+        float f4, float f5, float f6,
+        float f7, float f8, float f9);
+
+    public void test() {
+        boolean b1 = funcd(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09);
+        boolean b2 = funcf(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f);
+        assertEquals(true, b1 && b2);
+    }
+    
+    public static void main(String args[]) {
+        Test t = new Test();
+        t.test();
+    }
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml?rev=605231&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml Tue Dec 18 07:23:42 2007
@@ -0,0 +1,26 @@
+<!-- 
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+     
+         http://www.apache.org/licenses/LICENSE-2.0
+     
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License. -->
+
+<project name="RUN HARMONY-5078 Regression Test">
+    <target name="run-test">
+        <run-junit-test test="org.apache.harmony.drlvm.tests.regression.h5078.Test">
+            <junit-element>
+              <sysproperty key="java.library.path" value="${reg.test.native.path}/H5078"/>
+            </junit-element>
+        </run-junit-test>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5078/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_base.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_base.h?rev=605231&r1=605230&r2=605231&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_base.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/enc_base.h Tue Dec 18 07:23:42 2007
@@ -617,6 +617,9 @@
         if (RegName_R8L <= reg && reg <= RegName_R15L) {
             return true;
         }
+        if (RegName_XMM8 <= reg && reg <= RegName_XMM15) {
+            return true;
+        }
         if (RegName_XMM8D <= reg && reg <= RegName_XMM15D) {
             return true;
         }

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/encoder.inl
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/encoder.inl?rev=605231&r1=605230&r2=605231&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/encoder.inl (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/encoder.inl Tue Dec 18 07:23:42 2007
@@ -83,7 +83,13 @@
 }
 
 inline static void add_xmm(EncoderBase::Operands & args, const XMM_Opnd & xmm, bool dbl) {
-    return args.add((RegName)( (dbl ? RegName_XMM0D : RegName_XMM0S) + xmm.get_idx()));
+    // Gregory -
+    // XMM registers indexes in Reg_No enum are shifted by xmm0_reg, their indexes
+    // don't start with 0, so it is necessary to subtract xmm0_reg index from
+    // xmm.get_idx() value
+    assert(xmm.get_idx() >= xmm0_reg);
+    return args.add((RegName)( (dbl ? RegName_XMM0D : RegName_XMM0S) + xmm.get_idx() -
+            xmm0_reg));
 }
 
 inline static void add_fp(EncoderBase::Operands & args, unsigned i, bool dbl) {