1*60e9e3f1SDavid Hildenbrand /* 2*60e9e3f1SDavid Hildenbrand * QEMU TCG support -- s390x vector support instructions 3*60e9e3f1SDavid Hildenbrand * 4*60e9e3f1SDavid Hildenbrand * Copyright (C) 2019 Red Hat Inc 5*60e9e3f1SDavid Hildenbrand * 6*60e9e3f1SDavid Hildenbrand * Authors: 7*60e9e3f1SDavid Hildenbrand * David Hildenbrand <david@redhat.com> 8*60e9e3f1SDavid Hildenbrand * 9*60e9e3f1SDavid Hildenbrand * This work is licensed under the terms of the GNU GPL, version 2 or later. 10*60e9e3f1SDavid Hildenbrand * See the COPYING file in the top-level directory. 11*60e9e3f1SDavid Hildenbrand */ 12*60e9e3f1SDavid Hildenbrand #include "qemu/osdep.h" 13*60e9e3f1SDavid Hildenbrand #include "qemu-common.h" 14*60e9e3f1SDavid Hildenbrand #include "cpu.h" 15*60e9e3f1SDavid Hildenbrand #include "internal.h" 16*60e9e3f1SDavid Hildenbrand #include "vec.h" 17*60e9e3f1SDavid Hildenbrand #include "tcg/tcg.h" 18*60e9e3f1SDavid Hildenbrand #include "exec/helper-proto.h" 19*60e9e3f1SDavid Hildenbrand #include "exec/cpu_ldst.h" 20*60e9e3f1SDavid Hildenbrand #include "exec/exec-all.h" 21*60e9e3f1SDavid Hildenbrand 22*60e9e3f1SDavid Hildenbrand void HELPER(vll)(CPUS390XState *env, void *v1, uint64_t addr, uint64_t bytes) 23*60e9e3f1SDavid Hildenbrand { 24*60e9e3f1SDavid Hildenbrand if (likely(bytes >= 16)) { 25*60e9e3f1SDavid Hildenbrand uint64_t t0, t1; 26*60e9e3f1SDavid Hildenbrand 27*60e9e3f1SDavid Hildenbrand t0 = cpu_ldq_data_ra(env, addr, GETPC()); 28*60e9e3f1SDavid Hildenbrand addr = wrap_address(env, addr + 8); 29*60e9e3f1SDavid Hildenbrand t1 = cpu_ldq_data_ra(env, addr, GETPC()); 30*60e9e3f1SDavid Hildenbrand s390_vec_write_element64(v1, 0, t0); 31*60e9e3f1SDavid Hildenbrand s390_vec_write_element64(v1, 1, t1); 32*60e9e3f1SDavid Hildenbrand } else { 33*60e9e3f1SDavid Hildenbrand S390Vector tmp = {}; 34*60e9e3f1SDavid Hildenbrand int i; 35*60e9e3f1SDavid Hildenbrand 36*60e9e3f1SDavid Hildenbrand for (i = 0; i < bytes; i++) { 37*60e9e3f1SDavid Hildenbrand uint8_t byte = cpu_ldub_data_ra(env, addr, GETPC()); 38*60e9e3f1SDavid Hildenbrand 39*60e9e3f1SDavid Hildenbrand s390_vec_write_element8(&tmp, i, byte); 40*60e9e3f1SDavid Hildenbrand addr = wrap_address(env, addr + 1); 41*60e9e3f1SDavid Hildenbrand } 42*60e9e3f1SDavid Hildenbrand *(S390Vector *)v1 = tmp; 43*60e9e3f1SDavid Hildenbrand } 44*60e9e3f1SDavid Hildenbrand } 45