1 /*****************************************************************************
2 Copyright (c) 2016, The OpenBLAS Project
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9    1. Redistributions of source code must retain the above copyright
10       notice, this list of conditions and the following disclaimer.
11 
12    2. Redistributions in binary form must reproduce the above copyright
13       notice, this list of conditions and the following disclaimer in
14       the documentation and/or other materials provided with the
15       distribution.
16    3. Neither the name of the OpenBLAS project nor the names of
17       its contributors may be used to endorse or promote products
18       derived from this software without specific prior written
19       permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
30 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 **********************************************************************************/
32 
33 #ifndef COMMON_MIPS
34 #define COMMON_MIPS
35 
36 #define MB  __sync_synchronize()
37 #define WMB __sync_synchronize()
38 #define RMB __sync_synchronize()
39 
40 #define INLINE inline
41 
42 #define RETURN_BY_COMPLEX
43 
44 #ifndef ASSEMBLER
45 
46 #if !defined(MIPS24K)
rpcc(void)47 static inline unsigned int rpcc(void){
48   unsigned long ret;
49 
50   __asm__ __volatile__(".set   push    \n"
51           "rdhwr %0, $30  \n"
52           ".set pop" : "=r"(ret) : : "memory");
53 
54   return ret;
55 }
56 #define RPCC_DEFINED
57 #endif
58 
blas_quickdivide(blasint x,blasint y)59 static inline int blas_quickdivide(blasint x, blasint y){
60   return x / y;
61 }
62 
63 #define GET_IMAGE(res)
64 
65 #define GET_IMAGE_CANCEL
66 
67 #endif
68 
69 
70 #ifndef F_INTERFACE
71 #define REALNAME ASMNAME
72 #else
73 #define REALNAME ASMFNAME
74 #endif
75 
76 #if defined(ASSEMBLER) && !defined(NEEDPARAM)
77 
78 #define PROLOGUE \
79 	.arm		 ;\
80 	.global	REALNAME ;\
81 REALNAME:
82 
83 #define EPILOGUE
84 
85 #define PROFCODE
86 
87 #endif
88 
89 
90 #define SEEK_ADDRESS
91 
92 #ifndef PAGESIZE
93 #define PAGESIZE        ( 4 << 10)
94 #endif
95 #define HUGE_PAGESIZE   ( 4 << 20)
96 
97 #define BUFFER_SIZE     (16 << 21)
98 
99 
100 #define BASE_ADDRESS (START_ADDRESS - BUFFER_SIZE * MAX_CPU_NUMBER)
101 
102 #ifndef MAP_ANONYMOUS
103 #define MAP_ANONYMOUS MAP_ANON
104 #endif
105 
106 #endif
107