Sebastien Hertz | 9837caf | 2016-08-01 11:09:50 +0200 | [diff] [blame] | 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 LBooleanNotSmali; |
| 16 | .super Ljava/lang/Object; |
| 17 | |
| 18 | # |
| 19 | # Elementary test negating a boolean. Verifies that blocks are merged and |
| 20 | # empty branches removed. |
| 21 | # |
| 22 | |
| 23 | ## CHECK-START: boolean BooleanNotSmali.BooleanNot(boolean) select_generator (before) |
| 24 | ## CHECK-DAG: <<Param:z\d+>> ParameterValue |
| 25 | ## CHECK-DAG: <<Const0:i\d+>> IntConstant 0 |
| 26 | ## CHECK-DAG: <<Const1:i\d+>> IntConstant 1 |
| 27 | ## CHECK-DAG: If [<<Param>>] |
| 28 | ## CHECK-DAG: <<Phi:i\d+>> Phi [<<Const0>>,<<Const1>>] |
| 29 | ## CHECK-DAG: Return [<<Phi>>] |
| 30 | |
| 31 | ## CHECK-START: boolean BooleanNotSmali.BooleanNot(boolean) select_generator (before) |
| 32 | ## CHECK: Goto |
| 33 | ## CHECK: Goto |
| 34 | ## CHECK: Goto |
| 35 | ## CHECK-NOT: Goto |
| 36 | |
| 37 | ## CHECK-START: boolean BooleanNotSmali.BooleanNot(boolean) select_generator (after) |
| 38 | ## CHECK-DAG: <<Param:z\d+>> ParameterValue |
| 39 | ## CHECK-DAG: <<Const0:i\d+>> IntConstant 0 |
| 40 | ## CHECK-DAG: <<Const1:i\d+>> IntConstant 1 |
| 41 | ## CHECK-DAG: <<NotParam:i\d+>> Select [<<Const1>>,<<Const0>>,<<Param>>] |
| 42 | ## CHECK-DAG: Return [<<NotParam>>] |
| 43 | |
| 44 | ## CHECK-START: boolean BooleanNotSmali.BooleanNot(boolean) select_generator (after) |
| 45 | ## CHECK-NOT: If |
| 46 | ## CHECK-NOT: Phi |
| 47 | |
| 48 | ## CHECK-START: boolean BooleanNotSmali.BooleanNot(boolean) select_generator (after) |
| 49 | ## CHECK: Goto |
| 50 | ## CHECK-NOT: Goto |
| 51 | |
| 52 | .method public static BooleanNot(Z)Z |
| 53 | .registers 2 |
| 54 | |
| 55 | if-eqz v1, :true_start |
| 56 | const/4 v0, 0x0 |
| 57 | |
| 58 | :return_start |
| 59 | return v0 |
| 60 | |
| 61 | :true_start |
| 62 | const/4 v0, 0x1 |
| 63 | goto :return_start |
| 64 | |
| 65 | .end method |