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 LTestCase;
     16 
     17 .super Ljava/lang/Object;
     18 
     19 ## CHECK-START: boolean TestCase.testCase() select_generator (after)
     20 ## CHECK-DAG:     <<Select:i\d+>>          Select
     21 ## CHECK-DAG:                              Return [<<Select>>]
     22 
     23 ## CHECK-START: boolean TestCase.testCase() load_store_elimination (after)
     24 ## CHECK-DAG:     <<Or:i\d+>>              Or
     25 ## CHECK-DAG:     <<TypeConversion:b\d+>>  TypeConversion
     26 ## CHECK-DAG:                              StaticFieldSet
     27 ## CHECK-DAG:                              Return [<<TypeConversion>>]
     28 
     29 .method public static testCase()Z
     30     .registers 6
     31 
     32     sget-boolean v0, LMain;->field0:Z
     33     sget-boolean v1, LMain;->field1:Z
     34     or-int v2, v0, v1
     35     int-to-byte v2, v2
     36     sput-boolean v2, LMain;->field2:Z
     37 
     38     # LSE will replace this sget with the type conversion above...
     39     sget-boolean v2, LMain;->field2:Z
     40 
     41     # ... and select generation will replace this part with a select
     42     # that simplifies into simply returning the stored boolean.
     43     if-eqz v2, :else
     44     const v0, 0x1
     45     return v0
     46 
     47     :else
     48     const v0, 0x0
     49     return v0
     50 .end method
     51