• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14#! CHECKER      Check IfConversion in JIT
15#! RUN          force_jit: true, options: "", entry: "_GLOBAL::main"
16#! EVENT        /Compilation,_GLOBAL::main,.*COMPILED/
17#! METHOD       "_GLOBAL::main"
18#! PASS_AFTER   "MemoryCoalescing"
19#! INST_NOT     "SelectImm GT i32"
20#! @mem_coalescing_count = BLOCK_COUNT()
21#! PASS_AFTER   "IfConversion"
22#! TRUE         @mem_coalescing_count > BLOCK_COUNT()
23#! INST         "SelectImm GT i32"
24#   Construction before is necessary for compare the quantity of base blocks after pass "MemoryCoalescing" and after "IfConversion",
25#   without variable, you can write only such code.
26#   Equivalent code with variable:
27#       temp = BLOCK_COUNT()
28#       PASS_AFTER("IfConversion")
29#       TRUE(temp > BLOCK_COUNT())
30
31#! CHECKER      Check IfConversion in AOT
32#! SKIP_IF      @architecture == "arm32"
33#! RUN_PAOC     options: ""
34#! METHOD       "_GLOBAL::main"
35#! PASS_AFTER   "MemoryCoalescing"
36#! INST_NOT     "SelectImm GT i32"
37#! @mem_coalescing_count = BLOCK_COUNT()
38#! PASS_AFTER   "IfConversion"
39#! TRUE         @mem_coalescing_count > BLOCK_COUNT()
40#! INST         "SelectImm GT i32"
41#! RUN          options: "", entry: "_GLOBAL::main"
42#! EVENT        "AotEntrypointFound,_GLOBAL::main"
43#   Construction after is necessary for compare the quantity of base blocks after pass "MemoryCoalescing" and after "IfConversion",
44#   without variable, you can write only such code.
45#   Equivalent code with variable:
46#       temp = BLOCK_COUNT()
47#       PASS_AFTER("IfConversion")
48#       TRUE(temp > BLOCK_COUNT())
49
50.function i32 main () <> {
51    movi v0, 0
52    movi v1, 10
53    movi v2, 5
54loop:
55    lda v1
56    jgt v2, inci
57    inci v0, -1
58    jmp done
59inci:
60    inci v0, 1
61done:
62    inci v1, -1
63    lda v1
64    jgtz loop
65    lda v0
66    return
67}
68