Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 1 | // Auto-generated file. Do not edit! |
| 2 | // Template: src/f32-vbinary/vop-scalar.c.in |
| 3 | // Generator: tools/xngen |
| 4 | // |
| 5 | // Copyright 2019 Google LLC |
| 6 | // |
| 7 | // This source code is licensed under the BSD-style license found in the |
| 8 | // LICENSE file in the root directory of this source tree. |
| 9 | |
| 10 | #include <assert.h> |
| 11 | |
| 12 | #include <xnnpack/common.h> |
| 13 | #include <xnnpack/math.h> |
| 14 | #include <xnnpack/vbinary.h> |
| 15 | |
| 16 | |
| 17 | void xnn_f32_vmin_ukernel__scalar_x2( |
| 18 | size_t n, |
| 19 | const float* a, |
| 20 | const float* b, |
| 21 | float* y, |
Marat Dukhan | f196d01 | 2020-04-15 11:50:03 -0700 | [diff] [blame] | 22 | const union xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) |
Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 23 | { |
| 24 | assert(n != 0); |
| 25 | assert(n % sizeof(float) == 0); |
| 26 | |
Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 27 | |
| 28 | for (; n >= 2 * sizeof(float); n -= 2 * sizeof(float)) { |
| 29 | const float va0 = a[0]; |
| 30 | const float va1 = a[1]; |
| 31 | a += 2; |
| 32 | |
| 33 | const float vb0 = b[0]; |
| 34 | const float vb1 = b[1]; |
| 35 | b += 2; |
| 36 | |
| 37 | float vy0 = math_min_f32(va0, vb0); |
| 38 | float vy1 = math_min_f32(va1, vb1); |
| 39 | |
Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 40 | |
Marat Dukhan | 13bafb0 | 2020-06-05 00:43:11 -0700 | [diff] [blame] | 41 | |
Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 42 | y[0] = vy0; |
| 43 | y[1] = vy1; |
| 44 | y += 2; |
| 45 | } |
| 46 | if XNN_UNLIKELY(n != 0) { |
| 47 | const float va = *a; |
| 48 | const float vb = *b; |
| 49 | float vy = math_min_f32(va, vb); |
Marat Dukhan | 403b7d4 | 2019-12-05 12:49:11 -0800 | [diff] [blame] | 50 | *y = vy; |
| 51 | } |
| 52 | } |