feat(concrete-cpu): m1 support

This commit is contained in:
Mayeul@Zama
2023-03-08 11:04:18 +01:00
committed by Quentin Bourgerie
parent e019f0d01d
commit 2a3a0907d8
3 changed files with 63 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ on:
env:
CARGO_TERM_COLOR: always
jobs:
tests:
tests-linux:
runs-on: ubuntu-20.04
env:
RUSTFLAGS: -D warnings
@@ -60,3 +60,63 @@ jobs:
run: |
cd backends/concrete-cpu/test
make test
tests-mac_x86:
runs-on: macos-11
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Download cargo cache
uses: Swatinem/rust-cache@v2
- name: Tests
run: |
cd backends/concrete-cpu
cargo test --no-fail-fast --all-targets
- name: Zig install
run: |
brew install zig
- name: Zig test
run: |
cd backends/concrete-cpu/test
make test
tests-mac-m1:
runs-on: m1mac
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Download cargo cache
uses: Swatinem/rust-cache@v2
- name: Tests
run: |
cd backends/concrete-cpu
cargo test --no-fail-fast --all-targets
- name: Zig install
run: |
brew install zig
- name: Zig test
run: |
cd backends/concrete-cpu/test
make test

View File

@@ -68,6 +68,7 @@ pub unsafe extern "C" fn concrete_cpu_destroy_concrete_csprng(mem: *mut Csprng)
// Returns 1 if the random is crypto secure, -1 if it not secure, 0 if fail.
#[no_mangle]
pub unsafe extern "C" fn concrete_cpu_crypto_secure_random_128(u128: *mut Uint128) -> c_int {
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
if is_x86_feature_detected!("rdseed") {
let mut rand: u64 = 0;
loop {

View File

@@ -10,6 +10,7 @@ use core::mem::MaybeUninit;
use dyn_stack::{DynStack, SizeOverflow, StackReq};
use pulp::{as_arrays, as_arrays_mut};
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
pub mod x86;
fn convert_forward_integer_u64_scalar(