test/hotspot/jtreg/compiler/c2/Test6796786.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 47216 71c04702a3d5
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9439
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     1
/*
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     4
 *
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     8
 *
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    13
 * accompanied this code).
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    14
 *
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    18
 *
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    21
 * questions.
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    22
 */
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    23
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    24
/**
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    25
 * @test
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    26
 * @bug 6796786
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    27
 * @summary invalid FP identity transform - (a - b) -> b - a
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main/othervm -Xbatch compiler.c2.Test6796786
9439
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    30
 */
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    31
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    32
package compiler.c2;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    33
9439
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    34
public class Test6796786 {
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    35
    static volatile float d1;
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    36
    static volatile float d2;
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    37
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    38
    public static void main(String[] args) {
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    39
        int total = 0;
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    40
        for (int i = 0; i < 100000; i++) {
9448
6002f46558d8 7042070: Typo in Test6796786.java
kvn
parents: 9439
diff changeset
    41
            if (Float.floatToRawIntBits(- (d1 - d2)) == Float.floatToRawIntBits(-0.0f)) {
9439
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    42
                total++;
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    43
            }
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    44
        }
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    45
        if (total != 100000) {
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    46
            throw new InternalError();
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    47
        }
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    48
    }
79dc8699094b 6796786: invalid FP identity transform - (a - b) -> b - a
never
parents:
diff changeset
    49
}