1 /*
2  *  Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Reserved.
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "qemu/osdep.h"
19 #include "cpu.h"
20 #include "mmvec/system_ext_mmvec.h"
21 
22 void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int slot)
23 {
24     size_t size = sizeof(MMVector);
25 
26     env->vstore_pending[slot] = 1;
27     env->vstore[slot].va   = vaddr;
28     env->vstore[slot].size = size;
29     memcpy(&env->vstore[slot].data.ub[0], &env->tmp_VRegs[0], size);
30 
31     /* On a gather store, overwrite the store mask to emulate dropped gathers */
32     bitmap_copy(env->vstore[slot].mask, env->vtcm_log.mask, size);
33 }
34 
35 void mem_vector_scatter_init(CPUHexagonState *env)
36 {
37     bitmap_zero(env->vtcm_log.mask, MAX_VEC_SIZE_BYTES);
38 
39     env->vtcm_pending = true;
40     env->vtcm_log.op = false;
41     env->vtcm_log.op_size = 0;
42 }
43 
44 void mem_vector_gather_init(CPUHexagonState *env)
45 {
46     bitmap_zero(env->vtcm_log.mask, MAX_VEC_SIZE_BYTES);
47 }
48