< prev index next >
test/hotspot/jtreg/compiler/c2/cr6340864/TestFloatVect.java
Print this page
@@ -84,10 +84,11 @@
test_mulv(a0, a1, -VALUE);
test_mula(a0, a1, a3);
test_divc_n(a0, a1);
test_divv(a0, a1, -VALUE);
test_diva(a0, a1, a3);
+ test_negc(a0, a1);
}
// Test and verify results
System.out.println("Verification");
int errn = 0;
{
@@ -338,10 +339,21 @@
errn += verify("test_diva_n: ", 11, a0[11], ((ADD_INIT+11)/(-Float.MIN_NORMAL)));
for (int i=12; i<ARRLEN; i++) {
errn += verify("test_diva_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE)));
}
+ test_negc(a0, a1);
+ errn += verify("test_negc: ", 0, a0[0], (Float.NaN));
+ errn += verify("test_negc: ", 1, a0[1], (Float.NEGATIVE_INFINITY));
+ errn += verify("test_negc: ", 2, a0[2], (Float.POSITIVE_INFINITY));
+ errn += verify("test_negc: ", 3, a0[3], (float)(-Float.MAX_VALUE));
+ errn += verify("test_negc: ", 4, a0[4], (float)(-Float.MIN_VALUE));
+ errn += verify("test_negc: ", 5, a0[5], (float)(-Float.MIN_NORMAL));
+ for (int i=6; i<ARRLEN; i++) {
+ errn += verify("test_negc: ", i, a0[i], (float)(-((float)(ADD_INIT+i))));
+ }
+
}
if (errn > 0)
return errn;
@@ -467,10 +479,17 @@
test_diva(a0, a1, a3);
}
end = System.currentTimeMillis();
System.out.println("test_diva_n: " + (end - start));
+ start = System.currentTimeMillis();
+ for (int i=0; i<ITERS; i++) {
+ test_negc(a0, a1);
+ }
+ end = System.currentTimeMillis();
+ System.out.println("test_negc_n: " + (end - start));
+
return errn;
}
static float test_sum(float[] a1) {
float sum = 0;
@@ -552,10 +571,16 @@
for (int i = 0; i < a0.length; i+=1) {
a0[i] = (a1[i]/a2[i]);
}
}
+ static void test_negc(float[] a0, float[] a1) {
+ for (int i = 0; i < a0.length; i+=1) {
+ a0[i] = (float)(-((float)a1[i]));
+ }
+ }
+
static int verify(String text, int i, float elem, float val) {
if (elem != val && !(Float.isNaN(elem) && Float.isNaN(val))) {
System.err.println(text + "[" + i + "] = " + elem + " != " + val);
return 1;
}
< prev index next >