hotspot/test/compiler/6875866/Test.java
author kvn
Mon, 14 Sep 2009 12:14:20 -0700
changeset 3905 7d725029ac85
child 5547 f4b087cbb361
permissions -rw-r--r--
6827605: new String intrinsics may prevent EA scalar replacement 6875866: Intrinsic for String.indexOf() is broken on x86 with SSE4.2 Summary: Modify String intrinsic methods to pass char[] pointers instead of string oops. Reviewed-by: never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3905
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     1
/*
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     4
 *
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     8
 *
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    13
 * accompanied this code).
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    14
 *
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    18
 *
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    21
 * have any questions.
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    22
 */
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    23
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    24
/**
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    25
 * @test
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    26
 * @bug 6875866
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    27
 * @summary Intrinsic for String.indexOf() is broken on x86 with SSE4.2
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    28
 *
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    29
 * @run main/othervm -Xcomp Test
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    30
 */
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    31
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    32
public class Test {
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    33
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    34
  static int IndexOfTest(String str) {
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    35
    return str.indexOf("11111xx1x");
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    36
  }
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    37
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    38
  public static void main(String args[]) {
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    39
    String str = "11111xx11111xx1x";
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    40
    int idx = IndexOfTest(str);
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    41
    System.out.println("IndexOf = " + idx);
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    42
    if (idx != 7) {
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    43
      System.exit(97);
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    44
    }
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    45
  }
7d725029ac85 6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
diff changeset
    46
}