1# Copyright (C) 2017 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15.class public LSmali; 16.super Ljava/lang/Object; 17 18## CHECK-START: void Smali.stencilSubInt(int[], int[], int) loop_optimization (before) 19## CHECK-DAG: <<PAR3:i\d+>> ParameterValue loop:none 20## CHECK-DAG: <<CP1:i\d+>> IntConstant 1 loop:none 21## CHECK-DAG: <<Sub1:i\d+>> Sub [<<PAR3>>,<<CP1>>] loop:none 22## CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none 23## CHECK-DAG: <<Sub2:i\d+>> Sub [<<Phi>>,<<CP1>>] loop:<<Loop>> outer_loop:none 24## CHECK-DAG: <<Get1:i\d+>> ArrayGet [{{l\d+}},<<Sub2>>] loop:<<Loop>> outer_loop:none 25## CHECK-DAG: <<Get2:i\d+>> ArrayGet [{{l\d+}},<<Phi>>] loop:<<Loop>> outer_loop:none 26## CHECK-DAG: <<Add1:i\d+>> Add [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none 27## CHECK-DAG: <<Add2:i\d+>> Add [<<Phi>>,<<CP1>>] loop:<<Loop>> outer_loop:none 28## CHECK-DAG: <<Get3:i\d+>> ArrayGet [{{l\d+}},<<Add2>>] loop:<<Loop>> outer_loop:none 29## CHECK-DAG: <<Add3:i\d+>> Add [<<Add1>>,<<Get3>>] loop:<<Loop>> outer_loop:none 30## CHECK-DAG: ArraySet [{{l\d+}},<<Phi>>,<<Add3>>] loop:<<Loop>> outer_loop:none 31 32## CHECK-START-ARM64: void Smali.stencilSubInt(int[], int[], int) loop_optimization (after) 33## CHECK-DAG: <<CP1:i\d+>> IntConstant 1 loop:none 34## CHECK-DAG: <<CP2:i\d+>> IntConstant 2 loop:none 35## CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none 36## CHECK-DAG: <<Add1:i\d+>> Add [<<Phi>>,<<CP1>>] loop:<<Loop>> outer_loop:none 37## CHECK-DAG: <<Get1:d\d+>> VecLoad [{{l\d+}},<<Phi>>] loop:<<Loop>> outer_loop:none 38## CHECK-DAG: <<Get2:d\d+>> VecLoad [{{l\d+}},<<Add1>>] loop:<<Loop>> outer_loop:none 39## CHECK-DAG: <<Add2:d\d+>> VecAdd [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none 40## CHECK-DAG: <<Add3:i\d+>> Add [<<Phi>>,<<CP2>>] loop:<<Loop>> outer_loop:none 41## CHECK-DAG: <<Get3:d\d+>> VecLoad [{{l\d+}},<<Add3>>] loop:<<Loop>> outer_loop:none 42## CHECK-DAG: <<Add4:d\d+>> VecAdd [<<Add2>>,<<Get3>>] loop:<<Loop>> outer_loop:none 43## CHECK-DAG: VecStore [{{l\d+}},<<Add1>>,<<Add4>>] loop:<<Loop>> outer_loop:none 44.method public static stencilSubInt([I[II)V 45 .registers 7 46 47 const/4 v0, 0x1 48 49 move v1, v0 50 51 :goto_2 52 sub-int v2, p2, v0 53 54 if-ge v1, v2, :cond_17 55 56 sub-int v2, v1, v0 57 aget v2, p1, v2 58 aget v3, p1, v1 59 add-int/2addr v2, v3 60 add-int v3, v1, v0 61 aget v3, p1, v3 62 add-int/2addr v2, v3 63 aput v2, p0, v1 64 add-int/lit8 v1, v1, 0x1 65 66 goto :goto_2 67 68 :cond_17 69 return-void 70.end method 71 72## CHECK-START: void Smali.stencilAddInt(int[], int[], int) loop_optimization (before) 73## CHECK-DAG: <<CP1:i\d+>> IntConstant 1 loop:none 74## CHECK-DAG: <<CM1:i\d+>> IntConstant -1 loop:none 75## CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none 76## CHECK-DAG: <<Add1:i\d+>> Add [<<Phi>>,<<CM1>>] loop:<<Loop>> outer_loop:none 77## CHECK-DAG: <<Get1:i\d+>> ArrayGet [{{l\d+}},<<Add1>>] loop:<<Loop>> outer_loop:none 78## CHECK-DAG: <<Get2:i\d+>> ArrayGet [{{l\d+}},<<Phi>>] loop:<<Loop>> outer_loop:none 79## CHECK-DAG: <<Add2:i\d+>> Add [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none 80## CHECK-DAG: <<Add3:i\d+>> Add [<<Phi>>,<<CP1>>] loop:<<Loop>> outer_loop:none 81## CHECK-DAG: <<Get3:i\d+>> ArrayGet [{{l\d+}},<<Add3>>] loop:<<Loop>> outer_loop:none 82## CHECK-DAG: <<Add4:i\d+>> Add [<<Add2>>,<<Get3>>] loop:<<Loop>> outer_loop:none 83## CHECK-DAG: ArraySet [{{l\d+}},<<Phi>>,<<Add4>>] loop:<<Loop>> outer_loop:none 84 85## CHECK-START-ARM64: void Smali.stencilAddInt(int[], int[], int) loop_optimization (after) 86## CHECK-DAG: <<CP1:i\d+>> IntConstant 1 loop:none 87## CHECK-DAG: <<CP2:i\d+>> IntConstant 2 loop:none 88## CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none 89## CHECK-DAG: <<Add1:i\d+>> Add [<<Phi>>,<<CP1>>] loop:<<Loop>> outer_loop:none 90## CHECK-DAG: <<Get1:d\d+>> VecLoad [{{l\d+}},<<Phi>>] loop:<<Loop>> outer_loop:none 91## CHECK-DAG: <<Get2:d\d+>> VecLoad [{{l\d+}},<<Add1>>] loop:<<Loop>> outer_loop:none 92## CHECK-DAG: <<Add2:d\d+>> VecAdd [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none 93## CHECK-DAG: <<Add3:i\d+>> Add [<<Phi>>,<<CP2>>] loop:<<Loop>> outer_loop:none 94## CHECK-DAG: <<Get3:d\d+>> VecLoad [{{l\d+}},<<Add3>>] loop:<<Loop>> outer_loop:none 95## CHECK-DAG: <<Add4:d\d+>> VecAdd [<<Add2>>,<<Get3>>] loop:<<Loop>> outer_loop:none 96## CHECK-DAG: VecStore [{{l\d+}},<<Add1>>,<<Add4>>] loop:<<Loop>> outer_loop:none 97.method public static stencilAddInt([I[II)V 98 .registers 6 99 100 const/4 v0, 0x1 101 102 :goto_1 103 add-int/lit8 v1, p2, -0x1 104 105 if-ge v0, v1, :cond_16 106 107 add-int/lit8 v1, v0, -0x1 108 aget v1, p1, v1 109 aget v2, p1, v0 110 add-int/2addr v1, v2 111 add-int/lit8 v2, v0, 0x1 112 aget v2, p1, v2 113 add-int/2addr v1, v2 114 aput v1, p0, v0 115 add-int/lit8 v0, v0, 0x1 116 117 goto :goto_1 118 119 :cond_16 120 return-void 121.end method 122