• 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      Intrinsics is enabled
15#! RUN          force_jit: true, options: "--compiler-encode-intrinsics=true", entry: "_GLOBAL::main"
16#! EVENT        /Compilation,.*_GLOBAL::main/
17#! METHOD       "_GLOBAL::main"
18#! PASS_AFTER   "IrBuilder"
19#! INST         "Abs "
20#! INST         "Min "
21#! ASM_METHOD   "_GLOBAL::main"
22#! ASM_NOT      x64: /call.*r\d+/
23
24#! CHECKER      Intrinsics is disable
25#! RUN          force_jit: true, options: "--compiler-encode-intrinsics=false", entry: "_GLOBAL::main"
26#! EVENT        /Compilation,.*_GLOBAL::main/
27#! METHOD       "_GLOBAL::main"
28#! PASS_AFTER   "IrBuilder"
29#! INST         "Intrinsic.MathAbsI64"
30#! INST         "Intrinsic.MathMinI64"
31#! INST_NOT     "Abs "
32#! INST_NOT     "Min "
33#! ASM_METHOD   "_GLOBAL::main"
34#! ASM_INST     "Intrinsic.MathAbsI64"
35#! ASM          x64: /call.*r\d+/, arm64: "bl"
36#! ASM_INST     "Intrinsic.MathMinI64"
37#! ASM          x64: /call.*r\d+/, arm64: "bl"
38
39.record Math <external>
40.function i64 Math.minI64(i64 a0, i64 a1) <external>
41.function i64 Math.absI64(i64 a0) <external>
42.function i64 main() {
43    movi.64 v0, -1
44    movi.64 v1, 0
45    call.short Math.absI64, v0
46    sta v0
47    call.short Math.minI64, v0, v1
48    return
49}