1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci#ifndef OSSL_CRYPTO_MIPS_ARCH_H
11e1051a39Sopenharmony_ci# define OSSL_CRYPTO_MIPS_ARCH_H
12e1051a39Sopenharmony_ci
13e1051a39Sopenharmony_ci# if (defined(__mips_smartmips) || defined(_MIPS_ARCH_MIPS32R3) || \
14e1051a39Sopenharmony_ci      defined(_MIPS_ARCH_MIPS32R5) || defined(_MIPS_ARCH_MIPS32R6)) \
15e1051a39Sopenharmony_ci      && !defined(_MIPS_ARCH_MIPS32R2)
16e1051a39Sopenharmony_ci#  define _MIPS_ARCH_MIPS32R2
17e1051a39Sopenharmony_ci# endif
18e1051a39Sopenharmony_ci
19e1051a39Sopenharmony_ci# if (defined(_MIPS_ARCH_MIPS64R3) || defined(_MIPS_ARCH_MIPS64R5) || \
20e1051a39Sopenharmony_ci      defined(_MIPS_ARCH_MIPS64R6)) \
21e1051a39Sopenharmony_ci      && !defined(_MIPS_ARCH_MIPS64R2)
22e1051a39Sopenharmony_ci#  define _MIPS_ARCH_MIPS64R2
23e1051a39Sopenharmony_ci# endif
24e1051a39Sopenharmony_ci
25e1051a39Sopenharmony_ci# if defined(_MIPS_ARCH_MIPS64R6)
26e1051a39Sopenharmony_ci#  define dmultu(rs,rt)
27e1051a39Sopenharmony_ci#  define mflo(rd,rs,rt)	dmulu	rd,rs,rt
28e1051a39Sopenharmony_ci#  define mfhi(rd,rs,rt)	dmuhu	rd,rs,rt
29e1051a39Sopenharmony_ci# elif defined(_MIPS_ARCH_MIPS32R6)
30e1051a39Sopenharmony_ci#  define multu(rs,rt)
31e1051a39Sopenharmony_ci#  define mflo(rd,rs,rt)	mulu	rd,rs,rt
32e1051a39Sopenharmony_ci#  define mfhi(rd,rs,rt)	muhu	rd,rs,rt
33e1051a39Sopenharmony_ci# else
34e1051a39Sopenharmony_ci#  define dmultu(rs,rt)		dmultu	rs,rt
35e1051a39Sopenharmony_ci#  define multu(rs,rt)		multu	rs,rt
36e1051a39Sopenharmony_ci#  define mflo(rd,rs,rt)	mflo	rd
37e1051a39Sopenharmony_ci#  define mfhi(rd,rs,rt)	mfhi	rd
38e1051a39Sopenharmony_ci# endif
39e1051a39Sopenharmony_ci
40e1051a39Sopenharmony_ci#endif
41