1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2023 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker public class Main { main(String[] args)18*795d594fSAndroid Build Coastguard Worker public static void main(String[] args) { 19*795d594fSAndroid Build Coastguard Worker $noinline$testReverseInt(); 20*795d594fSAndroid Build Coastguard Worker $noinline$testReverseLong(); 21*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesInt(); 22*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesLong(); 23*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesShort(); 24*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountInt(); 25*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountLong(); 26*795d594fSAndroid Build Coastguard Worker $noinline$testDivideUnsignedInt(); 27*795d594fSAndroid Build Coastguard Worker $noinline$testDivideUnsignedLong(); 28*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitInt(); 29*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitLong(); 30*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitInt(); 31*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitLong(); 32*795d594fSAndroid Build Coastguard Worker $noinline$testLeadingZerosInt(); 33*795d594fSAndroid Build Coastguard Worker $noinline$testLeadingZerosLong(); 34*795d594fSAndroid Build Coastguard Worker $noinline$testTrailingZerosInt(); 35*795d594fSAndroid Build Coastguard Worker $noinline$testTrailingZerosLong(); 36*795d594fSAndroid Build Coastguard Worker } 37*795d594fSAndroid Build Coastguard Worker 38*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseInt() constant_folding (before) 39*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerReverse 40*795d594fSAndroid Build Coastguard Worker 41*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseInt() constant_folding (after) 42*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerReverse $noinline$testReverseInt()43*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseInt() { 44*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(-2, Integer.reverse(Integer.MAX_VALUE)); 45*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.reverse(Integer.MIN_VALUE)); 46*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.reverse(0)); 47*795d594fSAndroid Build Coastguard Worker // 0101... to 1010.... 48*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0x55555555, Integer.reverse(0xAAAAAAAA)); 49*795d594fSAndroid Build Coastguard Worker // 1010.... to 0101... 50*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0xAAAAAAAA, Integer.reverse(0x55555555)); 51*795d594fSAndroid Build Coastguard Worker $noinline$testReverseInt_powerOfTwo(); 52*795d594fSAndroid Build Coastguard Worker } 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseInt_powerOfTwo() constant_folding (before) 55*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerReverse 56*795d594fSAndroid Build Coastguard Worker 57*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseInt_powerOfTwo() constant_folding (after) 58*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerReverse $noinline$testReverseInt_powerOfTwo()59*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseInt_powerOfTwo() { 60*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.reverse(1 << 0)); 61*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 30, Integer.reverse(1 << 1)); 62*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 29, Integer.reverse(1 << 2)); 63*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 28, Integer.reverse(1 << 3)); 64*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 27, Integer.reverse(1 << 4)); 65*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 26, Integer.reverse(1 << 5)); 66*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 25, Integer.reverse(1 << 6)); 67*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 24, Integer.reverse(1 << 7)); 68*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 23, Integer.reverse(1 << 8)); 69*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 22, Integer.reverse(1 << 9)); 70*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 21, Integer.reverse(1 << 10)); 71*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 20, Integer.reverse(1 << 11)); 72*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 19, Integer.reverse(1 << 12)); 73*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 18, Integer.reverse(1 << 13)); 74*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 17, Integer.reverse(1 << 14)); 75*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 16, Integer.reverse(1 << 15)); 76*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 15, Integer.reverse(1 << 16)); 77*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 14, Integer.reverse(1 << 17)); 78*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 13, Integer.reverse(1 << 18)); 79*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 12, Integer.reverse(1 << 19)); 80*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 11, Integer.reverse(1 << 20)); 81*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 10, Integer.reverse(1 << 21)); 82*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 9, Integer.reverse(1 << 22)); 83*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 8, Integer.reverse(1 << 23)); 84*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 7, Integer.reverse(1 << 24)); 85*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 6, Integer.reverse(1 << 25)); 86*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 5, Integer.reverse(1 << 26)); 87*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 4, Integer.reverse(1 << 27)); 88*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 3, Integer.reverse(1 << 28)); 89*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 2, Integer.reverse(1 << 29)); 90*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 1, Integer.reverse(1 << 30)); 91*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 0, Integer.reverse(1 << 31)); 92*795d594fSAndroid Build Coastguard Worker } 93*795d594fSAndroid Build Coastguard Worker 94*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLong() constant_folding (before) 95*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverse 96*795d594fSAndroid Build Coastguard Worker 97*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLong() constant_folding (after) 98*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverse $noinline$testReverseLong()99*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseLong() { 100*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(-2L, Long.reverse(Long.MAX_VALUE)); 101*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.reverse(Long.MIN_VALUE)); 102*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.reverse(0L)); 103*795d594fSAndroid Build Coastguard Worker // 0101... to 1010.... 104*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0x5555555555555555L, Long.reverse(0xAAAAAAAAAAAAAAAAL)); 105*795d594fSAndroid Build Coastguard Worker // 1010.... to 0101... 106*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0xAAAAAAAAAAAAAAAAL, Long.reverse(0x5555555555555555L)); 107*795d594fSAndroid Build Coastguard Worker $noinline$testReverseLongFirst32_powerOfTwo(); 108*795d594fSAndroid Build Coastguard Worker $noinline$testReverseLongLast32_powerOfTwo(); 109*795d594fSAndroid Build Coastguard Worker } 110*795d594fSAndroid Build Coastguard Worker 111*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLongFirst32_powerOfTwo() constant_folding (before) 112*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverse 113*795d594fSAndroid Build Coastguard Worker 114*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLongFirst32_powerOfTwo() constant_folding (after) 115*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverse $noinline$testReverseLongFirst32_powerOfTwo()116*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseLongFirst32_powerOfTwo() { 117*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63, Long.reverse(1L << 0)); 118*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 62, Long.reverse(1L << 1)); 119*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 61, Long.reverse(1L << 2)); 120*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 60, Long.reverse(1L << 3)); 121*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 59, Long.reverse(1L << 4)); 122*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 58, Long.reverse(1L << 5)); 123*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 57, Long.reverse(1L << 6)); 124*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 56, Long.reverse(1L << 7)); 125*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 55, Long.reverse(1L << 8)); 126*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 54, Long.reverse(1L << 9)); 127*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 53, Long.reverse(1L << 10)); 128*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 52, Long.reverse(1L << 11)); 129*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 51, Long.reverse(1L << 12)); 130*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 50, Long.reverse(1L << 13)); 131*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 49, Long.reverse(1L << 14)); 132*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 48, Long.reverse(1L << 15)); 133*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 47, Long.reverse(1L << 16)); 134*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 46, Long.reverse(1L << 17)); 135*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 45, Long.reverse(1L << 18)); 136*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 44, Long.reverse(1L << 19)); 137*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 43, Long.reverse(1L << 20)); 138*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 42, Long.reverse(1L << 21)); 139*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 41, Long.reverse(1L << 22)); 140*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 40, Long.reverse(1L << 23)); 141*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 39, Long.reverse(1L << 24)); 142*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 38, Long.reverse(1L << 25)); 143*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 37, Long.reverse(1L << 26)); 144*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 36, Long.reverse(1L << 27)); 145*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 35, Long.reverse(1L << 28)); 146*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 34, Long.reverse(1L << 29)); 147*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 33, Long.reverse(1L << 30)); 148*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 32, Long.reverse(1L << 31)); 149*795d594fSAndroid Build Coastguard Worker } 150*795d594fSAndroid Build Coastguard Worker 151*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLongLast32_powerOfTwo() constant_folding (before) 152*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverse 153*795d594fSAndroid Build Coastguard Worker 154*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseLongLast32_powerOfTwo() constant_folding (after) 155*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverse $noinline$testReverseLongLast32_powerOfTwo()156*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseLongLast32_powerOfTwo() { 157*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 31, Long.reverse(1L << 32)); 158*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 30, Long.reverse(1L << 33)); 159*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 29, Long.reverse(1L << 34)); 160*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 28, Long.reverse(1L << 35)); 161*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 27, Long.reverse(1L << 36)); 162*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 26, Long.reverse(1L << 37)); 163*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 25, Long.reverse(1L << 38)); 164*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 24, Long.reverse(1L << 39)); 165*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 23, Long.reverse(1L << 40)); 166*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 22, Long.reverse(1L << 41)); 167*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 21, Long.reverse(1L << 42)); 168*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 20, Long.reverse(1L << 43)); 169*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 19, Long.reverse(1L << 44)); 170*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 18, Long.reverse(1L << 45)); 171*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 17, Long.reverse(1L << 46)); 172*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 16, Long.reverse(1L << 47)); 173*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 15, Long.reverse(1L << 48)); 174*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 14, Long.reverse(1L << 49)); 175*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 13, Long.reverse(1L << 50)); 176*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 12, Long.reverse(1L << 51)); 177*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 11, Long.reverse(1L << 52)); 178*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 10, Long.reverse(1L << 53)); 179*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 9, Long.reverse(1L << 54)); 180*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 8, Long.reverse(1L << 55)); 181*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 7, Long.reverse(1L << 56)); 182*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 6, Long.reverse(1L << 57)); 183*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 5, Long.reverse(1L << 58)); 184*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 4, Long.reverse(1L << 59)); 185*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 3, Long.reverse(1L << 60)); 186*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 2, Long.reverse(1L << 61)); 187*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 1, Long.reverse(1L << 62)); 188*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 0, Long.reverse(1L << 63)); 189*795d594fSAndroid Build Coastguard Worker } 190*795d594fSAndroid Build Coastguard Worker 191*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesInt() constant_folding (before) 192*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerReverseBytes 193*795d594fSAndroid Build Coastguard Worker 194*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesInt() constant_folding (after) 195*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerReverseBytes $noinline$testReverseBytesInt()196*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesInt() { 197*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(-129, Integer.reverseBytes(Integer.MAX_VALUE)); 198*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(128, Integer.reverseBytes(Integer.MIN_VALUE)); 199*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.reverseBytes(0)); 200*795d594fSAndroid Build Coastguard Worker // 0101... to 0101.... 201*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0x55555555, Integer.reverseBytes(0x55555555)); 202*795d594fSAndroid Build Coastguard Worker // 1010.... to 1010... 203*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0xAAAAAAAA, Integer.reverseBytes(0xAAAAAAAA)); 204*795d594fSAndroid Build Coastguard Worker // Going up/down the hex digits. 205*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0x01234567, Integer.reverseBytes(0x67452301)); 206*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0x89ABCDEF, Integer.reverseBytes(0xEFCDAB89)); 207*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0xFEDCBA98, Integer.reverseBytes(0x98BADCFE)); 208*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0x76543210, Integer.reverseBytes(0x10325476)); 209*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesInt_powerOfTwo(); 210*795d594fSAndroid Build Coastguard Worker } 211*795d594fSAndroid Build Coastguard Worker 212*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesInt_powerOfTwo() constant_folding (before) 213*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerReverseBytes 214*795d594fSAndroid Build Coastguard Worker 215*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesInt_powerOfTwo() constant_folding (after) 216*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerReverseBytes $noinline$testReverseBytesInt_powerOfTwo()217*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesInt_powerOfTwo() { 218*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 24, Integer.reverseBytes(1 << 0)); 219*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 25, Integer.reverseBytes(1 << 1)); 220*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 26, Integer.reverseBytes(1 << 2)); 221*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 27, Integer.reverseBytes(1 << 3)); 222*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 28, Integer.reverseBytes(1 << 4)); 223*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 29, Integer.reverseBytes(1 << 5)); 224*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 30, Integer.reverseBytes(1 << 6)); 225*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.reverseBytes(1 << 7)); 226*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 16, Integer.reverseBytes(1 << 8)); 227*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 17, Integer.reverseBytes(1 << 9)); 228*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 18, Integer.reverseBytes(1 << 10)); 229*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 19, Integer.reverseBytes(1 << 11)); 230*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 20, Integer.reverseBytes(1 << 12)); 231*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 21, Integer.reverseBytes(1 << 13)); 232*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 22, Integer.reverseBytes(1 << 14)); 233*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 23, Integer.reverseBytes(1 << 15)); 234*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 8, Integer.reverseBytes(1 << 16)); 235*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 9, Integer.reverseBytes(1 << 17)); 236*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 10, Integer.reverseBytes(1 << 18)); 237*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 11, Integer.reverseBytes(1 << 19)); 238*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 12, Integer.reverseBytes(1 << 20)); 239*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 13, Integer.reverseBytes(1 << 21)); 240*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 14, Integer.reverseBytes(1 << 22)); 241*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 15, Integer.reverseBytes(1 << 23)); 242*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 0, Integer.reverseBytes(1 << 24)); 243*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 1, Integer.reverseBytes(1 << 25)); 244*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 2, Integer.reverseBytes(1 << 26)); 245*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 3, Integer.reverseBytes(1 << 27)); 246*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 4, Integer.reverseBytes(1 << 28)); 247*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 5, Integer.reverseBytes(1 << 29)); 248*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 6, Integer.reverseBytes(1 << 30)); 249*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 7, Integer.reverseBytes(1 << 31)); 250*795d594fSAndroid Build Coastguard Worker } 251*795d594fSAndroid Build Coastguard Worker 252*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLong() constant_folding (before) 253*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverseBytes 254*795d594fSAndroid Build Coastguard Worker 255*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLong() constant_folding (after) 256*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverseBytes $noinline$testReverseBytesLong()257*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesLong() { 258*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(-129L, Long.reverseBytes(Long.MAX_VALUE)); 259*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(128L, Long.reverseBytes(Long.MIN_VALUE)); 260*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.reverseBytes(0L)); 261*795d594fSAndroid Build Coastguard Worker // 0101... to 0101.... 262*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0x5555555555555555L, Long.reverseBytes(0x5555555555555555L)); 263*795d594fSAndroid Build Coastguard Worker // 1010.... to 1010... 264*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0xAAAAAAAAAAAAAAAAL, Long.reverseBytes(0xAAAAAAAAAAAAAAAAL)); 265*795d594fSAndroid Build Coastguard Worker // Going up/down the hex digits. 266*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0x0123456789ABCDEFL, Long.reverseBytes(0xEFCDAB8967452301L)); 267*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0xFEDCBA9876543210L, Long.reverseBytes(0x1032547698BADCFEL)); 268*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesLongFirst32_powerOfTwo(); 269*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesLongLast32_powerOfTwo(); 270*795d594fSAndroid Build Coastguard Worker } 271*795d594fSAndroid Build Coastguard Worker 272*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLongFirst32_powerOfTwo() constant_folding (before) 273*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverseBytes 274*795d594fSAndroid Build Coastguard Worker 275*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLongFirst32_powerOfTwo() constant_folding (after) 276*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverseBytes $noinline$testReverseBytesLongFirst32_powerOfTwo()277*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesLongFirst32_powerOfTwo() { 278*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 56, Long.reverseBytes(1L << 0)); 279*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 57, Long.reverseBytes(1L << 1)); 280*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 58, Long.reverseBytes(1L << 2)); 281*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 59, Long.reverseBytes(1L << 3)); 282*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 60, Long.reverseBytes(1L << 4)); 283*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 61, Long.reverseBytes(1L << 5)); 284*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 62, Long.reverseBytes(1L << 6)); 285*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63, Long.reverseBytes(1L << 7)); 286*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 48, Long.reverseBytes(1L << 8)); 287*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 49, Long.reverseBytes(1L << 9)); 288*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 50, Long.reverseBytes(1L << 10)); 289*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 51, Long.reverseBytes(1L << 11)); 290*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 52, Long.reverseBytes(1L << 12)); 291*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 53, Long.reverseBytes(1L << 13)); 292*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 54, Long.reverseBytes(1L << 14)); 293*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 55, Long.reverseBytes(1L << 15)); 294*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 40, Long.reverseBytes(1L << 16)); 295*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 41, Long.reverseBytes(1L << 17)); 296*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 42, Long.reverseBytes(1L << 18)); 297*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 43, Long.reverseBytes(1L << 19)); 298*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 44, Long.reverseBytes(1L << 20)); 299*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 45, Long.reverseBytes(1L << 21)); 300*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 46, Long.reverseBytes(1L << 22)); 301*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 47, Long.reverseBytes(1L << 23)); 302*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 32, Long.reverseBytes(1L << 24)); 303*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 33, Long.reverseBytes(1L << 25)); 304*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 34, Long.reverseBytes(1L << 26)); 305*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 35, Long.reverseBytes(1L << 27)); 306*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 36, Long.reverseBytes(1L << 28)); 307*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 37, Long.reverseBytes(1L << 29)); 308*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 38, Long.reverseBytes(1L << 30)); 309*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 39, Long.reverseBytes(1L << 31)); 310*795d594fSAndroid Build Coastguard Worker } 311*795d594fSAndroid Build Coastguard Worker 312*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLongLast32_powerOfTwo() constant_folding (before) 313*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongReverseBytes 314*795d594fSAndroid Build Coastguard Worker 315*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesLongLast32_powerOfTwo() constant_folding (after) 316*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongReverseBytes $noinline$testReverseBytesLongLast32_powerOfTwo()317*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesLongLast32_powerOfTwo() { 318*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 24, Long.reverseBytes(1L << 32)); 319*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 25, Long.reverseBytes(1L << 33)); 320*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 26, Long.reverseBytes(1L << 34)); 321*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 27, Long.reverseBytes(1L << 35)); 322*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 28, Long.reverseBytes(1L << 36)); 323*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 29, Long.reverseBytes(1L << 37)); 324*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 30, Long.reverseBytes(1L << 38)); 325*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 31, Long.reverseBytes(1L << 39)); 326*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 16, Long.reverseBytes(1L << 40)); 327*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 17, Long.reverseBytes(1L << 41)); 328*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 18, Long.reverseBytes(1L << 42)); 329*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 19, Long.reverseBytes(1L << 43)); 330*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 20, Long.reverseBytes(1L << 44)); 331*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 21, Long.reverseBytes(1L << 45)); 332*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 22, Long.reverseBytes(1L << 46)); 333*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 23, Long.reverseBytes(1L << 47)); 334*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 8, Long.reverseBytes(1L << 48)); 335*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 9, Long.reverseBytes(1L << 49)); 336*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 10, Long.reverseBytes(1L << 50)); 337*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 11, Long.reverseBytes(1L << 51)); 338*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 12, Long.reverseBytes(1L << 52)); 339*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 13, Long.reverseBytes(1L << 53)); 340*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 14, Long.reverseBytes(1L << 54)); 341*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 15, Long.reverseBytes(1L << 55)); 342*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 0, Long.reverseBytes(1L << 56)); 343*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 1, Long.reverseBytes(1L << 57)); 344*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 2, Long.reverseBytes(1L << 58)); 345*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 3, Long.reverseBytes(1L << 59)); 346*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 4, Long.reverseBytes(1L << 60)); 347*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 5, Long.reverseBytes(1L << 61)); 348*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 6, Long.reverseBytes(1L << 62)); 349*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 7, Long.reverseBytes(1L << 63)); 350*795d594fSAndroid Build Coastguard Worker } 351*795d594fSAndroid Build Coastguard Worker 352*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesShort() constant_folding (before) 353*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:ShortReverseBytes 354*795d594fSAndroid Build Coastguard Worker 355*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesShort() constant_folding (after) 356*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:ShortReverseBytes $noinline$testReverseBytesShort()357*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesShort() { 358*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (-129), Short.reverseBytes(Short.MAX_VALUE)); 359*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (128), Short.reverseBytes(Short.MIN_VALUE)); 360*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0), Short.reverseBytes((short) 0)); 361*795d594fSAndroid Build Coastguard Worker // 0101... to 0101.... 362*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x5555), Short.reverseBytes((short) 0x5555)); 363*795d594fSAndroid Build Coastguard Worker // 1010.... to 1010... 364*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0xAAAA), Short.reverseBytes((short) 0xAAAA)); 365*795d594fSAndroid Build Coastguard Worker // Going up/down the hex digits. 366*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x0123), Short.reverseBytes((short) 0x2301)); 367*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x4567), Short.reverseBytes((short) 0x6745)); 368*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x89AB), Short.reverseBytes((short) 0xAB89)); 369*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0xCDEF), Short.reverseBytes((short) 0xEFCD)); 370*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0xFEDC), Short.reverseBytes((short) 0xDCFE)); 371*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0xBA98), Short.reverseBytes((short) 0x98BA)); 372*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x7654), Short.reverseBytes((short) 0x5476)); 373*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (0x3210), Short.reverseBytes((short) 0x1032)); 374*795d594fSAndroid Build Coastguard Worker $noinline$testReverseBytesShort_powerOfTwo(); 375*795d594fSAndroid Build Coastguard Worker } 376*795d594fSAndroid Build Coastguard Worker 377*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesShort_powerOfTwo() constant_folding (before) 378*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:ShortReverseBytes 379*795d594fSAndroid Build Coastguard Worker 380*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testReverseBytesShort_powerOfTwo() constant_folding (after) 381*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:ShortReverseBytes $noinline$testReverseBytesShort_powerOfTwo()382*795d594fSAndroid Build Coastguard Worker private static void $noinline$testReverseBytesShort_powerOfTwo() { 383*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 8), Short.reverseBytes((short) (1 << 0))); 384*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 9), Short.reverseBytes((short) (1 << 1))); 385*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 10), Short.reverseBytes((short) (1 << 2))); 386*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 11), Short.reverseBytes((short) (1 << 3))); 387*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 12), Short.reverseBytes((short) (1 << 4))); 388*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 13), Short.reverseBytes((short) (1 << 5))); 389*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 14), Short.reverseBytes((short) (1 << 6))); 390*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 15), Short.reverseBytes((short) (1 << 7))); 391*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 0), Short.reverseBytes((short) (1 << 8))); 392*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 1), Short.reverseBytes((short) (1 << 9))); 393*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 2), Short.reverseBytes((short) (1 << 10))); 394*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 3), Short.reverseBytes((short) (1 << 11))); 395*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 4), Short.reverseBytes((short) (1 << 12))); 396*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 5), Short.reverseBytes((short) (1 << 13))); 397*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 6), Short.reverseBytes((short) (1 << 14))); 398*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals((short) (1 << 7), Short.reverseBytes((short) (1 << 15))); 399*795d594fSAndroid Build Coastguard Worker } 400*795d594fSAndroid Build Coastguard Worker 401*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt() constant_folding (before) 402*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerBitCount 403*795d594fSAndroid Build Coastguard Worker 404*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt() constant_folding (after) 405*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerBitCount $noinline$testBitCountInt()406*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountInt() { 407*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Integer.bitCount(Integer.MAX_VALUE)); 408*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(Integer.MIN_VALUE)); 409*795d594fSAndroid Build Coastguard Worker // 0101... and 1010... 410*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Integer.bitCount(0x55555555)); 411*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Integer.bitCount(0xAAAAAAAA)); 412*795d594fSAndroid Build Coastguard Worker // 0000... and 1111... 413*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.bitCount(0)); 414*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(32, Integer.bitCount(0xFFFFFFFF)); 415*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountInt_powerOfTwo(); 416*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountInt_powerOfTwoMinusOne(); 417*795d594fSAndroid Build Coastguard Worker } 418*795d594fSAndroid Build Coastguard Worker 419*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt_powerOfTwo() constant_folding (before) 420*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerBitCount 421*795d594fSAndroid Build Coastguard Worker 422*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt_powerOfTwo() constant_folding (after) 423*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerBitCount $noinline$testBitCountInt_powerOfTwo()424*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountInt_powerOfTwo() { 425*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 0)); 426*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 1)); 427*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 2)); 428*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 3)); 429*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 4)); 430*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 5)); 431*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 6)); 432*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 7)); 433*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 8)); 434*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 9)); 435*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 10)); 436*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 11)); 437*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 12)); 438*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 13)); 439*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 14)); 440*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 15)); 441*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 16)); 442*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 17)); 443*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 18)); 444*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 19)); 445*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 20)); 446*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 21)); 447*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 22)); 448*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 23)); 449*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 24)); 450*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 25)); 451*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 26)); 452*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 27)); 453*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 28)); 454*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 29)); 455*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 30)); 456*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.bitCount(1 << 31)); 457*795d594fSAndroid Build Coastguard Worker } 458*795d594fSAndroid Build Coastguard Worker 459*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt_powerOfTwoMinusOne() constant_folding (before) 460*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerBitCount 461*795d594fSAndroid Build Coastguard Worker 462*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountInt_powerOfTwoMinusOne() constant_folding (after) 463*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerBitCount $noinline$testBitCountInt_powerOfTwoMinusOne()464*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountInt_powerOfTwoMinusOne() { 465*795d594fSAndroid Build Coastguard Worker // We start on `(1 << 2) - 1` (i.e. `3`) as the other values are already being tested. 466*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2, Integer.bitCount((1 << 2) - 1)); 467*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(3, Integer.bitCount((1 << 3) - 1)); 468*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(4, Integer.bitCount((1 << 4) - 1)); 469*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Integer.bitCount((1 << 5) - 1)); 470*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(6, Integer.bitCount((1 << 6) - 1)); 471*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(7, Integer.bitCount((1 << 7) - 1)); 472*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(8, Integer.bitCount((1 << 8) - 1)); 473*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(9, Integer.bitCount((1 << 9) - 1)); 474*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(10, Integer.bitCount((1 << 10) - 1)); 475*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(11, Integer.bitCount((1 << 11) - 1)); 476*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(12, Integer.bitCount((1 << 12) - 1)); 477*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(13, Integer.bitCount((1 << 13) - 1)); 478*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(14, Integer.bitCount((1 << 14) - 1)); 479*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(15, Integer.bitCount((1 << 15) - 1)); 480*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Integer.bitCount((1 << 16) - 1)); 481*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(17, Integer.bitCount((1 << 17) - 1)); 482*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(18, Integer.bitCount((1 << 18) - 1)); 483*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(19, Integer.bitCount((1 << 19) - 1)); 484*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(20, Integer.bitCount((1 << 20) - 1)); 485*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(21, Integer.bitCount((1 << 21) - 1)); 486*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(22, Integer.bitCount((1 << 22) - 1)); 487*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(23, Integer.bitCount((1 << 23) - 1)); 488*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(24, Integer.bitCount((1 << 24) - 1)); 489*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(25, Integer.bitCount((1 << 25) - 1)); 490*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(26, Integer.bitCount((1 << 26) - 1)); 491*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(27, Integer.bitCount((1 << 27) - 1)); 492*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(28, Integer.bitCount((1 << 28) - 1)); 493*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(29, Integer.bitCount((1 << 29) - 1)); 494*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(30, Integer.bitCount((1 << 30) - 1)); 495*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Integer.bitCount((1 << 31) - 1)); 496*795d594fSAndroid Build Coastguard Worker } 497*795d594fSAndroid Build Coastguard Worker 498*795d594fSAndroid Build Coastguard Worker 499*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLong() constant_folding (before) 500*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongBitCount 501*795d594fSAndroid Build Coastguard Worker 502*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLong() constant_folding (after) 503*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongBitCount $noinline$testBitCountLong()504*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountLong() { 505*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(63L, Long.bitCount(Long.MAX_VALUE)); 506*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(Long.MIN_VALUE)); 507*795d594fSAndroid Build Coastguard Worker // 0101... and 1010... 508*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(32L, Long.bitCount(0x5555555555555555L)); 509*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(32L, Long.bitCount(0xAAAAAAAAAAAAAAAAL)); 510*795d594fSAndroid Build Coastguard Worker // 0000... and 1111... 511*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.bitCount(0L)); 512*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(64L, Long.bitCount(0xFFFFFFFFFFFFFFFFL)); 513*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountLongFirst32_powerOfTwo(); 514*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountLongLast32_powerOfTwo(); 515*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountLongFirst32_powerOfTwoMinusOne(); 516*795d594fSAndroid Build Coastguard Worker $noinline$testBitCountLongLast32_powerOfTwoMinusOne(); 517*795d594fSAndroid Build Coastguard Worker } 518*795d594fSAndroid Build Coastguard Worker 519*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongFirst32_powerOfTwo() constant_folding (before) 520*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongBitCount 521*795d594fSAndroid Build Coastguard Worker 522*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongFirst32_powerOfTwo() constant_folding (after) 523*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongBitCount $noinline$testBitCountLongFirst32_powerOfTwo()524*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountLongFirst32_powerOfTwo() { 525*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 0L)); 526*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 1L)); 527*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 2L)); 528*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 3L)); 529*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 4L)); 530*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 5L)); 531*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 6L)); 532*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 7L)); 533*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 8L)); 534*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 9L)); 535*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 10L)); 536*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 11L)); 537*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 12L)); 538*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 13L)); 539*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 14L)); 540*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 15L)); 541*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 16L)); 542*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 17L)); 543*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 18L)); 544*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 19L)); 545*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 20L)); 546*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 21L)); 547*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 22L)); 548*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 23L)); 549*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 24L)); 550*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 25L)); 551*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 26L)); 552*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 27L)); 553*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 28L)); 554*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 29L)); 555*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 30L)); 556*795d594fSAndroid Build Coastguard Worker } 557*795d594fSAndroid Build Coastguard Worker 558*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongLast32_powerOfTwo() constant_folding (before) 559*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongBitCount 560*795d594fSAndroid Build Coastguard Worker 561*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongLast32_powerOfTwo() constant_folding (after) 562*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongBitCount $noinline$testBitCountLongLast32_powerOfTwo()563*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountLongLast32_powerOfTwo() { 564*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 31L)); 565*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 32L)); 566*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 33L)); 567*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 34L)); 568*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 35L)); 569*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 36L)); 570*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 37L)); 571*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 38L)); 572*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 39L)); 573*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 40L)); 574*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 41L)); 575*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 42L)); 576*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 43L)); 577*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 44L)); 578*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 45L)); 579*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 46L)); 580*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 47L)); 581*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 48L)); 582*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 49L)); 583*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 50L)); 584*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 51L)); 585*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 52L)); 586*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 53L)); 587*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 54L)); 588*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 55L)); 589*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 56L)); 590*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 57L)); 591*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 58L)); 592*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 59L)); 593*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 60L)); 594*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 61L)); 595*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 62L)); 596*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.bitCount(1L << 63L)); 597*795d594fSAndroid Build Coastguard Worker } 598*795d594fSAndroid Build Coastguard Worker 599*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongFirst32_powerOfTwoMinusOne() constant_folding (before) 600*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongBitCount 601*795d594fSAndroid Build Coastguard Worker 602*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongFirst32_powerOfTwoMinusOne() constant_folding (after) 603*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongBitCount $noinline$testBitCountLongFirst32_powerOfTwoMinusOne()604*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountLongFirst32_powerOfTwoMinusOne() { 605*795d594fSAndroid Build Coastguard Worker // We start on `(1L << 2) - 1` (i.e. `3L`) as the other values are already being tested. 606*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(2L, Long.bitCount((1L << 2) - 1L)); 607*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(3L, Long.bitCount((1L << 3) - 1L)); 608*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(4L, Long.bitCount((1L << 4) - 1L)); 609*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(5L, Long.bitCount((1L << 5) - 1L)); 610*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(6L, Long.bitCount((1L << 6) - 1L)); 611*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(7L, Long.bitCount((1L << 7) - 1L)); 612*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(8L, Long.bitCount((1L << 8) - 1L)); 613*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(9L, Long.bitCount((1L << 9) - 1L)); 614*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(10L, Long.bitCount((1L << 10) - 1L)); 615*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(11L, Long.bitCount((1L << 11) - 1L)); 616*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(12L, Long.bitCount((1L << 12) - 1L)); 617*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(13L, Long.bitCount((1L << 13) - 1L)); 618*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(14L, Long.bitCount((1L << 14) - 1L)); 619*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(15L, Long.bitCount((1L << 15) - 1L)); 620*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(16L, Long.bitCount((1L << 16) - 1L)); 621*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(17L, Long.bitCount((1L << 17) - 1L)); 622*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(18L, Long.bitCount((1L << 18) - 1L)); 623*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(19L, Long.bitCount((1L << 19) - 1L)); 624*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(20L, Long.bitCount((1L << 20) - 1L)); 625*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(21L, Long.bitCount((1L << 21) - 1L)); 626*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(22L, Long.bitCount((1L << 22) - 1L)); 627*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(23L, Long.bitCount((1L << 23) - 1L)); 628*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(24L, Long.bitCount((1L << 24) - 1L)); 629*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(25L, Long.bitCount((1L << 25) - 1L)); 630*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(26L, Long.bitCount((1L << 26) - 1L)); 631*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(27L, Long.bitCount((1L << 27) - 1L)); 632*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(28L, Long.bitCount((1L << 28) - 1L)); 633*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(29L, Long.bitCount((1L << 29) - 1L)); 634*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(30L, Long.bitCount((1L << 30) - 1L)); 635*795d594fSAndroid Build Coastguard Worker } 636*795d594fSAndroid Build Coastguard Worker 637*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongLast32_powerOfTwoMinusOne() constant_folding (before) 638*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongBitCount 639*795d594fSAndroid Build Coastguard Worker 640*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testBitCountLongLast32_powerOfTwoMinusOne() constant_folding (after) 641*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongBitCount $noinline$testBitCountLongLast32_powerOfTwoMinusOne()642*795d594fSAndroid Build Coastguard Worker private static void $noinline$testBitCountLongLast32_powerOfTwoMinusOne() { 643*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(31L, Long.bitCount((1L << 31) - 1L)); 644*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(32L, Long.bitCount((1L << 32) - 1L)); 645*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(33L, Long.bitCount((1L << 33) - 1L)); 646*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(34L, Long.bitCount((1L << 34) - 1L)); 647*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(35L, Long.bitCount((1L << 35) - 1L)); 648*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(36L, Long.bitCount((1L << 36) - 1L)); 649*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(37L, Long.bitCount((1L << 37) - 1L)); 650*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(38L, Long.bitCount((1L << 38) - 1L)); 651*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(39L, Long.bitCount((1L << 39) - 1L)); 652*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(40L, Long.bitCount((1L << 40) - 1L)); 653*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(41L, Long.bitCount((1L << 41) - 1L)); 654*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(42L, Long.bitCount((1L << 42) - 1L)); 655*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(43L, Long.bitCount((1L << 43) - 1L)); 656*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(44L, Long.bitCount((1L << 44) - 1L)); 657*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(45L, Long.bitCount((1L << 45) - 1L)); 658*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(46L, Long.bitCount((1L << 46) - 1L)); 659*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(47L, Long.bitCount((1L << 47) - 1L)); 660*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(48L, Long.bitCount((1L << 48) - 1L)); 661*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(49L, Long.bitCount((1L << 49) - 1L)); 662*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(50L, Long.bitCount((1L << 50) - 1L)); 663*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(51L, Long.bitCount((1L << 51) - 1L)); 664*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(52L, Long.bitCount((1L << 52) - 1L)); 665*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(53L, Long.bitCount((1L << 53) - 1L)); 666*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(54L, Long.bitCount((1L << 54) - 1L)); 667*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(55L, Long.bitCount((1L << 55) - 1L)); 668*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(56L, Long.bitCount((1L << 56) - 1L)); 669*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(57L, Long.bitCount((1L << 57) - 1L)); 670*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(58L, Long.bitCount((1L << 58) - 1L)); 671*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(59L, Long.bitCount((1L << 59) - 1L)); 672*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(60L, Long.bitCount((1L << 60) - 1L)); 673*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(61L, Long.bitCount((1L << 61) - 1L)); 674*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(62L, Long.bitCount((1L << 62) - 1L)); 675*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(63L, Long.bitCount((1L << 63) - 1L)); 676*795d594fSAndroid Build Coastguard Worker } 677*795d594fSAndroid Build Coastguard Worker 678*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedInt() constant_folding (before) 679*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned 680*795d594fSAndroid Build Coastguard Worker 681*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedInt() constant_folding (after) 682*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned $noinline$testDivideUnsignedInt()683*795d594fSAndroid Build Coastguard Worker private static void $noinline$testDivideUnsignedInt() { 684*795d594fSAndroid Build Coastguard Worker // Positive/Positive division is as normal. 685*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Integer.divideUnsigned(10, 2)); 686*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(2, 10)); 687*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.divideUnsigned(42, 42)); 688*795d594fSAndroid Build Coastguard Worker 689*795d594fSAndroid Build Coastguard Worker // Positive/Negative is 0, as negative numbers are bigger (if taking a look as unsigned). 690*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(10, -2)); 691*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(2, -10)); 692*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(42, -42)); 693*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(Integer.MAX_VALUE, -1)); 694*795d594fSAndroid Build Coastguard Worker 695*795d594fSAndroid Build Coastguard Worker // Negative/Positive 696*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2147483643, Integer.divideUnsigned(-10, 2)); 697*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(429496729, Integer.divideUnsigned(-2, 10)); 698*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(102261125, Integer.divideUnsigned(-42, 42)); 699*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.divideUnsigned(Integer.MIN_VALUE, Integer.MAX_VALUE)); 700*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(-1, Integer.divideUnsigned(-1, 1)); 701*795d594fSAndroid Build Coastguard Worker 702*795d594fSAndroid Build Coastguard Worker // Negative/Negative 703*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(-2, -1)); 704*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.divideUnsigned(-1, -2)); 705*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(-10, -2)); 706*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.divideUnsigned(-2, -10)); 707*795d594fSAndroid Build Coastguard Worker 708*795d594fSAndroid Build Coastguard Worker // Special cases where we don't constant fold the intrinsic 709*795d594fSAndroid Build Coastguard Worker $noinline$testDivideUnsignedInt_divideByZero(); 710*795d594fSAndroid Build Coastguard Worker } 711*795d594fSAndroid Build Coastguard Worker 712*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedInt_divideByZero() constant_folding (before) 713*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned 714*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned 715*795d594fSAndroid Build Coastguard Worker 716*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedInt_divideByZero() constant_folding (after) 717*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned 718*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:IntegerDivideUnsigned $noinline$testDivideUnsignedInt_divideByZero()719*795d594fSAndroid Build Coastguard Worker private static void $noinline$testDivideUnsignedInt_divideByZero() { 720*795d594fSAndroid Build Coastguard Worker try { 721*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(1, 0)); 722*795d594fSAndroid Build Coastguard Worker throw new Error("Tried to divide 1 and 0 but didn't get an exception"); 723*795d594fSAndroid Build Coastguard Worker } catch (ArithmeticException expected) { 724*795d594fSAndroid Build Coastguard Worker } 725*795d594fSAndroid Build Coastguard Worker 726*795d594fSAndroid Build Coastguard Worker try { 727*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.divideUnsigned(-1, 0)); 728*795d594fSAndroid Build Coastguard Worker throw new Error("Tried to divide -1 and 0 but didn't get an exception"); 729*795d594fSAndroid Build Coastguard Worker } catch (ArithmeticException expected) { 730*795d594fSAndroid Build Coastguard Worker } 731*795d594fSAndroid Build Coastguard Worker } 732*795d594fSAndroid Build Coastguard Worker 733*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedLong() constant_folding (before) 734*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongDivideUnsigned 735*795d594fSAndroid Build Coastguard Worker 736*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedLong() constant_folding (after) 737*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongDivideUnsigned $noinline$testDivideUnsignedLong()738*795d594fSAndroid Build Coastguard Worker private static void $noinline$testDivideUnsignedLong() { 739*795d594fSAndroid Build Coastguard Worker // Positive/Positive division is as normal. 740*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(5L, Long.divideUnsigned(10L, 2L)); 741*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(2L, 10L)); 742*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.divideUnsigned(42L, 42L)); 743*795d594fSAndroid Build Coastguard Worker 744*795d594fSAndroid Build Coastguard Worker // Positive/Negative is 0, as negative numbers are bigger (if taking a look as unsigned). 745*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(10L, -2L)); 746*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(2L, -10L)); 747*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(42L, -42L)); 748*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(Long.MAX_VALUE, -1L)); 749*795d594fSAndroid Build Coastguard Worker 750*795d594fSAndroid Build Coastguard Worker // Negative/Positive 751*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(9223372036854775803L, Long.divideUnsigned(-10L, 2L)); 752*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1844674407370955161L, Long.divideUnsigned(-2L, 10L)); 753*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(439208192231179799L, Long.divideUnsigned(-42L, 42L)); 754*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.divideUnsigned(Long.MIN_VALUE, Long.MAX_VALUE)); 755*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(-1L, Long.divideUnsigned(-1L, 1L)); 756*795d594fSAndroid Build Coastguard Worker 757*795d594fSAndroid Build Coastguard Worker // Negative/Negative 758*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(-2L, -1L)); 759*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.divideUnsigned(-1L, -2L)); 760*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(-10L, -2L)); 761*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.divideUnsigned(-2L, -10L)); 762*795d594fSAndroid Build Coastguard Worker 763*795d594fSAndroid Build Coastguard Worker // Special cases where we don't constant fold the intrinsic 764*795d594fSAndroid Build Coastguard Worker $noinline$testDivideUnsignedLong_divideByZero(); 765*795d594fSAndroid Build Coastguard Worker } 766*795d594fSAndroid Build Coastguard Worker 767*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedLong_divideByZero() constant_folding (before) 768*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:LongDivideUnsigned 769*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:LongDivideUnsigned 770*795d594fSAndroid Build Coastguard Worker 771*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testDivideUnsignedLong_divideByZero() constant_folding (after) 772*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:LongDivideUnsigned 773*795d594fSAndroid Build Coastguard Worker /// CHECK: InvokeStaticOrDirect intrinsic:LongDivideUnsigned $noinline$testDivideUnsignedLong_divideByZero()774*795d594fSAndroid Build Coastguard Worker private static void $noinline$testDivideUnsignedLong_divideByZero() { 775*795d594fSAndroid Build Coastguard Worker try { 776*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(1L, 0L)); 777*795d594fSAndroid Build Coastguard Worker throw new Error("Tried to divide 1 and 0 but didn't get an exception"); 778*795d594fSAndroid Build Coastguard Worker } catch (ArithmeticException expected) { 779*795d594fSAndroid Build Coastguard Worker } 780*795d594fSAndroid Build Coastguard Worker 781*795d594fSAndroid Build Coastguard Worker try { 782*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.divideUnsigned(-1L, 0L)); 783*795d594fSAndroid Build Coastguard Worker throw new Error("Tried to divide -1 and 0 but didn't get an exception"); 784*795d594fSAndroid Build Coastguard Worker } catch (ArithmeticException expected) { 785*795d594fSAndroid Build Coastguard Worker } 786*795d594fSAndroid Build Coastguard Worker } 787*795d594fSAndroid Build Coastguard Worker 788*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt() constant_folding (before) 789*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit 790*795d594fSAndroid Build Coastguard Worker 791*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt() constant_folding (after) 792*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit $noinline$testHighestOneBitInt()793*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitInt() { 794*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 30, Integer.highestOneBit(Integer.MAX_VALUE)); 795*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.highestOneBit(Integer.MIN_VALUE)); 796*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitInt_powerOfTwo(); 797*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitInt_powerOfTwoMinusOne(); 798*795d594fSAndroid Build Coastguard Worker } 799*795d594fSAndroid Build Coastguard Worker 800*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt_powerOfTwo() constant_folding (before) 801*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit 802*795d594fSAndroid Build Coastguard Worker 803*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt_powerOfTwo() constant_folding (after) 804*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit $noinline$testHighestOneBitInt_powerOfTwo()805*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitInt_powerOfTwo() { 806*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.highestOneBit(0)); 807*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 0, Integer.highestOneBit(1 << 0)); 808*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 1, Integer.highestOneBit(1 << 1)); 809*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 2, Integer.highestOneBit(1 << 2)); 810*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 3, Integer.highestOneBit(1 << 3)); 811*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 4, Integer.highestOneBit(1 << 4)); 812*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 5, Integer.highestOneBit(1 << 5)); 813*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 6, Integer.highestOneBit(1 << 6)); 814*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 7, Integer.highestOneBit(1 << 7)); 815*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 8, Integer.highestOneBit(1 << 8)); 816*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 9, Integer.highestOneBit(1 << 9)); 817*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 10, Integer.highestOneBit(1 << 10)); 818*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 11, Integer.highestOneBit(1 << 11)); 819*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 12, Integer.highestOneBit(1 << 12)); 820*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 13, Integer.highestOneBit(1 << 13)); 821*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 14, Integer.highestOneBit(1 << 14)); 822*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 15, Integer.highestOneBit(1 << 15)); 823*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 16, Integer.highestOneBit(1 << 16)); 824*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 17, Integer.highestOneBit(1 << 17)); 825*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 18, Integer.highestOneBit(1 << 18)); 826*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 19, Integer.highestOneBit(1 << 19)); 827*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 20, Integer.highestOneBit(1 << 20)); 828*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 21, Integer.highestOneBit(1 << 21)); 829*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 22, Integer.highestOneBit(1 << 22)); 830*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 23, Integer.highestOneBit(1 << 23)); 831*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 24, Integer.highestOneBit(1 << 24)); 832*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 25, Integer.highestOneBit(1 << 25)); 833*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 26, Integer.highestOneBit(1 << 26)); 834*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 27, Integer.highestOneBit(1 << 27)); 835*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 28, Integer.highestOneBit(1 << 28)); 836*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 29, Integer.highestOneBit(1 << 29)); 837*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 30, Integer.highestOneBit(1 << 30)); 838*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.highestOneBit(1 << 31)); 839*795d594fSAndroid Build Coastguard Worker } 840*795d594fSAndroid Build Coastguard Worker 841*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt_powerOfTwoMinusOne() constant_folding (before) 842*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit 843*795d594fSAndroid Build Coastguard Worker 844*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitInt_powerOfTwoMinusOne() constant_folding (after) 845*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerHighestOneBit $noinline$testHighestOneBitInt_powerOfTwoMinusOne()846*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitInt_powerOfTwoMinusOne() { 847*795d594fSAndroid Build Coastguard Worker // We start on `(1 << 2) - 1` (i.e. `3`) as the other values are already being tested. 848*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (2 - 1), Integer.highestOneBit((1 << 2) - 1)); 849*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (3 - 1), Integer.highestOneBit((1 << 3) - 1)); 850*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (4 - 1), Integer.highestOneBit((1 << 4) - 1)); 851*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (5 - 1), Integer.highestOneBit((1 << 5) - 1)); 852*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (6 - 1), Integer.highestOneBit((1 << 6) - 1)); 853*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (7 - 1), Integer.highestOneBit((1 << 7) - 1)); 854*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (8 - 1), Integer.highestOneBit((1 << 8) - 1)); 855*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (9 - 1), Integer.highestOneBit((1 << 9) - 1)); 856*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (10 - 1), Integer.highestOneBit((1 << 10) - 1)); 857*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (11 - 1), Integer.highestOneBit((1 << 11) - 1)); 858*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (12 - 1), Integer.highestOneBit((1 << 12) - 1)); 859*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (13 - 1), Integer.highestOneBit((1 << 13) - 1)); 860*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (14 - 1), Integer.highestOneBit((1 << 14) - 1)); 861*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (15 - 1), Integer.highestOneBit((1 << 15) - 1)); 862*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (16 - 1), Integer.highestOneBit((1 << 16) - 1)); 863*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (17 - 1), Integer.highestOneBit((1 << 17) - 1)); 864*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (18 - 1), Integer.highestOneBit((1 << 18) - 1)); 865*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (19 - 1), Integer.highestOneBit((1 << 19) - 1)); 866*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (20 - 1), Integer.highestOneBit((1 << 20) - 1)); 867*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (21 - 1), Integer.highestOneBit((1 << 21) - 1)); 868*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (22 - 1), Integer.highestOneBit((1 << 22) - 1)); 869*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (23 - 1), Integer.highestOneBit((1 << 23) - 1)); 870*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (24 - 1), Integer.highestOneBit((1 << 24) - 1)); 871*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (25 - 1), Integer.highestOneBit((1 << 25) - 1)); 872*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (26 - 1), Integer.highestOneBit((1 << 26) - 1)); 873*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (27 - 1), Integer.highestOneBit((1 << 27) - 1)); 874*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (28 - 1), Integer.highestOneBit((1 << 28) - 1)); 875*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (29 - 1), Integer.highestOneBit((1 << 29) - 1)); 876*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (30 - 1), Integer.highestOneBit((1 << 30) - 1)); 877*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << (31 - 1), Integer.highestOneBit((1 << 31) - 1)); 878*795d594fSAndroid Build Coastguard Worker } 879*795d594fSAndroid Build Coastguard Worker 880*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLong() constant_folding (before) 881*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongHighestOneBit 882*795d594fSAndroid Build Coastguard Worker 883*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLong() constant_folding (after) 884*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongHighestOneBit $noinline$testHighestOneBitLong()885*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitLong() { 886*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 62, Long.highestOneBit(Long.MAX_VALUE)); 887*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63, Long.highestOneBit(Long.MIN_VALUE)); 888*795d594fSAndroid Build Coastguard Worker // We need to do two smaller methods because otherwise we don't compile it due to our 889*795d594fSAndroid Build Coastguard Worker // heuristics. 890*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitLongFirst32_powerOfTwo(); 891*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitLongLast32_powerOfTwo(); 892*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitLongFirst32_powerOfTwoMinusOne(); 893*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitLongLast32_powerOfTwoMinusOne(); 894*795d594fSAndroid Build Coastguard Worker } 895*795d594fSAndroid Build Coastguard Worker 896*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongFirst32_powerOfTwo() constant_folding (before) 897*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongHighestOneBit 898*795d594fSAndroid Build Coastguard Worker 899*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongFirst32_powerOfTwo() constant_folding (after) 900*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongHighestOneBit $noinline$testHighestOneBitLongFirst32_powerOfTwo()901*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitLongFirst32_powerOfTwo() { 902*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0, Long.highestOneBit(0L)); 903*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 0L, Long.highestOneBit(1L << 0L)); 904*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 1L, Long.highestOneBit(1L << 1L)); 905*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 2L, Long.highestOneBit(1L << 2L)); 906*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 3L, Long.highestOneBit(1L << 3L)); 907*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 4L, Long.highestOneBit(1L << 4L)); 908*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 5L, Long.highestOneBit(1L << 5L)); 909*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 6L, Long.highestOneBit(1L << 6L)); 910*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 7L, Long.highestOneBit(1L << 7L)); 911*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 8L, Long.highestOneBit(1L << 8L)); 912*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 9L, Long.highestOneBit(1L << 9L)); 913*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 10L, Long.highestOneBit(1L << 10L)); 914*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 11L, Long.highestOneBit(1L << 11L)); 915*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 12L, Long.highestOneBit(1L << 12L)); 916*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 13L, Long.highestOneBit(1L << 13L)); 917*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 14L, Long.highestOneBit(1L << 14L)); 918*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 15L, Long.highestOneBit(1L << 15L)); 919*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 16L, Long.highestOneBit(1L << 16L)); 920*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 17L, Long.highestOneBit(1L << 17L)); 921*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 18L, Long.highestOneBit(1L << 18L)); 922*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 19L, Long.highestOneBit(1L << 19L)); 923*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 20L, Long.highestOneBit(1L << 20L)); 924*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 21L, Long.highestOneBit(1L << 21L)); 925*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 22L, Long.highestOneBit(1L << 22L)); 926*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 23L, Long.highestOneBit(1L << 23L)); 927*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 24L, Long.highestOneBit(1L << 24L)); 928*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 25L, Long.highestOneBit(1L << 25L)); 929*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 26L, Long.highestOneBit(1L << 26L)); 930*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 27L, Long.highestOneBit(1L << 27L)); 931*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 28L, Long.highestOneBit(1L << 28L)); 932*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 29L, Long.highestOneBit(1L << 29L)); 933*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 30L, Long.highestOneBit(1L << 30L)); 934*795d594fSAndroid Build Coastguard Worker } 935*795d594fSAndroid Build Coastguard Worker 936*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongLast32_powerOfTwo() constant_folding (before) 937*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongHighestOneBit 938*795d594fSAndroid Build Coastguard Worker 939*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongLast32_powerOfTwo() constant_folding (after) 940*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongHighestOneBit $noinline$testHighestOneBitLongLast32_powerOfTwo()941*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitLongLast32_powerOfTwo() { 942*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 31L, Long.highestOneBit(1L << 31L)); 943*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 32L, Long.highestOneBit(1L << 32L)); 944*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 33L, Long.highestOneBit(1L << 33L)); 945*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 34L, Long.highestOneBit(1L << 34L)); 946*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 35L, Long.highestOneBit(1L << 35L)); 947*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 36L, Long.highestOneBit(1L << 36L)); 948*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 37L, Long.highestOneBit(1L << 37L)); 949*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 38L, Long.highestOneBit(1L << 38L)); 950*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 39L, Long.highestOneBit(1L << 39L)); 951*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 40L, Long.highestOneBit(1L << 40L)); 952*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 41L, Long.highestOneBit(1L << 41L)); 953*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 42L, Long.highestOneBit(1L << 42L)); 954*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 43L, Long.highestOneBit(1L << 43L)); 955*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 44L, Long.highestOneBit(1L << 44L)); 956*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 45L, Long.highestOneBit(1L << 45L)); 957*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 46L, Long.highestOneBit(1L << 46L)); 958*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 47L, Long.highestOneBit(1L << 47L)); 959*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 48L, Long.highestOneBit(1L << 48L)); 960*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 49L, Long.highestOneBit(1L << 49L)); 961*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 50L, Long.highestOneBit(1L << 50L)); 962*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 51L, Long.highestOneBit(1L << 51L)); 963*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 52L, Long.highestOneBit(1L << 52L)); 964*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 53L, Long.highestOneBit(1L << 53L)); 965*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 54L, Long.highestOneBit(1L << 54L)); 966*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 55L, Long.highestOneBit(1L << 55L)); 967*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 56L, Long.highestOneBit(1L << 56L)); 968*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 57L, Long.highestOneBit(1L << 57L)); 969*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 58L, Long.highestOneBit(1L << 58L)); 970*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 59L, Long.highestOneBit(1L << 59L)); 971*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 60L, Long.highestOneBit(1L << 60L)); 972*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 61L, Long.highestOneBit(1L << 61L)); 973*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 62L, Long.highestOneBit(1L << 62L)); 974*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63L, Long.highestOneBit(1L << 63L)); 975*795d594fSAndroid Build Coastguard Worker } 976*795d594fSAndroid Build Coastguard Worker 977*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongFirst32_powerOfTwoMinusOne() constant_folding (before) 978*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongHighestOneBit 979*795d594fSAndroid Build Coastguard Worker 980*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongFirst32_powerOfTwoMinusOne() constant_folding (after) 981*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongHighestOneBit $noinline$testHighestOneBitLongFirst32_powerOfTwoMinusOne()982*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitLongFirst32_powerOfTwoMinusOne() { 983*795d594fSAndroid Build Coastguard Worker // We start on `(1L << 2) - 1` (i.e. `3L`) as the other values are already being tested. 984*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (2 - 1), Long.highestOneBit((1L << 2) - 1L)); 985*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (3 - 1), Long.highestOneBit((1L << 3) - 1L)); 986*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (4 - 1), Long.highestOneBit((1L << 4) - 1L)); 987*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (5 - 1), Long.highestOneBit((1L << 5) - 1L)); 988*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (6 - 1), Long.highestOneBit((1L << 6) - 1L)); 989*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (7 - 1), Long.highestOneBit((1L << 7) - 1L)); 990*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (8 - 1), Long.highestOneBit((1L << 8) - 1L)); 991*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (9 - 1), Long.highestOneBit((1L << 9) - 1L)); 992*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (10 - 1), Long.highestOneBit((1L << 10) - 1L)); 993*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (11 - 1), Long.highestOneBit((1L << 11) - 1L)); 994*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (12 - 1), Long.highestOneBit((1L << 12) - 1L)); 995*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (13 - 1), Long.highestOneBit((1L << 13) - 1L)); 996*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (14 - 1), Long.highestOneBit((1L << 14) - 1L)); 997*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (15 - 1), Long.highestOneBit((1L << 15) - 1L)); 998*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (16 - 1), Long.highestOneBit((1L << 16) - 1L)); 999*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (17 - 1), Long.highestOneBit((1L << 17) - 1L)); 1000*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (18 - 1), Long.highestOneBit((1L << 18) - 1L)); 1001*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (19 - 1), Long.highestOneBit((1L << 19) - 1L)); 1002*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (20 - 1), Long.highestOneBit((1L << 20) - 1L)); 1003*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (21 - 1), Long.highestOneBit((1L << 21) - 1L)); 1004*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (22 - 1), Long.highestOneBit((1L << 22) - 1L)); 1005*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (23 - 1), Long.highestOneBit((1L << 23) - 1L)); 1006*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (24 - 1), Long.highestOneBit((1L << 24) - 1L)); 1007*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (25 - 1), Long.highestOneBit((1L << 25) - 1L)); 1008*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (26 - 1), Long.highestOneBit((1L << 26) - 1L)); 1009*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (27 - 1), Long.highestOneBit((1L << 27) - 1L)); 1010*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (28 - 1), Long.highestOneBit((1L << 28) - 1L)); 1011*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (29 - 1), Long.highestOneBit((1L << 29) - 1L)); 1012*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (30 - 1), Long.highestOneBit((1L << 30) - 1L)); 1013*795d594fSAndroid Build Coastguard Worker } 1014*795d594fSAndroid Build Coastguard Worker 1015*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongLast32_powerOfTwoMinusOne() constant_folding (before) 1016*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongHighestOneBit 1017*795d594fSAndroid Build Coastguard Worker 1018*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testHighestOneBitLongLast32_powerOfTwoMinusOne() constant_folding (after) 1019*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongHighestOneBit $noinline$testHighestOneBitLongLast32_powerOfTwoMinusOne()1020*795d594fSAndroid Build Coastguard Worker private static void $noinline$testHighestOneBitLongLast32_powerOfTwoMinusOne() { 1021*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (31 - 1), Long.highestOneBit((1L << 31) - 1L)); 1022*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (32 - 1), Long.highestOneBit((1L << 32) - 1L)); 1023*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (33 - 1), Long.highestOneBit((1L << 33) - 1L)); 1024*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (34 - 1), Long.highestOneBit((1L << 34) - 1L)); 1025*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (35 - 1), Long.highestOneBit((1L << 35) - 1L)); 1026*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (36 - 1), Long.highestOneBit((1L << 36) - 1L)); 1027*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (37 - 1), Long.highestOneBit((1L << 37) - 1L)); 1028*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (38 - 1), Long.highestOneBit((1L << 38) - 1L)); 1029*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (39 - 1), Long.highestOneBit((1L << 39) - 1L)); 1030*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (40 - 1), Long.highestOneBit((1L << 40) - 1L)); 1031*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (41 - 1), Long.highestOneBit((1L << 41) - 1L)); 1032*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (42 - 1), Long.highestOneBit((1L << 42) - 1L)); 1033*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (43 - 1), Long.highestOneBit((1L << 43) - 1L)); 1034*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (44 - 1), Long.highestOneBit((1L << 44) - 1L)); 1035*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (45 - 1), Long.highestOneBit((1L << 45) - 1L)); 1036*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (46 - 1), Long.highestOneBit((1L << 46) - 1L)); 1037*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (47 - 1), Long.highestOneBit((1L << 47) - 1L)); 1038*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (48 - 1), Long.highestOneBit((1L << 48) - 1L)); 1039*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (49 - 1), Long.highestOneBit((1L << 49) - 1L)); 1040*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (50 - 1), Long.highestOneBit((1L << 50) - 1L)); 1041*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (51 - 1), Long.highestOneBit((1L << 51) - 1L)); 1042*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (52 - 1), Long.highestOneBit((1L << 52) - 1L)); 1043*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (53 - 1), Long.highestOneBit((1L << 53) - 1L)); 1044*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (54 - 1), Long.highestOneBit((1L << 54) - 1L)); 1045*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (55 - 1), Long.highestOneBit((1L << 55) - 1L)); 1046*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (56 - 1), Long.highestOneBit((1L << 56) - 1L)); 1047*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (57 - 1), Long.highestOneBit((1L << 57) - 1L)); 1048*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (58 - 1), Long.highestOneBit((1L << 58) - 1L)); 1049*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (59 - 1), Long.highestOneBit((1L << 59) - 1L)); 1050*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (60 - 1), Long.highestOneBit((1L << 60) - 1L)); 1051*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (61 - 1), Long.highestOneBit((1L << 61) - 1L)); 1052*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (62 - 1), Long.highestOneBit((1L << 62) - 1L)); 1053*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << (63 - 1), Long.highestOneBit((1L << 63) - 1L)); 1054*795d594fSAndroid Build Coastguard Worker } 1055*795d594fSAndroid Build Coastguard Worker 1056*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt() constant_folding (before) 1057*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit 1058*795d594fSAndroid Build Coastguard Worker 1059*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt() constant_folding (after) 1060*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit $noinline$testLowestOneBitInt()1061*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitInt() { 1062*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit(Integer.MAX_VALUE)); 1063*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.lowestOneBit(Integer.MIN_VALUE)); 1064*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitInt_powerOfTwo(); 1065*795d594fSAndroid Build Coastguard Worker $noinline$testHighestOneBitInt_powerOfTwoMinusOne(); 1066*795d594fSAndroid Build Coastguard Worker } 1067*795d594fSAndroid Build Coastguard Worker 1068*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt_powerOfTwo() constant_folding (before) 1069*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit 1070*795d594fSAndroid Build Coastguard Worker 1071*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt_powerOfTwo() constant_folding (after) 1072*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit $noinline$testLowestOneBitInt_powerOfTwo()1073*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitInt_powerOfTwo() { 1074*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.lowestOneBit(0)); 1075*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 0, Integer.lowestOneBit(1 << 0)); 1076*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 1, Integer.lowestOneBit(1 << 1)); 1077*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 2, Integer.lowestOneBit(1 << 2)); 1078*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 3, Integer.lowestOneBit(1 << 3)); 1079*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 4, Integer.lowestOneBit(1 << 4)); 1080*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 5, Integer.lowestOneBit(1 << 5)); 1081*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 6, Integer.lowestOneBit(1 << 6)); 1082*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 7, Integer.lowestOneBit(1 << 7)); 1083*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 8, Integer.lowestOneBit(1 << 8)); 1084*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 9, Integer.lowestOneBit(1 << 9)); 1085*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 10, Integer.lowestOneBit(1 << 10)); 1086*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 11, Integer.lowestOneBit(1 << 11)); 1087*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 12, Integer.lowestOneBit(1 << 12)); 1088*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 13, Integer.lowestOneBit(1 << 13)); 1089*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 14, Integer.lowestOneBit(1 << 14)); 1090*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 15, Integer.lowestOneBit(1 << 15)); 1091*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 16, Integer.lowestOneBit(1 << 16)); 1092*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 17, Integer.lowestOneBit(1 << 17)); 1093*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 18, Integer.lowestOneBit(1 << 18)); 1094*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 19, Integer.lowestOneBit(1 << 19)); 1095*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 20, Integer.lowestOneBit(1 << 20)); 1096*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 21, Integer.lowestOneBit(1 << 21)); 1097*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 22, Integer.lowestOneBit(1 << 22)); 1098*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 23, Integer.lowestOneBit(1 << 23)); 1099*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 24, Integer.lowestOneBit(1 << 24)); 1100*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 25, Integer.lowestOneBit(1 << 25)); 1101*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 26, Integer.lowestOneBit(1 << 26)); 1102*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 27, Integer.lowestOneBit(1 << 27)); 1103*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 28, Integer.lowestOneBit(1 << 28)); 1104*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 29, Integer.lowestOneBit(1 << 29)); 1105*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 30, Integer.lowestOneBit(1 << 30)); 1106*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1 << 31, Integer.lowestOneBit(1 << 31)); 1107*795d594fSAndroid Build Coastguard Worker } 1108*795d594fSAndroid Build Coastguard Worker 1109*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt_powerOfTwoMinusOne() constant_folding (before) 1110*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit 1111*795d594fSAndroid Build Coastguard Worker 1112*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitInt_powerOfTwoMinusOne() constant_folding (after) 1113*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerLowestOneBit $noinline$testLowestOneBitInt_powerOfTwoMinusOne()1114*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitInt_powerOfTwoMinusOne() { 1115*795d594fSAndroid Build Coastguard Worker // We start on `(1 << 2) - 1` (i.e. `3`) as the other values are already being tested. 1116*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 2) - 1)); 1117*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 3) - 1)); 1118*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 4) - 1)); 1119*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 5) - 1)); 1120*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 6) - 1)); 1121*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 7) - 1)); 1122*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 8) - 1)); 1123*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 9) - 1)); 1124*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 10) - 1)); 1125*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 11) - 1)); 1126*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 12) - 1)); 1127*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 13) - 1)); 1128*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 14) - 1)); 1129*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 15) - 1)); 1130*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 16) - 1)); 1131*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 17) - 1)); 1132*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 18) - 1)); 1133*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 19) - 1)); 1134*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 20) - 1)); 1135*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 21) - 1)); 1136*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 22) - 1)); 1137*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 23) - 1)); 1138*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 24) - 1)); 1139*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 25) - 1)); 1140*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 26) - 1)); 1141*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 27) - 1)); 1142*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 28) - 1)); 1143*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 29) - 1)); 1144*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 30) - 1)); 1145*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.lowestOneBit((1 << 31) - 1)); 1146*795d594fSAndroid Build Coastguard Worker } 1147*795d594fSAndroid Build Coastguard Worker 1148*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLong() constant_folding (before) 1149*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongLowestOneBit 1150*795d594fSAndroid Build Coastguard Worker 1151*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLong() constant_folding (after) 1152*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongLowestOneBit $noinline$testLowestOneBitLong()1153*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitLong() { 1154*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit(Long.MAX_VALUE)); 1155*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63, Long.lowestOneBit(Long.MIN_VALUE)); 1156*795d594fSAndroid Build Coastguard Worker // We need to do two smaller methods because otherwise we don't compile it due to our 1157*795d594fSAndroid Build Coastguard Worker // heuristics. 1158*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitLongFirst32_powerOfTwo(); 1159*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitLongLast32_powerOfTwo(); 1160*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitLongFirst32_powerOfTwoMinusOne(); 1161*795d594fSAndroid Build Coastguard Worker $noinline$testLowestOneBitLongLast32_powerOfTwoMinusOne(); 1162*795d594fSAndroid Build Coastguard Worker } 1163*795d594fSAndroid Build Coastguard Worker 1164*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongFirst32_powerOfTwo() constant_folding (before) 1165*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongLowestOneBit 1166*795d594fSAndroid Build Coastguard Worker 1167*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongFirst32_powerOfTwo() constant_folding (after) 1168*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongLowestOneBit $noinline$testLowestOneBitLongFirst32_powerOfTwo()1169*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitLongFirst32_powerOfTwo() { 1170*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(0L, Long.lowestOneBit(0L)); 1171*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 0L, Long.lowestOneBit(1L << 0L)); 1172*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 1L, Long.lowestOneBit(1L << 1L)); 1173*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 2L, Long.lowestOneBit(1L << 2L)); 1174*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 3L, Long.lowestOneBit(1L << 3L)); 1175*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 4L, Long.lowestOneBit(1L << 4L)); 1176*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 5L, Long.lowestOneBit(1L << 5L)); 1177*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 6L, Long.lowestOneBit(1L << 6L)); 1178*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 7L, Long.lowestOneBit(1L << 7L)); 1179*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 8L, Long.lowestOneBit(1L << 8L)); 1180*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 9L, Long.lowestOneBit(1L << 9L)); 1181*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 10L, Long.lowestOneBit(1L << 10L)); 1182*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 11L, Long.lowestOneBit(1L << 11L)); 1183*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 12L, Long.lowestOneBit(1L << 12L)); 1184*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 13L, Long.lowestOneBit(1L << 13L)); 1185*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 14L, Long.lowestOneBit(1L << 14L)); 1186*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 15L, Long.lowestOneBit(1L << 15L)); 1187*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 16L, Long.lowestOneBit(1L << 16L)); 1188*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 17L, Long.lowestOneBit(1L << 17L)); 1189*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 18L, Long.lowestOneBit(1L << 18L)); 1190*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 19L, Long.lowestOneBit(1L << 19L)); 1191*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 20L, Long.lowestOneBit(1L << 20L)); 1192*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 21L, Long.lowestOneBit(1L << 21L)); 1193*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 22L, Long.lowestOneBit(1L << 22L)); 1194*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 23L, Long.lowestOneBit(1L << 23L)); 1195*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 24L, Long.lowestOneBit(1L << 24L)); 1196*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 25L, Long.lowestOneBit(1L << 25L)); 1197*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 26L, Long.lowestOneBit(1L << 26L)); 1198*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 27L, Long.lowestOneBit(1L << 27L)); 1199*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 28L, Long.lowestOneBit(1L << 28L)); 1200*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 29L, Long.lowestOneBit(1L << 29L)); 1201*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 30L, Long.lowestOneBit(1L << 30L)); 1202*795d594fSAndroid Build Coastguard Worker } 1203*795d594fSAndroid Build Coastguard Worker 1204*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongLast32_powerOfTwo() constant_folding (before) 1205*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongLowestOneBit 1206*795d594fSAndroid Build Coastguard Worker 1207*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongLast32_powerOfTwo() constant_folding (after) 1208*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongLowestOneBit $noinline$testLowestOneBitLongLast32_powerOfTwo()1209*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitLongLast32_powerOfTwo() { 1210*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 31L, Long.lowestOneBit(1L << 31L)); 1211*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 32L, Long.lowestOneBit(1L << 32L)); 1212*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 33L, Long.lowestOneBit(1L << 33L)); 1213*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 34L, Long.lowestOneBit(1L << 34L)); 1214*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 35L, Long.lowestOneBit(1L << 35L)); 1215*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 36L, Long.lowestOneBit(1L << 36L)); 1216*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 37L, Long.lowestOneBit(1L << 37L)); 1217*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 38L, Long.lowestOneBit(1L << 38L)); 1218*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 39L, Long.lowestOneBit(1L << 39L)); 1219*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 40L, Long.lowestOneBit(1L << 40L)); 1220*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 41L, Long.lowestOneBit(1L << 41L)); 1221*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 42L, Long.lowestOneBit(1L << 42L)); 1222*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 43L, Long.lowestOneBit(1L << 43L)); 1223*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 44L, Long.lowestOneBit(1L << 44L)); 1224*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 45L, Long.lowestOneBit(1L << 45L)); 1225*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 46L, Long.lowestOneBit(1L << 46L)); 1226*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 47L, Long.lowestOneBit(1L << 47L)); 1227*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 48L, Long.lowestOneBit(1L << 48L)); 1228*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 49L, Long.lowestOneBit(1L << 49L)); 1229*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 50L, Long.lowestOneBit(1L << 50L)); 1230*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 51L, Long.lowestOneBit(1L << 51L)); 1231*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 52L, Long.lowestOneBit(1L << 52L)); 1232*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 53L, Long.lowestOneBit(1L << 53L)); 1233*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 54L, Long.lowestOneBit(1L << 54L)); 1234*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 55L, Long.lowestOneBit(1L << 55L)); 1235*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 56L, Long.lowestOneBit(1L << 56L)); 1236*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 57L, Long.lowestOneBit(1L << 57L)); 1237*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 58L, Long.lowestOneBit(1L << 58L)); 1238*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 59L, Long.lowestOneBit(1L << 59L)); 1239*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 60L, Long.lowestOneBit(1L << 60L)); 1240*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 61L, Long.lowestOneBit(1L << 61L)); 1241*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 62L, Long.lowestOneBit(1L << 62L)); 1242*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L << 63L, Long.lowestOneBit(1L << 63L)); 1243*795d594fSAndroid Build Coastguard Worker } 1244*795d594fSAndroid Build Coastguard Worker 1245*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongFirst32_powerOfTwoMinusOne() constant_folding (before) 1246*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongLowestOneBit 1247*795d594fSAndroid Build Coastguard Worker 1248*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongFirst32_powerOfTwoMinusOne() constant_folding (after) 1249*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongLowestOneBit $noinline$testLowestOneBitLongFirst32_powerOfTwoMinusOne()1250*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitLongFirst32_powerOfTwoMinusOne() { 1251*795d594fSAndroid Build Coastguard Worker // We start on `(1L << 2) - 1` (i.e. `3L`) as the other values are already being tested. 1252*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 2) - 1L)); 1253*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 3) - 1L)); 1254*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 4) - 1L)); 1255*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 5) - 1L)); 1256*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 6) - 1L)); 1257*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 7) - 1L)); 1258*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 8) - 1L)); 1259*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 9) - 1L)); 1260*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 10) - 1L)); 1261*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 11) - 1L)); 1262*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 12) - 1L)); 1263*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 13) - 1L)); 1264*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 14) - 1L)); 1265*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 15) - 1L)); 1266*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 16) - 1L)); 1267*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 17) - 1L)); 1268*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 18) - 1L)); 1269*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 19) - 1L)); 1270*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 20) - 1L)); 1271*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 21) - 1L)); 1272*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 22) - 1L)); 1273*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 23) - 1L)); 1274*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 24) - 1L)); 1275*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 25) - 1L)); 1276*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 26) - 1L)); 1277*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 27) - 1L)); 1278*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 28) - 1L)); 1279*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 29) - 1L)); 1280*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 30) - 1L)); 1281*795d594fSAndroid Build Coastguard Worker } 1282*795d594fSAndroid Build Coastguard Worker 1283*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongLast32_powerOfTwoMinusOne() constant_folding (before) 1284*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongLowestOneBit 1285*795d594fSAndroid Build Coastguard Worker 1286*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLowestOneBitLongLast32_powerOfTwoMinusOne() constant_folding (after) 1287*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongLowestOneBit $noinline$testLowestOneBitLongLast32_powerOfTwoMinusOne()1288*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLowestOneBitLongLast32_powerOfTwoMinusOne() { 1289*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 31) - 1L)); 1290*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 32) - 1L)); 1291*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 33) - 1L)); 1292*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 34) - 1L)); 1293*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 35) - 1L)); 1294*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 36) - 1L)); 1295*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 37) - 1L)); 1296*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 38) - 1L)); 1297*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 39) - 1L)); 1298*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 40) - 1L)); 1299*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 41) - 1L)); 1300*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 42) - 1L)); 1301*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 43) - 1L)); 1302*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 44) - 1L)); 1303*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 45) - 1L)); 1304*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 46) - 1L)); 1305*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 47) - 1L)); 1306*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 48) - 1L)); 1307*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 49) - 1L)); 1308*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 50) - 1L)); 1309*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 51) - 1L)); 1310*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 52) - 1L)); 1311*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 53) - 1L)); 1312*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 54) - 1L)); 1313*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 55) - 1L)); 1314*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 56) - 1L)); 1315*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 57) - 1L)); 1316*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 58) - 1L)); 1317*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 59) - 1L)); 1318*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 60) - 1L)); 1319*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 61) - 1L)); 1320*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 62) - 1L)); 1321*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(1L, Long.lowestOneBit((1L << 63) - 1L)); 1322*795d594fSAndroid Build Coastguard Worker } 1323*795d594fSAndroid Build Coastguard Worker 1324*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosInt() constant_folding (before) 1325*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerNumberOfLeadingZeros 1326*795d594fSAndroid Build Coastguard Worker 1327*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosInt() constant_folding (after) 1328*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerNumberOfLeadingZeros $noinline$testLeadingZerosInt()1329*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLeadingZerosInt() { 1330*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.numberOfLeadingZeros(Integer.MAX_VALUE)); 1331*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.numberOfLeadingZeros(Integer.MIN_VALUE)); 1332*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(32, Integer.numberOfLeadingZeros(0)); 1333*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Integer.numberOfLeadingZeros(1 << 0)); 1334*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(30, Integer.numberOfLeadingZeros(1 << 1)); 1335*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(29, Integer.numberOfLeadingZeros(1 << 2)); 1336*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(28, Integer.numberOfLeadingZeros(1 << 3)); 1337*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(27, Integer.numberOfLeadingZeros(1 << 4)); 1338*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(26, Integer.numberOfLeadingZeros(1 << 5)); 1339*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(25, Integer.numberOfLeadingZeros(1 << 6)); 1340*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(24, Integer.numberOfLeadingZeros(1 << 7)); 1341*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(23, Integer.numberOfLeadingZeros(1 << 8)); 1342*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(22, Integer.numberOfLeadingZeros(1 << 9)); 1343*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(21, Integer.numberOfLeadingZeros(1 << 10)); 1344*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(20, Integer.numberOfLeadingZeros(1 << 11)); 1345*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(19, Integer.numberOfLeadingZeros(1 << 12)); 1346*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(18, Integer.numberOfLeadingZeros(1 << 13)); 1347*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(17, Integer.numberOfLeadingZeros(1 << 14)); 1348*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Integer.numberOfLeadingZeros(1 << 15)); 1349*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(15, Integer.numberOfLeadingZeros(1 << 16)); 1350*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(14, Integer.numberOfLeadingZeros(1 << 17)); 1351*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(13, Integer.numberOfLeadingZeros(1 << 18)); 1352*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(12, Integer.numberOfLeadingZeros(1 << 19)); 1353*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(11, Integer.numberOfLeadingZeros(1 << 20)); 1354*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(10, Integer.numberOfLeadingZeros(1 << 21)); 1355*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(9, Integer.numberOfLeadingZeros(1 << 22)); 1356*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(8, Integer.numberOfLeadingZeros(1 << 23)); 1357*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(7, Integer.numberOfLeadingZeros(1 << 24)); 1358*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(6, Integer.numberOfLeadingZeros(1 << 25)); 1359*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Integer.numberOfLeadingZeros(1 << 26)); 1360*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(4, Integer.numberOfLeadingZeros(1 << 27)); 1361*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(3, Integer.numberOfLeadingZeros(1 << 28)); 1362*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2, Integer.numberOfLeadingZeros(1 << 29)); 1363*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.numberOfLeadingZeros(1 << 30)); 1364*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.numberOfLeadingZeros(1 << 31)); 1365*795d594fSAndroid Build Coastguard Worker } 1366*795d594fSAndroid Build Coastguard Worker 1367*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLong() constant_folding (before) 1368*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros 1369*795d594fSAndroid Build Coastguard Worker 1370*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLong() constant_folding (after) 1371*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros $noinline$testLeadingZerosLong()1372*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLeadingZerosLong() { 1373*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Long.numberOfLeadingZeros(Long.MAX_VALUE)); 1374*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Long.numberOfLeadingZeros(Long.MIN_VALUE)); 1375*795d594fSAndroid Build Coastguard Worker // We need to do two smaller methods because otherwise we don't compile it due to our 1376*795d594fSAndroid Build Coastguard Worker // heuristics. 1377*795d594fSAndroid Build Coastguard Worker $noinline$testLeadingZerosLongFirst32(); 1378*795d594fSAndroid Build Coastguard Worker $noinline$testLeadingZerosLongLast32(); 1379*795d594fSAndroid Build Coastguard Worker } 1380*795d594fSAndroid Build Coastguard Worker 1381*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLongFirst32() constant_folding (before) 1382*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros 1383*795d594fSAndroid Build Coastguard Worker 1384*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLongFirst32() constant_folding (after) 1385*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros $noinline$testLeadingZerosLongFirst32()1386*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLeadingZerosLongFirst32() { 1387*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(64, Long.numberOfLeadingZeros(0L)); 1388*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(63, Long.numberOfLeadingZeros(1L << 0L)); 1389*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(62, Long.numberOfLeadingZeros(1L << 1L)); 1390*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(61, Long.numberOfLeadingZeros(1L << 2L)); 1391*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(60, Long.numberOfLeadingZeros(1L << 3L)); 1392*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(59, Long.numberOfLeadingZeros(1L << 4L)); 1393*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(58, Long.numberOfLeadingZeros(1L << 5L)); 1394*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(57, Long.numberOfLeadingZeros(1L << 6L)); 1395*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(56, Long.numberOfLeadingZeros(1L << 7L)); 1396*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(55, Long.numberOfLeadingZeros(1L << 8L)); 1397*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(54, Long.numberOfLeadingZeros(1L << 9L)); 1398*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(53, Long.numberOfLeadingZeros(1L << 10L)); 1399*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(52, Long.numberOfLeadingZeros(1L << 11L)); 1400*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(51, Long.numberOfLeadingZeros(1L << 12L)); 1401*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(50, Long.numberOfLeadingZeros(1L << 13L)); 1402*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(49, Long.numberOfLeadingZeros(1L << 14L)); 1403*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(48, Long.numberOfLeadingZeros(1L << 15L)); 1404*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(47, Long.numberOfLeadingZeros(1L << 16L)); 1405*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(46, Long.numberOfLeadingZeros(1L << 17L)); 1406*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(45, Long.numberOfLeadingZeros(1L << 18L)); 1407*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(44, Long.numberOfLeadingZeros(1L << 19L)); 1408*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(43, Long.numberOfLeadingZeros(1L << 20L)); 1409*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(42, Long.numberOfLeadingZeros(1L << 21L)); 1410*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(41, Long.numberOfLeadingZeros(1L << 22L)); 1411*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(40, Long.numberOfLeadingZeros(1L << 23L)); 1412*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(39, Long.numberOfLeadingZeros(1L << 24L)); 1413*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(38, Long.numberOfLeadingZeros(1L << 25L)); 1414*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(37, Long.numberOfLeadingZeros(1L << 26L)); 1415*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(36, Long.numberOfLeadingZeros(1L << 27L)); 1416*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(35, Long.numberOfLeadingZeros(1L << 28L)); 1417*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(34, Long.numberOfLeadingZeros(1L << 29L)); 1418*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(33, Long.numberOfLeadingZeros(1L << 30L)); 1419*795d594fSAndroid Build Coastguard Worker } 1420*795d594fSAndroid Build Coastguard Worker 1421*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLongLast32() constant_folding (before) 1422*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros 1423*795d594fSAndroid Build Coastguard Worker 1424*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testLeadingZerosLongLast32() constant_folding (after) 1425*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfLeadingZeros $noinline$testLeadingZerosLongLast32()1426*795d594fSAndroid Build Coastguard Worker private static void $noinline$testLeadingZerosLongLast32() { 1427*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(32, Long.numberOfLeadingZeros(1L << 31L)); 1428*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Long.numberOfLeadingZeros(1L << 32L)); 1429*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(30, Long.numberOfLeadingZeros(1L << 33L)); 1430*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(29, Long.numberOfLeadingZeros(1L << 34L)); 1431*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(28, Long.numberOfLeadingZeros(1L << 35L)); 1432*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(27, Long.numberOfLeadingZeros(1L << 36L)); 1433*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(26, Long.numberOfLeadingZeros(1L << 37L)); 1434*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(25, Long.numberOfLeadingZeros(1L << 38L)); 1435*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(24, Long.numberOfLeadingZeros(1L << 39L)); 1436*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(23, Long.numberOfLeadingZeros(1L << 40L)); 1437*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(22, Long.numberOfLeadingZeros(1L << 41L)); 1438*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(21, Long.numberOfLeadingZeros(1L << 42L)); 1439*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(20, Long.numberOfLeadingZeros(1L << 43L)); 1440*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(19, Long.numberOfLeadingZeros(1L << 44L)); 1441*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(18, Long.numberOfLeadingZeros(1L << 45L)); 1442*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(17, Long.numberOfLeadingZeros(1L << 46L)); 1443*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Long.numberOfLeadingZeros(1L << 47L)); 1444*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(15, Long.numberOfLeadingZeros(1L << 48L)); 1445*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(14, Long.numberOfLeadingZeros(1L << 49L)); 1446*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(13, Long.numberOfLeadingZeros(1L << 50L)); 1447*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(12, Long.numberOfLeadingZeros(1L << 51L)); 1448*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(11, Long.numberOfLeadingZeros(1L << 52L)); 1449*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(10, Long.numberOfLeadingZeros(1L << 53L)); 1450*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(9, Long.numberOfLeadingZeros(1L << 54L)); 1451*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(8, Long.numberOfLeadingZeros(1L << 55L)); 1452*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(7, Long.numberOfLeadingZeros(1L << 56L)); 1453*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(6, Long.numberOfLeadingZeros(1L << 57L)); 1454*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Long.numberOfLeadingZeros(1L << 58L)); 1455*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(4, Long.numberOfLeadingZeros(1L << 59L)); 1456*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(3, Long.numberOfLeadingZeros(1L << 60L)); 1457*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2, Long.numberOfLeadingZeros(1L << 61L)); 1458*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Long.numberOfLeadingZeros(1L << 62L)); 1459*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Long.numberOfLeadingZeros(1L << 63L)); 1460*795d594fSAndroid Build Coastguard Worker } 1461*795d594fSAndroid Build Coastguard Worker 1462*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosInt() constant_folding (before) 1463*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:IntegerNumberOfTrailingZeros 1464*795d594fSAndroid Build Coastguard Worker 1465*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosInt() constant_folding (after) 1466*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:IntegerNumberOfTrailingZeros $noinline$testTrailingZerosInt()1467*795d594fSAndroid Build Coastguard Worker private static void $noinline$testTrailingZerosInt() { 1468*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.numberOfTrailingZeros(Integer.MAX_VALUE)); 1469*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Integer.numberOfTrailingZeros(Integer.MIN_VALUE)); 1470*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(32, Integer.numberOfTrailingZeros(0)); 1471*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Integer.numberOfTrailingZeros(1 << 0)); 1472*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Integer.numberOfTrailingZeros(1 << 1)); 1473*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2, Integer.numberOfTrailingZeros(1 << 2)); 1474*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(3, Integer.numberOfTrailingZeros(1 << 3)); 1475*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(4, Integer.numberOfTrailingZeros(1 << 4)); 1476*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Integer.numberOfTrailingZeros(1 << 5)); 1477*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(6, Integer.numberOfTrailingZeros(1 << 6)); 1478*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(7, Integer.numberOfTrailingZeros(1 << 7)); 1479*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(8, Integer.numberOfTrailingZeros(1 << 8)); 1480*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(9, Integer.numberOfTrailingZeros(1 << 9)); 1481*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(10, Integer.numberOfTrailingZeros(1 << 10)); 1482*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(11, Integer.numberOfTrailingZeros(1 << 11)); 1483*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(12, Integer.numberOfTrailingZeros(1 << 12)); 1484*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(13, Integer.numberOfTrailingZeros(1 << 13)); 1485*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(14, Integer.numberOfTrailingZeros(1 << 14)); 1486*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(15, Integer.numberOfTrailingZeros(1 << 15)); 1487*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Integer.numberOfTrailingZeros(1 << 16)); 1488*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(17, Integer.numberOfTrailingZeros(1 << 17)); 1489*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(18, Integer.numberOfTrailingZeros(1 << 18)); 1490*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(19, Integer.numberOfTrailingZeros(1 << 19)); 1491*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(20, Integer.numberOfTrailingZeros(1 << 20)); 1492*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(21, Integer.numberOfTrailingZeros(1 << 21)); 1493*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(22, Integer.numberOfTrailingZeros(1 << 22)); 1494*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(23, Integer.numberOfTrailingZeros(1 << 23)); 1495*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(24, Integer.numberOfTrailingZeros(1 << 24)); 1496*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(25, Integer.numberOfTrailingZeros(1 << 25)); 1497*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(26, Integer.numberOfTrailingZeros(1 << 26)); 1498*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(27, Integer.numberOfTrailingZeros(1 << 27)); 1499*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(28, Integer.numberOfTrailingZeros(1 << 28)); 1500*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(29, Integer.numberOfTrailingZeros(1 << 29)); 1501*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(30, Integer.numberOfTrailingZeros(1 << 30)); 1502*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Integer.numberOfTrailingZeros(1 << 31)); 1503*795d594fSAndroid Build Coastguard Worker } 1504*795d594fSAndroid Build Coastguard Worker 1505*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLong() constant_folding (before) 1506*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros 1507*795d594fSAndroid Build Coastguard Worker 1508*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLong() constant_folding (after) 1509*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros $noinline$testTrailingZerosLong()1510*795d594fSAndroid Build Coastguard Worker private static void $noinline$testTrailingZerosLong() { 1511*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Long.numberOfTrailingZeros(Long.MAX_VALUE)); 1512*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(63, Long.numberOfTrailingZeros(Long.MIN_VALUE)); 1513*795d594fSAndroid Build Coastguard Worker // We need to do two smaller methods because otherwise we don't compile it due to our 1514*795d594fSAndroid Build Coastguard Worker // heuristics. 1515*795d594fSAndroid Build Coastguard Worker $noinline$testTrailingZerosLongFirst32(); 1516*795d594fSAndroid Build Coastguard Worker $noinline$testTrailingZerosLongLast32(); 1517*795d594fSAndroid Build Coastguard Worker } 1518*795d594fSAndroid Build Coastguard Worker 1519*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLongFirst32() constant_folding (before) 1520*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros 1521*795d594fSAndroid Build Coastguard Worker 1522*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLongFirst32() constant_folding (after) 1523*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros $noinline$testTrailingZerosLongFirst32()1524*795d594fSAndroid Build Coastguard Worker private static void $noinline$testTrailingZerosLongFirst32() { 1525*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(64, Long.numberOfTrailingZeros(0L)); 1526*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(0, Long.numberOfTrailingZeros(1L << 0L)); 1527*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(1, Long.numberOfTrailingZeros(1L << 1L)); 1528*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(2, Long.numberOfTrailingZeros(1L << 2L)); 1529*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(3, Long.numberOfTrailingZeros(1L << 3L)); 1530*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(4, Long.numberOfTrailingZeros(1L << 4L)); 1531*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(5, Long.numberOfTrailingZeros(1L << 5L)); 1532*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(6, Long.numberOfTrailingZeros(1L << 6L)); 1533*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(7, Long.numberOfTrailingZeros(1L << 7L)); 1534*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(8, Long.numberOfTrailingZeros(1L << 8L)); 1535*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(9, Long.numberOfTrailingZeros(1L << 9L)); 1536*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(10, Long.numberOfTrailingZeros(1L << 10L)); 1537*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(11, Long.numberOfTrailingZeros(1L << 11L)); 1538*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(12, Long.numberOfTrailingZeros(1L << 12L)); 1539*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(13, Long.numberOfTrailingZeros(1L << 13L)); 1540*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(14, Long.numberOfTrailingZeros(1L << 14L)); 1541*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(15, Long.numberOfTrailingZeros(1L << 15L)); 1542*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(16, Long.numberOfTrailingZeros(1L << 16L)); 1543*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(17, Long.numberOfTrailingZeros(1L << 17L)); 1544*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(18, Long.numberOfTrailingZeros(1L << 18L)); 1545*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(19, Long.numberOfTrailingZeros(1L << 19L)); 1546*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(20, Long.numberOfTrailingZeros(1L << 20L)); 1547*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(21, Long.numberOfTrailingZeros(1L << 21L)); 1548*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(22, Long.numberOfTrailingZeros(1L << 22L)); 1549*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(23, Long.numberOfTrailingZeros(1L << 23L)); 1550*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(24, Long.numberOfTrailingZeros(1L << 24L)); 1551*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(25, Long.numberOfTrailingZeros(1L << 25L)); 1552*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(26, Long.numberOfTrailingZeros(1L << 26L)); 1553*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(27, Long.numberOfTrailingZeros(1L << 27L)); 1554*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(28, Long.numberOfTrailingZeros(1L << 28L)); 1555*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(29, Long.numberOfTrailingZeros(1L << 29L)); 1556*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(30, Long.numberOfTrailingZeros(1L << 30L)); 1557*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(31, Long.numberOfTrailingZeros(1L << 31L)); 1558*795d594fSAndroid Build Coastguard Worker } 1559*795d594fSAndroid Build Coastguard Worker 1560*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLongLast32() constant_folding (before) 1561*795d594fSAndroid Build Coastguard Worker /// CHECK-DAG: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros 1562*795d594fSAndroid Build Coastguard Worker 1563*795d594fSAndroid Build Coastguard Worker /// CHECK-START: void Main.$noinline$testTrailingZerosLongLast32() constant_folding (after) 1564*795d594fSAndroid Build Coastguard Worker /// CHECK-NOT: InvokeStaticOrDirect intrinsic:LongNumberOfTrailingZeros $noinline$testTrailingZerosLongLast32()1565*795d594fSAndroid Build Coastguard Worker private static void $noinline$testTrailingZerosLongLast32() { 1566*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(32, Long.numberOfTrailingZeros(1L << 32L)); 1567*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(33, Long.numberOfTrailingZeros(1L << 33L)); 1568*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(34, Long.numberOfTrailingZeros(1L << 34L)); 1569*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(35, Long.numberOfTrailingZeros(1L << 35L)); 1570*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(36, Long.numberOfTrailingZeros(1L << 36L)); 1571*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(37, Long.numberOfTrailingZeros(1L << 37L)); 1572*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(38, Long.numberOfTrailingZeros(1L << 38L)); 1573*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(39, Long.numberOfTrailingZeros(1L << 39L)); 1574*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(40, Long.numberOfTrailingZeros(1L << 40L)); 1575*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(41, Long.numberOfTrailingZeros(1L << 41L)); 1576*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(42, Long.numberOfTrailingZeros(1L << 42L)); 1577*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(43, Long.numberOfTrailingZeros(1L << 43L)); 1578*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(44, Long.numberOfTrailingZeros(1L << 44L)); 1579*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(45, Long.numberOfTrailingZeros(1L << 45L)); 1580*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(46, Long.numberOfTrailingZeros(1L << 46L)); 1581*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(47, Long.numberOfTrailingZeros(1L << 47L)); 1582*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(48, Long.numberOfTrailingZeros(1L << 48L)); 1583*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(49, Long.numberOfTrailingZeros(1L << 49L)); 1584*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(50, Long.numberOfTrailingZeros(1L << 50L)); 1585*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(51, Long.numberOfTrailingZeros(1L << 51L)); 1586*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(52, Long.numberOfTrailingZeros(1L << 52L)); 1587*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(53, Long.numberOfTrailingZeros(1L << 53L)); 1588*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(54, Long.numberOfTrailingZeros(1L << 54L)); 1589*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(55, Long.numberOfTrailingZeros(1L << 55L)); 1590*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(56, Long.numberOfTrailingZeros(1L << 56L)); 1591*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(57, Long.numberOfTrailingZeros(1L << 57L)); 1592*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(58, Long.numberOfTrailingZeros(1L << 58L)); 1593*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(59, Long.numberOfTrailingZeros(1L << 59L)); 1594*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(60, Long.numberOfTrailingZeros(1L << 60L)); 1595*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(61, Long.numberOfTrailingZeros(1L << 61L)); 1596*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(62, Long.numberOfTrailingZeros(1L << 62L)); 1597*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(63, Long.numberOfTrailingZeros(1L << 63L)); 1598*795d594fSAndroid Build Coastguard Worker } 1599*795d594fSAndroid Build Coastguard Worker $noinline$assertIntEquals(int expected, int result)1600*795d594fSAndroid Build Coastguard Worker public static void $noinline$assertIntEquals(int expected, int result) { 1601*795d594fSAndroid Build Coastguard Worker if (expected != result) { 1602*795d594fSAndroid Build Coastguard Worker throw new Error("Expected: " + expected + ", found: " + result); 1603*795d594fSAndroid Build Coastguard Worker } 1604*795d594fSAndroid Build Coastguard Worker } 1605*795d594fSAndroid Build Coastguard Worker $noinline$assertLongEquals(long expected, long result)1606*795d594fSAndroid Build Coastguard Worker public static void $noinline$assertLongEquals(long expected, long result) { 1607*795d594fSAndroid Build Coastguard Worker if (expected != result) { 1608*795d594fSAndroid Build Coastguard Worker throw new Error("Expected: " + expected + ", found: " + result); 1609*795d594fSAndroid Build Coastguard Worker } 1610*795d594fSAndroid Build Coastguard Worker } 1611*795d594fSAndroid Build Coastguard Worker $noinline$assertShortEquals(short expected, short result)1612*795d594fSAndroid Build Coastguard Worker public static void $noinline$assertShortEquals(short expected, short result) { 1613*795d594fSAndroid Build Coastguard Worker if (expected != result) { 1614*795d594fSAndroid Build Coastguard Worker throw new Error("Expected: " + expected + ", found: " + result); 1615*795d594fSAndroid Build Coastguard Worker } 1616*795d594fSAndroid Build Coastguard Worker } 1617*795d594fSAndroid Build Coastguard Worker } 1618