1 // Auto-generated file. Do not edit! 2 // Template: src/cs16-vsquareabs/scalar.c.in 3 // Generator: tools/xngen 4 // 5 // Copyright 2022 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 #include <stddef.h> 12 #include <stdint.h> 13 14 #include <xnnpack/math.h> 15 #include <xnnpack/vsquareabs.h> 16 17 xnn_cs16_vsquareabs_ukernel__scalar_x1(size_t batch,const int16_t * input,uint32_t * output)18void xnn_cs16_vsquareabs_ukernel__scalar_x1( 19 size_t batch, 20 const int16_t* input, 21 uint32_t* output) { 22 23 assert(batch != 0); 24 assert(input != NULL); 25 assert(output != NULL); 26 27 28 if XNN_UNLIKELY(batch != 0) { 29 do { 30 const int32_t vr = (int32_t) input[0]; 31 const int32_t vi = (int32_t) input[1]; 32 input += 2; 33 34 const uint32_t vrsquare = (uint32_t) (vr * vr); 35 const uint32_t visquare = (uint32_t) (vi * vi); 36 37 const uint32_t vout = vrsquare + visquare; 38 39 *output++ = vout; 40 } while (--batch != 0); 41 } 42 } 43