1 | /* |
2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | * All rights reserved. |
4 | * This source code is licensed under the BSD-style license found in the |
5 | * LICENSE file in the root directory of this source tree. |
6 | */ |
7 | #include "./GenerateKernel.h" |
8 | |
9 | namespace fbgemm { |
10 | |
11 | namespace x86 = asmjit::x86; |
12 | |
13 | /** |
14 | * Generate instructions for initializing the C registers to 0 in 32-bit |
15 | * Accumulation kernel. |
16 | */ |
17 | void initCRegs(x86::Emitter* a, int rowRegs, int colRegs) { |
18 | using CRegs = x86::Xmm; |
19 | // Take advantage of implicit zeroing out |
20 | // i.e., zero out xmm and ymm will be zeroed out too |
21 | for (int i = 0; i < rowRegs; ++i) { |
22 | for (int j = 0; j < colRegs; ++j) { |
23 | a->vpxor( |
24 | CRegs(i * colRegs + j), |
25 | CRegs(i * colRegs + j), |
26 | CRegs(i * colRegs + j)); |
27 | } |
28 | } |
29 | } |
30 | |
31 | } // namespace fbgemm |
32 | |