Skip to content

Commit

Permalink
Add A32 support in CI
Browse files Browse the repository at this point in the history
Add A32 support in CI.

Choose Cortex-A32 as test target because it only supports
AArch32. Moreover, Cortex-A32 has Armv8-A Cryptographic Extension,
which is an ideal target for testing Cryptographic Extension conversions.
  • Loading branch information
Cuda-Chen committed Nov 27, 2023
1 parent 0d6e9b3 commit 4134dec
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
arch_with_features: [{arch: armv7, feature: none}, {arch: aarch64, feature: none}, {arch: aarch64, feature: crypto+crc}]
arch_with_features: [
{arch: armv7, feature: none, arch_cflags: none},
{arch: aarch64, feature: none, arch_cflags: none},
{arch: aarch64, feature: crypto+crc, arch_cflags: none},
{arch: armv7, feature: none, arch_cflags: '-mcpu=cortex-a32 -mfpu=neon-fp-armv8'}
]
cxx_compiler: [g++-10, clang++-11]
steps:
- name: checkout code
Expand All @@ -69,6 +74,7 @@ jobs:
distro: ubuntu20.04
env: |
CXX: ${{ matrix.cxx_compiler }}
ARCH_CFLAGS: ${{ matrix.arch_with_features.arch_cflags }}
install: |
apt-get update -q -y
apt-get install -q -y "${{ matrix.cxx_compiler }}" make
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@ EXEC_WRAPPER = qemu-$(processor)
endif

# Follow platform-specific configurations
ifeq ($(processor),$(filter $(processor),aarch64 arm64))
ARCH_CFLAGS = -march=armv8-a+fp+simd
else ifeq ($(processor),$(filter $(processor),i386 x86_64))
ARCH_CFLAGS = -maes -mpclmul -mssse3 -msse4.2
else ifeq ($(processor),$(filter $(processor),arm armv7 armv7l))
ARCH_CFLAGS = -mfpu=neon
else
$(error Unsupported architecture)
ARCH_CFLAGS ?=
ARCH_CFLAGS_IS_SET =
ifeq ($(ARCH_CFLAGS),)
ARCH_CFLAGS_IS_SET = true
endif
ifeq ($(ARCH_CFLAGS),none)
ARCH_CFLAGS_IS_SET = true
endif
ifdef ARCH_CFLAGS_IS_SET
ifeq ($(processor),$(filter $(processor),aarch64 arm64))
override ARCH_CFLAGS := -march=armv8-a+fp+simd
else ifeq ($(processor),$(filter $(processor),i386 x86_64))
override ARCH_CFLAGS := -maes -mpclmul -mssse3 -msse4.2
else ifeq ($(processor),$(filter $(processor),arm armv7 armv7l))
override ARCH_CFLAGS := -mfpu=neon
else
$(error Unsupported architecture)
endif
endif

FEATURE ?=
Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,38 @@ The following command enable `crypto` and `crc` features in the tests.
$ make FEATURE=crypto+crc check
```

You can specify GNU toolchain for cross compilation as well.
For running check on certain CPU, setting the mode of FPU, etc.,
you can also assign the desired options with `ARCH_CFLAGS` command.
If `none` is assigned, the command acts as same as calling `make check`.
For instance, to run tests on Cortex-A53 with enabling ARM VFPv4 extension and NEON:
```
$ make ARCH_CFLAGS="-mcpu=cortex-a53 -mfpu=neon-vfpv4" check
```

### Running tests on hosts other than ARM platform

For running tests on hosts other than ARM platform,
you can specify GNU toolchain for cross compilation with `CROSS_COMPILE` command.
[QEMU](https://www.qemu.org/) should be installed in advance.

For ARMv8-A running in 64-bit mode type:
```shell
$ make CROSS_COMPILE=aarch64-linux-gnu- check # ARMv8-A
```
or

For ARMv7-A type:
```shell
$ make CROSS_COMPILE=arm-linux-gnueabihf- check # ARMv7-A
```

For ARMv8-A running in 32-bit mode (A32 instruction set) type:
```shell
$ make \
CROSS_COMPILE=arm-linux-gnueabihf- \
ARCH_CFLAGS="-mcpu=cortex-a32 -mfpu=neon-fp-armv8" \
check
```

Check the details via [Test Suite for SSE2NEON](tests/README.md).

## Adoptions
Expand Down

0 comments on commit 4134dec

Please sign in to comment.