| 1 |
// Auto-generated file. Do not edit! |
| 2 |
// Template: src/f32-vcmul/scalar.c.in |
| 3 |
// Generator: tools/xngen |
| 4 |
// |
| 5 |
// Copyright 2023 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_vcmul_ukernel__scalar_u1( |
| 18 |
size_t batch, |
| 19 |
const float* input_a, |
| 20 |
const float* input_b, |
| 21 |
float* output, |
| 22 |
const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) |
| 23 |
{ |
| 24 |
assert(batch != 0); |
| 25 |
assert(batch % sizeof(float) == 0); |
| 26 |
assert(input_a != NULL); |
| 27 |
assert(input_b != NULL); |
| 28 |
assert(output != NULL); |
| 29 |
|
| 30 |
const float* ar = input_a; |
| 31 |
const float* ai = (const float*) ((uintptr_t) input_a + batch); |
| 32 |
const float* br = input_b; |
| 33 |
const float* bi = (const float*) ((uintptr_t) input_b + batch); |
| 34 |
float* or = output; |
| 35 |
float* oi = (float*) ((uintptr_t) output + batch); |
| 36 |
for (; batch >= sizeof(float); batch -= sizeof(float)) { |
| 37 |
const float var = *ar++; |
| 38 |
const float vai = *ai++; |
| 39 |
const float vbr = *br++; |
| 40 |
const float vbi = *bi++; |
| 41 |
const float vaccr = var * vbr - vai * vbi; |
| 42 |
const float vacci = var * vbi + vai * vbr; |
| 43 |
*or++ = vaccr; |
| 44 |
*oi++ = vacci; |
| 45 |
} |
| 46 |
} |