# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #! CHECKER Check IfConversion in JIT #! RUN force_jit: true, options: "", entry: "_GLOBAL::main" #! EVENT /Compilation,_GLOBAL::main,.*COMPILED/ #! METHOD "_GLOBAL::main" #! PASS_AFTER "MemoryCoalescing" #! INST_NOT "SelectImm GT i32" #! @mem_coalescing_count = BLOCK_COUNT() #! PASS_AFTER "IfConversion" #! TRUE @mem_coalescing_count > BLOCK_COUNT() #! INST "SelectImm GT i32" # Construction before is necessary for compare the quantity of base blocks after pass "MemoryCoalescing" and after "IfConversion", # without variable, you can write only such code. # Equivalent code with variable: # temp = BLOCK_COUNT() # PASS_AFTER("IfConversion") # TRUE(temp > BLOCK_COUNT()) #! CHECKER Check IfConversion in AOT #! SKIP_IF @architecture == "arm32" #! RUN_PAOC options: "" #! METHOD "_GLOBAL::main" #! PASS_AFTER "MemoryCoalescing" #! INST_NOT "SelectImm GT i32" #! @mem_coalescing_count = BLOCK_COUNT() #! PASS_AFTER "IfConversion" #! TRUE @mem_coalescing_count > BLOCK_COUNT() #! INST "SelectImm GT i32" #! RUN options: "", entry: "_GLOBAL::main" #! EVENT "AotEntrypointFound,_GLOBAL::main" # Construction after is necessary for compare the quantity of base blocks after pass "MemoryCoalescing" and after "IfConversion", # without variable, you can write only such code. # Equivalent code with variable: # temp = BLOCK_COUNT() # PASS_AFTER("IfConversion") # TRUE(temp > BLOCK_COUNT()) .function i32 main () <> { movi v0, 0 movi v1, 10 movi v2, 5 loop: lda v1 jgt v2, inci inci v0, -1 jmp done inci: inci v0, 1 done: inci v1, -1 lda v1 jgtz loop lda v0 return }