HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Oreo
|
8.0.0_r4
下载
查看原文件
收藏
根目录
art
test
557-checker-instruct-simplifier-ror
src
Main.java
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { public static void assertIntEquals(int expected, int actual) { if (expected != actual) { throw new Error("Expected: " + expected + ", found: " + actual); } } public static void assertLongEquals(long expected, long actual) { if (expected != actual) { throw new Error("Expected: " + expected + ", found: " + actual); } } /// CHECK-START: int Main.rotateIntegerRight(int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> InvokeStaticOrDirect intrinsic:IntegerRotateRight /// CHECK-START: int Main.rotateIntegerRight(int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.rotateIntegerRight(int, int) instruction_simplifier (after) /// CHECK-NOT: LoadClass /// CHECK-NOT: ClinitCheck /// CHECK-NOT: InvokeStaticOrDirect public static int rotateIntegerRight(int value, int distance) { return java.lang.Integer.rotateRight(value, distance); } /// CHECK-START: int Main.rotateIntegerLeft(int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> InvokeStaticOrDirect intrinsic:IntegerRotateLeft /// CHECK-START: int Main.rotateIntegerLeft(int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Neg [<
>] /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.rotateIntegerLeft(int, int) instruction_simplifier (after) /// CHECK-NOT: LoadClass /// CHECK-NOT: ClinitCheck /// CHECK-NOT: InvokeStaticOrDirect public static int rotateIntegerLeft(int value, int distance) { return java.lang.Integer.rotateLeft(value, distance); } /// CHECK-START: long Main.rotateLongRight(long, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> InvokeStaticOrDirect intrinsic:LongRotateRight /// CHECK-START: long Main.rotateLongRight(long, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.rotateLongRight(long, int) instruction_simplifier (after) /// CHECK-NOT: LoadClass /// CHECK-NOT: ClinitCheck /// CHECK-NOT: InvokeStaticOrDirect public static long rotateLongRight(long value, int distance) { return java.lang.Long.rotateRight(value, distance); } /// CHECK-START: long Main.rotateLongLeft(long, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> InvokeStaticOrDirect intrinsic:LongRotateLeft /// CHECK-START: long Main.rotateLongLeft(long, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Neg [<
>] /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.rotateLongLeft(long, int) instruction_simplifier (after) /// CHECK-NOT: LoadClass /// CHECK-NOT: ClinitCheck /// CHECK-NOT: InvokeStaticOrDirect public static long rotateLongLeft(long value, int distance) { return java.lang.Long.rotateLeft(value, distance); } // (i >>> #distance) | (i << #(reg_bits - distance)) /// CHECK-START: int Main.ror_int_constant_c_c(int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> IntConstant 30 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_constant_c_c(int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_constant_c_c(int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static int ror_int_constant_c_c(int value) { return (value >>> 2) | (value << 30); } /// CHECK-START: int Main.ror_int_constant_c_c_0(int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_constant_c_c_0(int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static int ror_int_constant_c_c_0(int value) { return (value >>> 2) | (value << 62); } // (j >>> #distance) | (j << #(reg_bits - distance)) /// CHECK-START: long Main.ror_long_constant_c_c(long) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> IntConstant 62 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_constant_c_c(long) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_constant_c_c(long) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static long ror_long_constant_c_c(long value) { return (value >>> 2) | (value << 62); } /// CHECK-START: long Main.ror_long_constant_c_c_0(long) instruction_simplifier (after) /// CHECK-NOT: Ror public static long ror_long_constant_c_c_0(long value) { return (value >>> 2) | (value << 30); } // (i >>> #distance) | (i << #-distance) /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier$after_inlining (before) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> IntConstant -2 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier$after_inlining (after) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier$after_inlining (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static int ror_int_constant_c_negc(int value) { return (value >>> 2) | (value << $opt$inline$IntConstantM2()); } // Hiding constants outside the range [0, 32) used for int shifts from Jack. // (Jack extracts only the low 5 bits.) public static int $opt$inline$IntConstantM2() { return -2; } // (j >>> #distance) | (j << #-distance) /// CHECK-START: long Main.ror_long_constant_c_negc(long) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> IntConstant -2 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_constant_c_negc(long) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 2 /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_constant_c_negc(long) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static long ror_long_constant_c_negc(long value) { return (value >>> 2) | (value << -2); } // (i >>> distance) | (i << (#reg_bits - distance) /// CHECK-START: int Main.ror_int_reg_v_csubv(int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 32 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_reg_v_csubv(int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_reg_v_csubv(int, int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl /// CHECK-NOT: Sub public static int ror_int_reg_v_csubv(int value, int distance) { return (value >>> distance) | (value << (32 - distance)); } // (distance = x - y) // (i >>> distance) | (i << (#reg_bits - distance) /// CHECK-START: int Main.ror_int_subv_csubv(int, int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 32 /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_subv_csubv(int, int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Sub [<
>,<
>] /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_subv_csubv(int, int, int) instruction_simplifier (after) /// CHECK: Sub /// CHECK-NOT: Sub /// CHECK-START: int Main.ror_int_subv_csubv(int, int, int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static int ror_int_subv_csubv(int value, int x, int y) { int distance = x - y; return (value >>> distance) | (value << (32 - distance)); } /// CHECK-START: int Main.ror_int_subv_csubv_env(int, int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 32 /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: <
> Add [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_subv_csubv_env(int, int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 32 /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK: <
> Ror [<
>,<
>] /// CHECK: <
> Add [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.ror_int_subv_csubv_env(int, int, int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl public static int ror_int_subv_csubv_env(int value, int x, int y) { int distance = x - y; int bits_minus_dist = 32 - distance; return ((value >>> distance) | (value << bits_minus_dist)) + bits_minus_dist; } // (j >>> distance) | (j << (#reg_bits - distance) /// CHECK-START: long Main.ror_long_reg_v_csubv(long, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 64 /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_reg_v_csubv(long, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> Ror [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: long Main.ror_long_reg_v_csubv(long, int) instruction_simplifier (after) /// CHECK-NOT: UShr /// CHECK-NOT: Shl /// CHECK-NOT: Sub public static long ror_long_reg_v_csubv(long value, int distance) { return (value >>> distance) | (value << (64 - distance)); } /// CHECK-START: long Main.ror_long_reg_v_csubv_0(long, int) instruction_simplifier (after) /// CHECK-NOT: Ror public static long ror_long_reg_v_csubv_0(long value, int distance) { return (value >>> distance) | (value << (32 - distance)); } /// CHECK-START: long Main.ror_long_subv_csubv_0(long, int, int) instruction_simplifier (after) /// CHECK-NOT: Ror public static long ror_long_subv_csubv_0(long value, int x, int y) { int distance = x - y; return (value >>> distance) | (value << (32 - distance)); } // (i >>> (#reg_bits - distance)) | (i << distance) /// CHECK-START: int Main.rol_int_reg_csubv_v(int, int) instruction_simplifier (before) /// CHECK: <
> ParameterValue /// CHECK: <
> ParameterValue /// CHECK: <
> IntConstant 32 /// CHECK-DAG: <
> Sub [<
>,<
>] /// CHECK-DAG: <
> UShr [<
>,<
>] /// CHECK-DAG: <
> Shl [<
>,<
>] /// CHECK: <
> Or [<
>,<
>] /// CHECK: Return [<
>] /// CHECK-START: int Main.rol_int_reg_csubv_v(int, int) instruction_simplifier (after) /// CHECK: <
> ParameterValue /// CHECK: <