• 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 that cast in bool work for all arch
15#! RUN          force_jit: true, options: "", entry: "_GLOBAL::main_all", result: 0
16#! EVENT        /Compilation,_GLOBAL::main_all,.*COMPILED/
17
18.function u1 main_all() {
19    movi v2, 0xF1F1
20    call __noinline__cast_i32, v2
21    addi -1
22    jnez failure_exit_2
23
24    movi v3, 0x0
25    call __noinline__cast_u32, v3
26    jnez failure_exit_3
27
28    movi v4, 0x0
29    call __noinline__cast_i32, v4
30    jnez failure_exit_4
31
32    movi.64 v5, 0xFAECF0F11234
33    call __noinline__cast_u64, v5
34    addi -1
35    jnez failure_exit_5
36
37    movi.64 v6, 0x100000000
38    call __noinline__cast_i64, v6
39    addi -1
40    jnez failure_exit_6
41
42    movi.64 v7, 0x0
43    call __noinline__cast_u64, v7
44    jnez failure_exit_7
45
46    movi.64 v8, 0x0
47    call __noinline__cast_u64, v8
48    jnez failure_exit_8
49
50    ldai 0
51    return
52
53failure_exit_1:
54    ldai 1
55    return
56failure_exit_2:
57    ldai 2
58    return
59failure_exit_3:
60    ldai 3
61    return
62failure_exit_4:
63    ldai 4
64    return
65failure_exit_5:
66    ldai 5
67    return
68failure_exit_6:
69    ldai 6
70    return
71failure_exit_7:
72    ldai 7
73    return
74failure_exit_8:
75    ldai 8
76    return
77}
78
79.function u1 __noinline__cast_u32(u32 a0) {
80    lda a0
81    u32tou1
82    return
83}
84
85.function u1 __noinline__cast_i32(i32 a0) {
86    lda a0
87    i32tou1
88    return
89}
90
91.function u1 __noinline__cast_u64(u64 a0) {
92    lda a0
93    u64tou1
94    return
95}
96
97.function u1 __noinline__cast_i64(i64 a0) {
98    lda a0
99    i64tou1
100    return
101}
102