aboutsummaryrefslogtreecommitdiff
path: root/target/ppc/translate/vector-impl.c.inc
blob: 117ce9b13705fb62bde11b16371fc17a85461b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Power ISA decode for Vector Facility instructions
 *
 * Copyright (c) 2021 Instituto de Pesquisas Eldorado (eldorado.org.br)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#define REQUIRE_ALTIVEC(CTX) \
    do {                                                \
        if (unlikely(!(CTX)->altivec_enabled)) {        \
            gen_exception((CTX), POWERPC_EXCP_VPU);     \
            return true;                                \
        }                                               \
    } while (0)

static bool trans_VCFUGED(DisasContext *ctx, arg_VX *a)
{
    TCGv_i64 tgt, src, mask;

    REQUIRE_INSNS_FLAGS2(ctx, ISA310);
    REQUIRE_ALTIVEC(ctx);

    tgt = tcg_temp_new_i64();
    src = tcg_temp_new_i64();
    mask = tcg_temp_new_i64();

    /* centrifuge lower double word */
    get_cpu_vsrl(src, a->vra + 32);
    get_cpu_vsrl(mask, a->vrb + 32);
    gen_helper_cfuged(tgt, src, mask);
    set_cpu_vsrl(a->vrt + 32, tgt);

    /* centrifuge higher double word */
    get_cpu_vsrh(src, a->vra + 32);
    get_cpu_vsrh(mask, a->vrb + 32);
    gen_helper_cfuged(tgt, src, mask);
    set_cpu_vsrh(a->vrt + 32, tgt);

    tcg_temp_free_i64(tgt);
    tcg_temp_free_i64(src);
    tcg_temp_free_i64(mask);

    return true;
}