/* * Copyright (C) 2016 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 { /** * Check that the intermediate address computation is not reordered or merged * across the call to Math.abs(). */ /// CHECK-START-ARM: void Main.main(java.lang.String[]) instruction_simplifier_arm (before) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] /// CHECK-START-ARM: void Main.main(java.lang.String[]) instruction_simplifier_arm (after) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> IntConstant /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] /// CHECK-START-ARM: void Main.main(java.lang.String[]) GVN$after_arch (after) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> IntConstant /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] /// CHECK-START-ARM64: void Main.main(java.lang.String[]) instruction_simplifier_arm64 (before) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] /// CHECK-START-ARM64: void Main.main(java.lang.String[]) instruction_simplifier_arm64 (after) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> IntConstant /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] /// CHECK-START-ARM64: void Main.main(java.lang.String[]) GVN$after_arch (after) /// CHECK-DAG: <> IntConstant -42 /// CHECK-DAG: <> IntConstant /// CHECK-DAG: <> NullCheck /// CHECK-DAG: <> BoundsCheck /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: <> ArrayGet [<>,<>] /// CHECK-DAG: <> InvokeStaticOrDirect [<>] intrinsic:MathAbsInt /// CHECK-DAG: <> Add [<>,<>] /// CHECK-DAG: <> IntermediateAddress [<>,<>] /// CHECK-DAG: ArraySet [<>,<>,<>] public static void main(String[] args) { array[index] += Math.abs(-42); } static int index = 0; static int[] array = new int[2]; }