Mercurial > hg > truffle
annotate graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64LongSubstitutions.java @ 19116:7227f5671c87
Prototype for folding object equality at parse time.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 04 Feb 2015 03:04:20 +0100 |
parents | fe0db662e982 |
children |
rev | line source |
---|---|
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
24 package com.oracle.graal.replacements.amd64; |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
25 |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
26 import com.oracle.graal.api.replacements.*; |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
27 |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
28 @ClassSubstitution(Long.class) |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
29 public class AMD64LongSubstitutions { |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
30 |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
31 @MethodSubstitution(guard = AMD64Guards.CountLeadingZerosSupported.class) |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
32 public static int numberOfLeadingZeros(long i) { |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
33 return AMD64CountLeadingZerosNode.count(i); |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
34 } |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
35 |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
36 @MethodSubstitution(guard = AMD64Guards.CountTrailingZerosSupported.class) |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
37 public static int numberOfTrailingZeros(long i) { |
18495
fe0db662e982
adds ability for substitution guards to have a constructor with an Architecture argument
Doug Simon <doug.simon@oracle.com>
parents:
18415
diff
changeset
|
38 return AMD64CountTrailingZerosNode.count(i); |
18415
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
39 } |
6dc4f0be9a70
Add support of lzcnt and tzcnt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
40 } |