Skip to content

Commit

Permalink
Merge remote-tracking branch 'ciel/master' into fixMingwBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
cielavenir committed Nov 8, 2024
2 parents aac0917 + 496255c commit 3ee7e40
Show file tree
Hide file tree
Showing 139 changed files with 39,762 additions and 44,461 deletions.
46 changes: 46 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2024, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BasedOnStyle: LLVM
IndentWidth: 8
Language: Cpp
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
UseTab: Never
AlignConsecutiveMacros: true
AlignTrailingComments: true
AlwaysBreakAfterReturnType: All
SortIncludes: false
BreakBeforeInheritanceComma: true
AllowAllParametersOfDeclarationOnNextLine: false
BinPackParameters: true
BinPackArguments: true
ReflowComments: true
ColumnLimit: 100
Cpp11BracedListStyle: false
MaxEmptyLinesToKeep: 1
ContinuationIndentWidth: 8
SpaceAfterCStyleCast: true
3 changes: 3 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include/aarch64_multibinary.h
include/aarch64_label.h
**/aarch64/*.h
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ permissions:

jobs:
check_format:
env:
CLANGFORMAT: clang-format-18
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 2
- name: Install indent
run: sudo apt install indent
- name: Install clang-format-18
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt install -y clang-format-18
- name: Run format check
run: bash tools/check_format.sh

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ patches, file issues, and ask questions on our [mailing list].

## Coding Style

The coding style for ISA-L C code roughly follows linux kernel guidelines. Use
the included indent script to format C code.
The coding style for ISA-L C code is roughly based on LLVM style with
some customizations. Use the included format script to format C code.

./tools/iindent your_files.c
./tools/format.sh

And use check format script before submitting.

Expand Down
10 changes: 6 additions & 4 deletions crc/aarch64/crc64_rocksoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
#include "crc64.h"
#include <stdint.h>

uint64_t crc64_rocksoft_refl(uint64_t seed, const uint8_t * buf, uint64_t len)
uint64_t
crc64_rocksoft_refl(uint64_t seed, const uint8_t *buf, uint64_t len)
{
return crc64_rocksoft_refl_base(seed, buf, len);
return crc64_rocksoft_refl_base(seed, buf, len);
}

uint64_t crc64_rocksoft_norm(uint64_t seed, const uint8_t * buf, uint64_t len)
uint64_t
crc64_rocksoft_norm(uint64_t seed, const uint8_t *buf, uint64_t len)
{
return crc64_rocksoft_norm_base(seed, buf, len);
return crc64_rocksoft_norm_base(seed, buf, len);
}
205 changes: 97 additions & 108 deletions crc/aarch64/crc_aarch64_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,185 +31,174 @@
DEFINE_INTERFACE_DISPATCHER(crc16_t10dif)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc16_t10dif_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc16_t10dif_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc16_t10dif_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc16_t10dif_pmull);
#endif
return PROVIDER_BASIC(crc16_t10dif);

return PROVIDER_BASIC(crc16_t10dif);
}

DEFINE_INTERFACE_DISPATCHER(crc16_t10dif_copy)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc16_t10dif_copy_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc16_t10dif_copy_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc16_t10dif_copy_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc16_t10dif_copy_pmull);
#endif
return PROVIDER_BASIC(crc16_t10dif_copy);

return PROVIDER_BASIC(crc16_t10dif_copy);
}

DEFINE_INTERFACE_DISPATCHER(crc32_ieee)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL) {
return PROVIDER_INFO(crc32_ieee_norm_pmull);
}
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL) {
return PROVIDER_INFO(crc32_ieee_norm_pmull);
}
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_ieee_norm_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_ieee_norm_pmull);
#endif
return PROVIDER_BASIC(crc32_ieee);

return PROVIDER_BASIC(crc32_ieee);
}

DEFINE_INTERFACE_DISPATCHER(crc32_iscsi)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_CRC32) {
switch (get_micro_arch_id()) {
case MICRO_ARCH_ID(ARM, NEOVERSE_N1):
case MICRO_ARCH_ID(ARM, CORTEX_A57):
case MICRO_ARCH_ID(ARM, CORTEX_A72):
return PROVIDER_INFO(crc32_iscsi_crc_ext);
}
}
if ((HWCAP_CRC32 | HWCAP_PMULL) == (auxval & (HWCAP_CRC32 | HWCAP_PMULL))) {
return PROVIDER_INFO(crc32_iscsi_3crc_fold);
}

if (auxval & HWCAP_PMULL) {
return PROVIDER_INFO(crc32_iscsi_refl_pmull);
}
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_CRC32) {
switch (get_micro_arch_id()) {
case MICRO_ARCH_ID(ARM, NEOVERSE_N1):
case MICRO_ARCH_ID(ARM, CORTEX_A57):
case MICRO_ARCH_ID(ARM, CORTEX_A72):
return PROVIDER_INFO(crc32_iscsi_crc_ext);
}
}
if ((HWCAP_CRC32 | HWCAP_PMULL) == (auxval & (HWCAP_CRC32 | HWCAP_PMULL))) {
return PROVIDER_INFO(crc32_iscsi_3crc_fold);
}

if (auxval & HWCAP_PMULL) {
return PROVIDER_INFO(crc32_iscsi_refl_pmull);
}
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_CRC32_KEY))
return PROVIDER_INFO(crc32_iscsi_3crc_fold);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_iscsi_refl_pmull);
if (sysctlEnabled(SYSCTL_CRC32_KEY))
return PROVIDER_INFO(crc32_iscsi_3crc_fold);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_iscsi_refl_pmull);
#endif
return PROVIDER_BASIC(crc32_iscsi);

return PROVIDER_BASIC(crc32_iscsi);
}

DEFINE_INTERFACE_DISPATCHER(crc32_gzip_refl)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);

if (auxval & HWCAP_CRC32) {
switch (get_micro_arch_id()) {
case MICRO_ARCH_ID(ARM, NEOVERSE_N1):
case MICRO_ARCH_ID(ARM, CORTEX_A57):
case MICRO_ARCH_ID(ARM, CORTEX_A72):
return PROVIDER_INFO(crc32_gzip_refl_crc_ext);
}
}
if ((HWCAP_CRC32 | HWCAP_PMULL) == (auxval & (HWCAP_CRC32 | HWCAP_PMULL))) {
return PROVIDER_INFO(crc32_gzip_refl_3crc_fold);
}

if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc32_gzip_refl_pmull);
unsigned long auxval = getauxval(AT_HWCAP);

if (auxval & HWCAP_CRC32) {
switch (get_micro_arch_id()) {
case MICRO_ARCH_ID(ARM, NEOVERSE_N1):
case MICRO_ARCH_ID(ARM, CORTEX_A57):
case MICRO_ARCH_ID(ARM, CORTEX_A72):
return PROVIDER_INFO(crc32_gzip_refl_crc_ext);
}
}
if ((HWCAP_CRC32 | HWCAP_PMULL) == (auxval & (HWCAP_CRC32 | HWCAP_PMULL))) {
return PROVIDER_INFO(crc32_gzip_refl_3crc_fold);
}

if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc32_gzip_refl_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_CRC32_KEY))
return PROVIDER_INFO(crc32_gzip_refl_3crc_fold);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_gzip_refl_pmull);
if (sysctlEnabled(SYSCTL_CRC32_KEY))
return PROVIDER_INFO(crc32_gzip_refl_3crc_fold);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc32_gzip_refl_pmull);
#endif
return PROVIDER_BASIC(crc32_gzip_refl);

return PROVIDER_BASIC(crc32_gzip_refl);
}

DEFINE_INTERFACE_DISPATCHER(crc64_ecma_refl)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
unsigned long auxval = getauxval(AT_HWCAP);

if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_ecma_refl_pmull);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_ecma_refl_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_ecma_refl_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_ecma_refl_pmull);
#endif
return PROVIDER_BASIC(crc64_ecma_refl);

return PROVIDER_BASIC(crc64_ecma_refl);
}

DEFINE_INTERFACE_DISPATCHER(crc64_ecma_norm)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_ecma_norm_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_ecma_norm_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_ecma_norm_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_ecma_norm_pmull);
#endif
return PROVIDER_BASIC(crc64_ecma_norm);

return PROVIDER_BASIC(crc64_ecma_norm);
}

DEFINE_INTERFACE_DISPATCHER(crc64_iso_refl)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_iso_refl_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_iso_refl_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_iso_refl_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_iso_refl_pmull);
#endif
return PROVIDER_BASIC(crc64_iso_refl);

return PROVIDER_BASIC(crc64_iso_refl);
}

DEFINE_INTERFACE_DISPATCHER(crc64_iso_norm)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_iso_norm_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_iso_norm_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_iso_norm_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_iso_norm_pmull);
#endif
return PROVIDER_BASIC(crc64_iso_norm);

return PROVIDER_BASIC(crc64_iso_norm);
}

DEFINE_INTERFACE_DISPATCHER(crc64_jones_refl)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_jones_refl_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_jones_refl_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_jones_refl_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_jones_refl_pmull);
#endif
return PROVIDER_BASIC(crc64_jones_refl);

return PROVIDER_BASIC(crc64_jones_refl);
}

DEFINE_INTERFACE_DISPATCHER(crc64_jones_norm)
{
#if defined(__linux__)
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_jones_norm_pmull);
unsigned long auxval = getauxval(AT_HWCAP);
if (auxval & HWCAP_PMULL)
return PROVIDER_INFO(crc64_jones_norm_pmull);
#elif defined(__APPLE__)
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_jones_norm_pmull);
if (sysctlEnabled(SYSCTL_PMULL_KEY))
return PROVIDER_INFO(crc64_jones_norm_pmull);
#endif
return PROVIDER_BASIC(crc64_jones_norm);

return PROVIDER_BASIC(crc64_jones_norm);
}
Loading

0 comments on commit 3ee7e40

Please sign in to comment.