Merge pull request #1179 from jcowgill/memory-fixes
[platform/upstream/openblas.git] / common_mips.h
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
37 #define WMB
38
39 #define INLINE inline
40
41 #define RETURN_BY_COMPLEX
42
43 #ifndef ASSEMBLER
44
45 static void INLINE blas_lock(volatile unsigned long *address){
46
47 }
48 #define BLAS_LOCK_DEFINED
49
50 static inline unsigned int rpcc(void){
51   unsigned long ret;
52
53   __asm__ __volatile__(".set   push    \n"
54           "rdhwr %0, $30  \n"
55           ".set pop" : "=r"(ret) : : "memory");
56
57   return ret;
58 }
59 #define RPCC_DEFINED
60
61 static inline int blas_quickdivide(blasint x, blasint y){
62   return x / y;
63 }
64
65 #define GET_IMAGE(res)
66
67 #define GET_IMAGE_CANCEL
68
69 #endif
70
71
72 #ifndef F_INTERFACE
73 #define REALNAME ASMNAME
74 #else
75 #define REALNAME ASMFNAME
76 #endif
77
78 #if defined(ASSEMBLER) && !defined(NEEDPARAM)
79
80 #define PROLOGUE \
81         .arm             ;\
82         .global REALNAME ;\
83 REALNAME:
84
85 #define EPILOGUE
86
87 #define PROFCODE
88
89 #endif
90
91
92 #define SEEK_ADDRESS
93
94 #ifndef PAGESIZE
95 #define PAGESIZE        ( 4 << 10)
96 #endif
97 #define HUGE_PAGESIZE   ( 4 << 20)
98
99 #define BUFFER_SIZE     (16 << 20)
100
101
102 #define BASE_ADDRESS (START_ADDRESS - BUFFER_SIZE * MAX_CPU_NUMBER)
103
104 #ifndef MAP_ANONYMOUS
105 #define MAP_ANONYMOUS MAP_ANON
106 #endif
107
108 #endif