xref: /aosp_15_r20/external/pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/src/requantization/runtime-sse2.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <immintrin.h>
12 
13 PYTORCH_QNNP_INLINE __m128i
sub_zero_point(const __m128i va,const __m128i vzp)14 sub_zero_point(const __m128i va, const __m128i vzp) {
15 #if PYTORCH_QNNPACK_RUNTIME_QUANTIZATION
16   // Run-time quantization
17   return _mm_sub_epi16(va, vzp);
18 #else
19   // Design-time quantization (no-op)
20   return va;
21 #endif
22 }
23