/src/qemu/accel/tcg/tcg-runtime.c
Line | Count | Source |
1 | | /* |
2 | | * Tiny Code Generator for QEMU |
3 | | * |
4 | | * Copyright (c) 2008 Fabrice Bellard |
5 | | * |
6 | | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | * of this software and associated documentation files (the "Software"), to deal |
8 | | * in the Software without restriction, including without limitation the rights |
9 | | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | * copies of the Software, and to permit persons to whom the Software is |
11 | | * furnished to do so, subject to the following conditions: |
12 | | * |
13 | | * The above copyright notice and this permission notice shall be included in |
14 | | * all copies or substantial portions of the Software. |
15 | | * |
16 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | | * THE SOFTWARE. |
23 | | */ |
24 | | #include "qemu/osdep.h" |
25 | | #include "qemu/host-utils.h" |
26 | | #include "exec/cpu-common.h" |
27 | | #include "exec/helper-proto-common.h" |
28 | | #include "accel/tcg/cpu-loop.h" |
29 | | #include "accel/tcg/getpc.h" |
30 | | |
31 | | #define HELPER_H "accel/tcg/tcg-runtime.h" |
32 | | #include "exec/helper-info.c.inc" |
33 | | #undef HELPER_H |
34 | | |
35 | | uint64_t HELPER(muluh_i64)(uint64_t arg1, uint64_t arg2) |
36 | 0 | { |
37 | 0 | uint64_t l, h; |
38 | 0 | mulu64(&l, &h, arg1, arg2); |
39 | 0 | return h; |
40 | 0 | } |
41 | | |
42 | | int64_t HELPER(mulsh_i64)(int64_t arg1, int64_t arg2) |
43 | 0 | { |
44 | 0 | uint64_t l, h; |
45 | 0 | muls64(&l, &h, arg1, arg2); |
46 | 0 | return h; |
47 | 0 | } |
48 | | |
49 | | uint32_t HELPER(clz_i32)(uint32_t arg, uint32_t zero_val) |
50 | 0 | { |
51 | 0 | return arg ? clz32(arg) : zero_val; |
52 | 0 | } |
53 | | |
54 | | uint32_t HELPER(ctz_i32)(uint32_t arg, uint32_t zero_val) |
55 | 0 | { |
56 | 0 | return arg ? ctz32(arg) : zero_val; |
57 | 0 | } |
58 | | |
59 | | uint64_t HELPER(clz_i64)(uint64_t arg, uint64_t zero_val) |
60 | 0 | { |
61 | 0 | return arg ? clz64(arg) : zero_val; |
62 | 0 | } |
63 | | |
64 | | uint64_t HELPER(ctz_i64)(uint64_t arg, uint64_t zero_val) |
65 | 0 | { |
66 | 0 | return arg ? ctz64(arg) : zero_val; |
67 | 0 | } |
68 | | |
69 | | uint32_t HELPER(clrsb_i32)(uint32_t arg) |
70 | 0 | { |
71 | 0 | return clrsb32(arg); |
72 | 0 | } |
73 | | |
74 | | uint64_t HELPER(clrsb_i64)(uint64_t arg) |
75 | 0 | { |
76 | 0 | return clrsb64(arg); |
77 | 0 | } |
78 | | |
79 | | uint32_t HELPER(ctpop_i32)(uint32_t arg) |
80 | 0 | { |
81 | 0 | return ctpop32(arg); |
82 | 0 | } |
83 | | |
84 | | uint64_t HELPER(ctpop_i64)(uint64_t arg) |
85 | 0 | { |
86 | 0 | return ctpop64(arg); |
87 | 0 | } |
88 | | |
89 | | void HELPER(exit_atomic)(CPUArchState *env) |
90 | 0 | { |
91 | 0 | cpu_loop_exit_atomic(env_cpu(env), GETPC()); |
92 | 0 | } |