Coverage Report

Created: 2026-06-11 06:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/xnnpack/src/f32-dwconv/gen/f32-dwconv-3p1c-minmax-scalar-acc2.c
Line
Count
Source
1
// clang-format off
2
// Auto-generated file. Do not edit!
3
//   Template: src/f32-dwconv/unipass-scalar.c.in
4
//   Generator: tools/xngen
5
//
6
// Copyright 2019 Google LLC
7
//
8
// This source code is licensed under the BSD-style license found in the
9
// LICENSE file in the root directory of this source tree.
10
11
#include <assert.h>
12
#include <stddef.h>
13
#include <stdint.h>
14
15
#include "src/xnnpack/common.h"
16
#include "src/xnnpack/dwconv.h"
17
#include "src/xnnpack/math.h"
18
#include "src/xnnpack/microparams.h"
19
20
21
void xnn_f32_dwconv_minmax_ukernel_3p1c__scalar_acc2(
22
    size_t channels,
23
    size_t output_width,
24
    const float** input,
25
    const float* weights,
26
    float* output,
27
    intptr_t input_stride,
28
    size_t output_increment,
29
    size_t input_offset,
30
    size_t input_pixel_stride,
31
    const float* zero,
32
    const struct xnn_f32_minmax_params* restrict params)
33
0
{
34
0
  assert(channels != 0);
35
0
  assert(output_width != 0);
36
37
0
  const float vmin = params->scalar.min;
38
0
  const float vmax = params->scalar.max;
39
0
  do {
40
0
    const float* i0 = input[0];
41
0
    assert(i0 != NULL);
42
0
    if XNN_UNPREDICTABLE(i0 != zero) {
43
0
      i0 = (const float*) ((uintptr_t) i0 + input_offset);
44
0
    }
45
0
    const float* i1 = input[1];
46
0
    assert(i1 != NULL);
47
0
    if XNN_UNPREDICTABLE(i1 != zero) {
48
0
      i1 = (const float*) ((uintptr_t) i1 + input_offset);
49
0
    }
50
0
    const float* i2 = input[2];
51
0
    assert(i2 != NULL);
52
0
    if XNN_UNPREDICTABLE(i2 != zero) {
53
0
      i2 = (const float*) ((uintptr_t) i2 + input_offset);
54
0
    }
55
0
    input = (const float**) ((uintptr_t) input + input_stride);
56
57
0
    size_t c = channels;
58
0
    const float* w = weights;
59
0
    do {
60
0
      float vacc0p0 = w[0];
61
62
0
      const float vi0 = *i0++;
63
0
      const float vk0 = w[1];
64
0
      vacc0p0 = math_muladd_f32(vi0, vk0, vacc0p0);
65
66
0
      const float vi1 = *i1++;
67
0
      const float vk1 = w[2];
68
0
      float vacc0p1 = vi1 * vk1;
69
70
0
      const float vi2 = *i2++;
71
0
      const float vk2 = w[3];
72
0
      vacc0p0 = math_muladd_f32(vi2, vk2, vacc0p0);
73
74
0
      w += 4;
75
76
0
      vacc0p0 += vacc0p1;
77
78
0
      float vacc0 = math_max_f32(vacc0p0, vmin);
79
0
      vacc0 = math_min_f32(vacc0, vmax);
80
0
      *output++ = vacc0;
81
0
    } while (--c != 0);
82
83
0
    input_offset += input_pixel_stride;
84
0
    output = (float*) ((uintptr_t) output + output_increment);
85
0
  } while (--output_width != 0);
86
0
}