Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added checking and applying of clang-format #3

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
BasedOnStyle: LLVM
# SPDX-FileCopyrightText: 2023 Rivos Inc.
#
# SPDX-License-Identifier: Apache-2.0

BasedOnStyle: LLVM
4 changes: 4 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2023 Rivos Inc.
#
# SPDX-License-Identifier: Apache-2.0

Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming'
CheckOptions:
- key: readability-identifier-naming.ClassCase
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: 2023 Rivos Inc.
#
# SPDX-License-Identifier: Apache-2.0

name: Format checking

on: [push, pull_request]

permissions:
contents: read

jobs:
clang_formatting:
name: check_clang_format
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: true

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Packages
run: |
sudo apt update
sudo apt install -y clang-format
python -m pip install click

- name: Check Clang Format
run: |
set -euo pipefail
python tools/run-clang-format.py check

259 changes: 147 additions & 112 deletions include/rvvlm.h

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions include/rvvlm_expD.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
// SPDX-License-Identifier: Apache-2.0

// Macros for common small-block codes
#define EXCEPTION_HANDLING_EXP(vx, special_args, vy_special, vlen) { \
VUINT vclass = __riscv_vfclass((vx), (vlen)); \
IDENTIFY(vclass, class_NaN|class_Inf, (special_args), (vlen)) \
UINT nb_special_args = __riscv_vcpop((special_args), (vlen)); \
if (nb_special_args > 0) { \
/* Substitute -Inf with +0 */ \
VBOOL id_mask; \
IDENTIFY(vclass, class_negInf, id_mask, (vlen)) \
vx = __riscv_vfmerge(vx, fp_posZero, id_mask, (vlen)); \
vy_special = __riscv_vfadd((special_args), (vx), (vx), (vlen)); \
vx = __riscv_vfmerge((vx), fp_posZero, (special_args), (vlen)); \
} \
}
#define EXCEPTION_HANDLING_EXP(vx, special_args, vy_special, vlen) \
{ \
VUINT vclass = __riscv_vfclass((vx), (vlen)); \
IDENTIFY(vclass, class_NaN | class_Inf, (special_args), (vlen)) \
UINT nb_special_args = __riscv_vcpop((special_args), (vlen)); \
if (nb_special_args > 0) { \
/* Substitute -Inf with +0 */ \
VBOOL id_mask; \
IDENTIFY(vclass, class_negInf, id_mask, (vlen)) \
vx = __riscv_vfmerge(vx, fp_posZero, id_mask, (vlen)); \
vy_special = __riscv_vfadd((special_args), (vx), (vx), (vlen)); \
vx = __riscv_vfmerge((vx), fp_posZero, (special_args), (vlen)); \
} \
}

#define LOG2_INV 0x1.71547652b82fep+0
#define LOG2_HI 0x1.62e42fefa39efp-1
#define LOG2_LO 0x1.abc9e3b39803fp-56
#define LOG2_HI 0x1.62e42fefa39efp-1
#define LOG2_LO 0x1.abc9e3b39803fp-56

#define LOG2_INV_64 0x1.71547652b82fep+6
#define LOG2_BY64_HI 0x1.62e42fefa39efp-7
#define LOG2_BY64_LO 0x1.abc9e3b39803fp-62
#define LOG2_INV_64 0x1.71547652b82fep+6
#define LOG2_BY64_HI 0x1.62e42fefa39efp-7
#define LOG2_BY64_LO 0x1.abc9e3b39803fp-62

#define X_MAX 0x1.65p+9
#define X_MAX 0x1.65p+9
#define X_MIN -0x1.77p+9

Loading