Coverage Report

Created: 2025-09-12 10:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/contrib/openblas/interface/imax.c
Line
Count
Source
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 IQAMAX_K
55
#elif defined(DOUBLE)
56
#define MAX_K IDAMAX_K
57
#else
58
0
#define MAX_K ISAMAX_K
59
#endif
60
#else
61
#ifdef XDOUBLE
62
#define MAX_K IXAMAX_K
63
#elif defined(DOUBLE)
64
#define MAX_K IZAMAX_K
65
#else
66
#define MAX_K ICAMAX_K
67
#endif
68
#endif
69
70
#else
71
72
/* ABS & MIN */
73
#ifndef COMPLEX
74
#ifdef XDOUBLE
75
#define MAX_K IQAMIN_K
76
#elif defined(DOUBLE)
77
#define MAX_K IDAMIN_K
78
#else
79
#define MAX_K ISAMIN_K
80
#endif
81
#else
82
#ifdef XDOUBLE
83
#define MAX_K IXAMIN_K
84
#elif defined(DOUBLE)
85
#define MAX_K IZAMIN_K
86
#else
87
#define MAX_K ICAMIN_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 IQMAX_K
100
#elif defined(DOUBLE)
101
#define MAX_K IDMAX_K
102
#else
103
#define MAX_K ISMAX_K
104
#endif
105
106
#else
107
108
/* MIN */
109
#ifdef XDOUBLE
110
#define MAX_K IQMIN_K
111
#elif defined(DOUBLE)
112
#define MAX_K IDMIN_K
113
#else
114
#define MAX_K ISMIN_K
115
#endif
116
117
#endif
118
119
#endif
120
121
#ifndef CBLAS
122
123
0
blasint NAME(blasint *N, FLOAT *x, blasint *INCX){
124
125
0
  BLASLONG n    = *N;
126
0
  BLASLONG incx = *INCX;
127
0
  blasint ret;
128
129
0
  PRINT_DEBUG_NAME;
130
131
0
  if (n <= 0) return 0;
132
133
0
  IDEBUG_START;
134
135
0
  FUNCTION_PROFILE_START();
136
137
0
  ret = (blasint)MAX_K(n, x, incx);
138
139
0
  if(ret > n) ret=n;
140
141
0
  FUNCTION_PROFILE_END(COMPSIZE, n, 0);
142
143
0
  IDEBUG_END;
144
145
0
  return ret;
146
0
}
147
148
#else
149
#ifdef COMPLEX
150
CBLAS_INDEX CNAME(blasint n, void *vx, blasint incx){
151
  FLOAT *x = (FLOAT*) vx;
152
#else
153
CBLAS_INDEX CNAME(blasint n, FLOAT *x, blasint incx){
154
#endif
155
156
  CBLAS_INDEX ret;
157
158
  PRINT_DEBUG_CNAME;
159
160
  if (n <= 0) return 0;
161
162
  IDEBUG_START;
163
164
  FUNCTION_PROFILE_START();
165
166
  ret = MAX_K(n, x, incx);
167
168
  if (ret > n) ret=n;
169
170
  if (ret) ret --;
171
172
  FUNCTION_PROFILE_END(COMPSIZE, n, 0);
173
174
  IDEBUG_END;
175
176
  return ret;
177
}
178
179
#endif