annotate src/hotspot/os_cpu/solaris_sparc/count_trailing_zeros_solaris_sparc.hpp @ 54526:ee29b516a36a

revert changes
author jlaskey
date Wed, 23 Jan 2019 16:09:20 -0400
parents 71c04702a3d5
children
rev   line source
kbarrett@46437 1 /*
coleenp@54304 2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
kbarrett@46437 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kbarrett@46437 4 *
kbarrett@46437 5 * This code is free software; you can redistribute it and/or modify it
kbarrett@46437 6 * under the terms of the GNU General Public License version 2 only, as
kbarrett@46437 7 * published by the Free Software Foundation.
kbarrett@46437 8 *
kbarrett@46437 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kbarrett@46437 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kbarrett@46437 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kbarrett@46437 12 * version 2 for more details (a copy is included in the LICENSE file that
kbarrett@46437 13 * accompanied this code).
kbarrett@46437 14 *
kbarrett@46437 15 * You should have received a copy of the GNU General Public License version
kbarrett@46437 16 * 2 along with this work; if not, write to the Free Software Foundation,
kbarrett@46437 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kbarrett@46437 18 *
kbarrett@46437 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
kbarrett@46437 20 * or visit www.oracle.com if you need additional information or have any
kbarrett@46437 21 * questions.
kbarrett@46437 22 *
kbarrett@46437 23 */
kbarrett@46437 24
coleenp@54304 25 #ifndef OS_CPU_SOLARIS_SPARC_COUNT_TRAILING_ZEROS_SOLARIS_SPARC_HPP
coleenp@54304 26 #define OS_CPU_SOLARIS_SPARC_COUNT_TRAILING_ZEROS_SOLARIS_SPARC_HPP
kbarrett@46437 27
kbarrett@46437 28 #include "utilities/globalDefinitions.hpp"
kbarrett@46437 29
kbarrett@46437 30 inline unsigned count_trailing_zeros(uintx x) {
kbarrett@46437 31 assert(x != 0, "precondition");
kbarrett@46437 32 // Reduce to mask with ones in all positions below the least
kbarrett@46437 33 // significant set bit of x, and zeros otherwise.
kbarrett@46437 34 uintx rx = (x - 1) & ~x; // sub x, 1, rx; andn rx, x, rx;
kbarrett@46437 35 // Then count the set bits in the reduction.
kbarrett@46437 36 uintx result;
kbarrett@46437 37 __asm__(" popc %1, %0\n\t" : "=r" (result) : "r" (rx));
kbarrett@46437 38 return result;
kbarrett@46437 39 }
kbarrett@46437 40
coleenp@54304 41 #endif // OS_CPU_SOLARIS_SPARC_COUNT_TRAILING_ZEROS_SOLARIS_SPARC_HPP