Add CPUID identification of Intel Ice Lake
[platform/upstream/openblas.git] / interface / max.c
1 /*********************************************************************/
2 /* Copyright 2009, 2010 The University of Texas at Austin.           */
3 /* All rights reserved.                                              */
4 /*                                                                   */
5 /* Redistribution and use in source and binary forms, with or        */
6 /* without modification, are permitted provided that the following   */
7 /* conditions are met:                                               */
8 /*                                                                   */
9 /*   1. Redistributions of source code must retain the above         */
10 /*      copyright notice, this list of conditions and the following  */
11 /*      disclaimer.                                                  */
12 /*                                                                   */
13 /*   2. Redistributions in binary form must reproduce the above      */
14 /*      copyright notice, this list of conditions and the following  */
15 /*      disclaimer in the documentation and/or other materials       */
16 /*      provided with the distribution.                              */
17 /*                                                                   */
18 /*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
19 /*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
20 /*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
21 /*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
22 /*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
23 /*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
24 /*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
25 /*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
26 /*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
27 /*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
28 /*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
29 /*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
30 /*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
31 /*    POSSIBILITY OF SUCH DAMAGE.                                    */
32 /*                                                                   */
33 /* The views and conclusions contained in the software and           */
34 /* documentation are those of the authors and should not be          */
35 /* interpreted as representing official policies, either expressed   */
36 /* or implied, of The University of Texas at Austin.                 */
37 /*********************************************************************/
38
39 #include <stdio.h>
40 #include "common.h"
41 #ifdef FUNCTION_PROFILE
42 #include "functable.h"
43 #endif
44
45 #undef MAX_K
46
47 #ifdef USE_ABS
48
49 #ifndef USE_MIN
50
51 /* ABS & MAX */
52 #ifndef COMPLEX
53 #ifdef XDOUBLE
54 #define MAX_K   QAMAX_K
55 #elif defined(DOUBLE)
56 #define MAX_K   DAMAX_K
57 #else
58 #define MAX_K   SAMAX_K
59 #endif
60 #else
61 #ifdef XDOUBLE
62 #define MAX_K   XAMAX_K
63 #elif defined(DOUBLE)
64 #define MAX_K   ZAMAX_K
65 #else
66 #define MAX_K   CAMAX_K
67 #endif
68 #endif
69
70 #else
71
72 /* ABS & MIN */
73 #ifndef COMPLEX
74 #ifdef XDOUBLE
75 #define MAX_K   QAMIN_K
76 #elif defined(DOUBLE)
77 #define MAX_K   DAMIN_K
78 #else
79 #define MAX_K   SAMIN_K
80 #endif
81 #else
82 #ifdef XDOUBLE
83 #define MAX_K   XAMIN_K
84 #elif defined(DOUBLE)
85 #define MAX_K   ZAMIN_K
86 #else
87 #define MAX_K   CAMIN_K
88 #endif
89 #endif
90
91 #endif
92
93 #else
94
95 #ifndef USE_MIN
96
97 /* MAX */
98 #ifdef XDOUBLE
99 #define MAX_K   QMAX_K
100 #elif defined(DOUBLE)
101 #define MAX_K   DMAX_K
102 #else
103 #define MAX_K   SMAX_K
104 #endif
105
106 #else
107
108 /* MIN */
109 #ifdef XDOUBLE
110 #define MAX_K   QMIN_K
111 #elif defined(DOUBLE)
112 #define MAX_K   DMIN_K
113 #else
114 #define MAX_K   SMIN_K
115 #endif
116
117 #endif
118
119 #endif
120
121 #ifndef CBLAS
122
123 FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
124
125   BLASLONG n    = *N;
126   BLASLONG incx = *INCX;
127   FLOATRET ret;
128
129   PRINT_DEBUG_NAME;
130
131   if (n <= 0) return 0;
132
133   IDEBUG_START;
134
135   FUNCTION_PROFILE_START();
136
137   ret = (FLOATRET)MAX_K(n, x, incx);
138
139   FUNCTION_PROFILE_END(COMPSIZE, n, 0);
140
141   IDEBUG_END;
142
143   return ret;
144 }
145
146 #else
147
148 FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
149
150   FLOAT ret;
151
152   PRINT_DEBUG_CNAME;
153
154   if (n <= 0) return 0;
155
156   IDEBUG_START;
157
158   FUNCTION_PROFILE_START();
159
160   ret = MAX_K(n, x, incx);
161
162   FUNCTION_PROFILE_END(COMPSIZE, n, 0);
163
164   IDEBUG_END;
165
166   return ret;
167 }
168
169 #endif