4 * Copyright (c) 2015 Chen Gang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see
18 * <http://www.gnu.org/licenses/lgpl-2.1.html>
22 #include "qemu-common.h"
23 #include "exec/helper-proto.h"
25 void helper_exception(CPUTLGState
*env
, uint32_t excp
)
27 CPUState
*cs
= CPU(tilegx_env_get_cpu(env
));
29 cs
->exception_index
= excp
;
33 uint64_t helper_cntlz(uint64_t arg
)
38 uint64_t helper_cnttz(uint64_t arg
)
43 uint64_t helper_pcnt(uint64_t arg
)
48 uint64_t helper_revbits(uint64_t arg
)
54 * Functional Description
55 * uint64_t a = rf[SrcA];
56 * uint64_t b = rf[SrcB];
57 * uint64_t d = rf[Dest];
58 * uint64_t output = 0;
59 * unsigned int counter;
60 * for (counter = 0; counter < (WORD_SIZE / BYTE_SIZE); counter++)
62 * int sel = getByte (b, counter) & 0xf;
63 * uint8_t byte = (sel < 8) ? getByte (d, sel) : getByte (a, (sel - 8));
64 * output = setByte (output, counter, byte);
68 uint64_t helper_shufflebytes(uint64_t dest
, uint64_t srca
, uint64_t srcb
)
73 for (count
= 0; count
< 64; count
+= 8) {
74 uint64_t sel
= srcb
>> count
;
75 uint64_t src
= (sel
& 8) ? srca
: dest
;
76 vdst
|= extract64(src
, (sel
& 7) * 8, 8) << count
;