2 * Header file for wrappers around MIPS64R6 instructions assembler
5 * Copyright (C) 2019 Wave Computing, Inc.
6 * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 #ifndef WRAPPERS_MIPS64R6_H
24 #define WRAPPERS_MIPS64R6_H
27 #define DO_MIPS64R6__RD__RS(suffix, mnemonic) \
28 static inline void do_mips64r6_##suffix(const void *input, \
33 #mnemonic " $t0, $t1\n\t" \
36 : "r" (input), "r" (output) \
37 : "t0", "t1", "memory" \
41 DO_MIPS64R6__RD__RS(CLO
, clo
)
42 DO_MIPS64R6__RD__RS(CLZ
, clz
)
43 DO_MIPS64R6__RD__RS(DCLO
, dclo
)
44 DO_MIPS64R6__RD__RS(DCLZ
, dclz
)
46 DO_MIPS64R6__RD__RS(BITSWAP
, bitswap
)
47 DO_MIPS64R6__RD__RS(DBITSWAP
, dbitswap
)
50 #define DO_MIPS64R6__RD__RS_RT(suffix, mnemonic) \
51 static inline void do_mips64r6_##suffix(const void *input1, \
58 #mnemonic " $t0, $t1, $t2\n\t" \
61 : "r" (input1), "r" (input2), "r" (output) \
62 : "t0", "t1", "memory" \
66 DO_MIPS64R6__RD__RS_RT(SLLV
, sllv
)
67 DO_MIPS64R6__RD__RS_RT(SRLV
, srlv
)
68 DO_MIPS64R6__RD__RS_RT(SRAV
, srav
)
69 DO_MIPS64R6__RD__RS_RT(DSLLV
, dsllv
)
70 DO_MIPS64R6__RD__RS_RT(DSRLV
, dsrlv
)
71 DO_MIPS64R6__RD__RS_RT(DSRAV
, dsrav
)
73 DO_MIPS64R6__RD__RS_RT(MUL
, mul
)
74 DO_MIPS64R6__RD__RS_RT(MUH
, muh
)
75 DO_MIPS64R6__RD__RS_RT(MULU
, mulu
)
76 DO_MIPS64R6__RD__RS_RT(MUHU
, muhu
)
77 DO_MIPS64R6__RD__RS_RT(DMUL
, dmul
)
78 DO_MIPS64R6__RD__RS_RT(DMUH
, dmuh
)
79 DO_MIPS64R6__RD__RS_RT(DMULU
, dmulu
)
80 DO_MIPS64R6__RD__RS_RT(DMUHU
, dmuhu
)