Skip to content

Commit 2fbe475

Browse files
committed
8374785: Template Library: need to tag Float16.copySign as having non-deterministic result because of multiple NaNs with different sign bits
Reviewed-by: thartmann, qamai
1 parent d0aae04 commit 2fbe475

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/hotspot/jtreg/compiler/lib/template_framework/library/Operations.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ private static List<Expression> generatePrimitiveOperations() {
274274
ops.add(Expression.make(BOOLEANS, "Boolean.logicalXor(", BOOLEANS, ", ", BOOLEANS, ")"));
275275

276276
// TODO: Math and other classes.
277+
// Note: Math.copySign is non-deterministic because of NaN having encoding with sign bit set and unset.
277278

278279
// Make sure the list is not modifiable.
279280
return List.copyOf(ops);
@@ -294,7 +295,8 @@ private static List<Expression> generateFloat16Operations() {
294295
ops.add(Expression.make(INTS, "Float16.compare(", FLOAT16, ",", FLOAT16, ")"));
295296
addComparisonOperations(ops, "Float16.compare", FLOAT16);
296297
ops.add(Expression.make(INTS, "(", FLOAT16, ").compareTo(", FLOAT16, ")"));
297-
ops.add(Expression.make(FLOAT16, "Float16.copySign(", FLOAT16, ",", FLOAT16, ")"));
298+
// Note: There are NaN encodings with bit set or unset.
299+
ops.add(Expression.make(FLOAT16, "Float16.copySign(", FLOAT16, ",", FLOAT16, ")", WITH_NONDETERMINISTIC_RESULT));
298300
ops.add(Expression.make(FLOAT16, "Float16.divide(", FLOAT16, ",", FLOAT16, ")"));
299301
ops.add(Expression.make(BOOLEANS, "", FLOAT16, ".equals(", FLOAT16, ")"));
300302
// Note: there are multiple NaN values with different bit representations.

0 commit comments

Comments
 (0)