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 LTestCase;
16
17.super Ljava/lang/Object;
18
19## CHECK-START: boolean TestCase.testCase(boolean) select_generator (before)
20## CHECK-DAG:     <<Param:z\d+>>           ParameterValue
21## CHECK-DAG:     <<Int0:i\d+>>            IntConstant 0
22## CHECK-DAG:     <<Int1:i\d+>>            IntConstant 1
23## CHECK-DAG:                              If [<<Param>>]
24## CHECK-DAG:                              Return [<<Int0>>]
25## CHECK-DAG:                              Return [<<Int1>>]
26
27## CHECK-START: boolean TestCase.testCase(boolean) select_generator (after)
28## CHECK-DAG:     <<Param:z\d+>>           ParameterValue
29## CHECK-DAG:     <<Int0:i\d+>>            IntConstant 0
30## CHECK-DAG:     <<Int1:i\d+>>            IntConstant 1
31## CHECK-DAG:     <<Select:i\d+>>          Select [<<Int0>>,<<Int1>>,<<Param>>]
32## CHECK-DAG:                              Return [<<Select>>]
33
34.method public static testCase(Z)Z
35    .registers 1
36
37    # The select generation will replace this with a select
38    # instruction and a return.
39    if-eqz v0, :else
40    const v0, 0x1
41    return v0
42
43    :else
44    const v0, 0x0
45    return v0
46.end method
47
48
49## CHECK-START: java.lang.Object TestCase.referenceTypeTestCase(Main$Sub1, Main$Sub2, boolean) select_generator (before)
50## CHECK-DAG:     <<Param0:l\d+>>          ParameterValue
51## CHECK-DAG:     <<Param1:l\d+>>          ParameterValue
52## CHECK-DAG:     <<Param2:z\d+>>          ParameterValue
53## CHECK-DAG:                              If [<<Param2>>]
54## CHECK-DAG:                              Return [<<Param1>>]
55## CHECK-DAG:                              Return [<<Param0>>]
56
57## CHECK-START: java.lang.Object TestCase.referenceTypeTestCase(Main$Sub1, Main$Sub2, boolean) select_generator (after)
58## CHECK-DAG:     <<Param0:l\d+>>          ParameterValue
59## CHECK-DAG:     <<Param1:l\d+>>          ParameterValue
60## CHECK-DAG:     <<Param2:z\d+>>          ParameterValue
61## CHECK-DAG:     <<Select:l\d+>>          Select [<<Param1>>,<<Param0>>,<<Param2>>]
62## CHECK-DAG:                              Return [<<Select>>]
63
64.method public static referenceTypeTestCase(LMain$Sub1;LMain$Sub2;Z)Ljava/lang/Object;
65    .registers 3
66
67    if-eqz v2, :else
68    return-object v0
69
70    :else
71    return-object v1
72.end method
73