Home | History | Annotate | Download | only in smali
      1 # Copyright (C) 2016 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 LMain2;
     16 .super Ljava/lang/Object;
     17 
     18 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) builder (after)
     19 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
     20 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
     21 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
     22 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
     23 ## CHECK-DAG:     <<Val:i\d+>>     Phi [<<One>>,<<Zero>>]
     24 ## CHECK-DAG:     <<Result:i\d+>>  InvokeStaticOrDirect [<<Val>>,<<ArgDist>>{{(,[ij]\d+)?}}] intrinsic:IntegerRotateLeft
     25 ## CHECK-DAG:                      Return [<<Result>>]
     26 
     27 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier (after)
     28 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
     29 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
     30 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
     31 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
     32 ## CHECK-DAG:     <<Val:i\d+>>     Phi [<<One>>,<<Zero>>]
     33 ## CHECK-DAG:     <<NegDist:i\d+>> Neg [<<ArgDist>>]
     34 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<Val>>,<<NegDist>>]
     35 ## CHECK-DAG:                      Return [<<Result>>]
     36 
     37 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier (after)
     38 ## CHECK-NOT:                      InvokeStaticOrDirect
     39 
     40 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) select_generator (after)
     41 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
     42 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
     43 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
     44 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
     45 ## CHECK-DAG:     <<SelVal:i\d+>>  Select [<<Zero>>,<<One>>,<<ArgVal>>]
     46 ## CHECK-DAG:     <<NegDist:i\d+>> Neg [<<ArgDist>>]
     47 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<SelVal>>,<<NegDist>>]
     48 ## CHECK-DAG:                      Return [<<Result>>]
     49 
     50 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) select_generator (after)
     51 ## CHECK-NOT:                      Phi
     52 
     53 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after)
     54 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
     55 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
     56 ## CHECK-DAG:     <<NegDist:i\d+>> Neg [<<ArgDist>>]
     57 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<ArgVal>>,<<NegDist>>]
     58 ## CHECK-DAG:                      Return [<<Result>>]
     59 
     60 ## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after)
     61 ## CHECK-NOT:                      Select
     62 
     63 # Original java source
     64 #
     65 #     private static int rotateLeftBoolean(boolean value, int distance) {
     66 #       return Integer.rotateLeft(value ? 1 : 0, distance);
     67 #     }
     68 
     69 .method public static rotateLeftBoolean(ZI)I
     70     .registers 3
     71     .param p0, "value"    # Z
     72     .param p1, "distance"    # I
     73 
     74     .prologue
     75     .line 66
     76     if-eqz p0, :cond_8
     77 
     78     const/4 v0, 0x1
     79 
     80     :goto_3
     81     invoke-static {v0, p1}, Ljava/lang/Integer;->rotateLeft(II)I
     82 
     83     move-result v0
     84 
     85     return v0
     86 
     87     :cond_8
     88     const/4 v0, 0x0
     89 
     90     goto :goto_3
     91 .end method
     92 
     93 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) builder (after)
     94 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
     95 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
     96 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
     97 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
     98 ## CHECK-DAG:     <<Val:i\d+>>     Phi [<<One>>,<<Zero>>]
     99 ## CHECK-DAG:     <<Result:i\d+>>  InvokeStaticOrDirect [<<Val>>,<<ArgDist>>{{(,[ij]\d+)?}}] intrinsic:IntegerRotateRight
    100 ## CHECK-DAG:                      Return [<<Result>>]
    101 
    102 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier (after)
    103 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
    104 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
    105 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
    106 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
    107 ## CHECK-DAG:     <<Val:i\d+>>     Phi [<<One>>,<<Zero>>]
    108 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<Val>>,<<ArgDist>>]
    109 ## CHECK-DAG:                      Return [<<Result>>]
    110 
    111 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier (after)
    112 ## CHECK-NOT:                      InvokeStaticOrDirect
    113 
    114 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) select_generator (after)
    115 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
    116 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
    117 ## CHECK-DAG:     <<Zero:i\d+>>    IntConstant 0
    118 ## CHECK-DAG:     <<One:i\d+>>     IntConstant 1
    119 ## CHECK-DAG:     <<SelVal:i\d+>>  Select [<<Zero>>,<<One>>,<<ArgVal>>]
    120 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<SelVal>>,<<ArgDist>>]
    121 ## CHECK-DAG:                      Return [<<Result>>]
    122 
    123 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) select_generator (after)
    124 ## CHECK-NOT:                     Phi
    125 
    126 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after)
    127 ## CHECK:         <<ArgVal:z\d+>>  ParameterValue
    128 ## CHECK:         <<ArgDist:i\d+>> ParameterValue
    129 ## CHECK-DAG:     <<Result:i\d+>>  Ror [<<ArgVal>>,<<ArgDist>>]
    130 ## CHECK-DAG:                      Return [<<Result>>]
    131 
    132 ## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after)
    133 ## CHECK-NOT:                     Select
    134 
    135 # Original java source:
    136 #
    137 #     private static int rotateRightBoolean(boolean value, int distance) {
    138 #       return Integer.rotateRight(value ? 1 : 0, distance);
    139 #     }
    140 
    141 .method public static rotateRightBoolean(ZI)I
    142     .registers 3
    143     .param p0, "value"    # Z
    144     .param p1, "distance"    # I
    145 
    146     .prologue
    147     .line 219
    148     if-eqz p0, :cond_8
    149 
    150     const/4 v0, 0x1
    151 
    152     :goto_3
    153     invoke-static {v0, p1}, Ljava/lang/Integer;->rotateRight(II)I
    154 
    155     move-result v0
    156 
    157     return v0
    158 
    159     :cond_8
    160     const/4 v0, 0x0
    161 
    162     goto :goto_3
    163 .end method
    164