refactor: move arch specific code to rpo folder, don't run SVE on CI

This commit is contained in:
Grzegorz Swirski 2023-09-24 22:23:38 +02:00
parent 701a187e7f
commit 01be4d6b9d
8 changed files with 8 additions and 45 deletions

View file

@ -39,7 +39,7 @@ jobs:
matrix:
toolchain: [stable, nightly]
os: [ubuntu]
features: [--all-features, --no-default-features]
features: ["--features default,std,serde", --no-default-features]
steps:
- uses: actions/checkout@main
- name: Install rust
@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
features: [--all-features, --no-default-features]
features: ["--features default,std,serde", --no-default-features]
steps:
- uses: actions/checkout@main
- name: Install minimal nightly with clippy

View file

@ -35,8 +35,8 @@ repos:
name: Cargo check --all-targets --no-default-features
args: ["+stable", "check", "--all-targets", "--no-default-features"]
- id: cargo
name: Cargo check --all-targets --all-features
args: ["+stable", "check", "--all-targets", "--all-features"]
name: Cargo check --all-targets --features default,std,serde
args: ["+stable", "check", "--all-targets", "--features", "default,std,serde"]
# Unlike fmt, clippy will not be automatically applied
- id: cargo
name: Cargo clippy

View file

@ -1,10 +0,0 @@
cmake_minimum_required(VERSION 3.0)
project(rpo_sve C)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+sve -Wall -Wextra -pedantic -g -O3")
add_library(rpo_sve library.c rpo_hash.h)
add_executable(rpo_test test.c)
target_link_libraries(rpo_test rpo_sve)

View file

@ -1,27 +0,0 @@
#include <stdio.h>
#include "library.h"
void print_array(size_t len, uint64_t arr[len]);
int main() {
uint64_t C[STATE_WIDTH] = {1, 1, 1, 1 ,1, 1, 1, 1 ,1, 1, 1, 1};
uint64_t T[STATE_WIDTH] = {1, 2, 3, 4, 1, 2, 3, 4,1, 2, 3, 4};
add_constants_and_apply_sbox(T, C);
add_constants_and_apply_inv_sbox(T, C);
print_array(STATE_WIDTH, T);
return 0;
}
void print_array(size_t len, uint64_t arr[len])
{
printf("[");
for (size_t i = 0; i < len; i++)
{
printf("%lu ", arr[i]);
}
printf("]\n");
}

View file

@ -5,12 +5,12 @@ fn main() {
#[cfg(feature = "arch-arm64-sve")]
fn compile_arch_arm64_sve() {
println!("cargo:rerun-if-changed=arch/arm64-sve/library.c");
println!("cargo:rerun-if-changed=arch/arm64-sve/library.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo_hash.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/library.c");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/library.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/rpo_hash.h");
cc::Build::new()
.file("arch/arm64-sve/library.c")
.file("arch/arm64-sve/rpo/library.c")
.flag("-march=armv8-a+sve")
.flag("-O3")
.compile("rpo_sve");