From 2cd534609dceb9a009f81ffe7a99bd8d87e75f06 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 11:15:29 -0400 Subject: [PATCH 01/10] Add arm64 to CI. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 030d05f3..bfc8e449 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ addons: script: - cargo build - cargo test + - cargo build --target aarch64-unknown-linux-gnu env: global: - HARFBUZZ_SYS_NO_PKG_CONFIG=true From 22bab4f1e94e4fb555f1e91d55faae730267dcc2 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 11:26:41 -0400 Subject: [PATCH 02/10] Add arm64 target with rustup. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bfc8e449..3f131f8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ addons: script: - cargo build - cargo test + - rustup target add aarch64-unknown-linux-gnu - cargo build --target aarch64-unknown-linux-gnu env: global: From a4c9b7ea3d9244c5b0c1cb15c5736e67dc80fe5b Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 11:39:00 -0400 Subject: [PATCH 03/10] Only build certain crates. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3f131f8d..ba7802b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,9 @@ script: - cargo build - cargo test - rustup target add aarch64-unknown-linux-gnu + - cd simd + - cargo build --target aarch64-unknown-linux-gnu + - cd ../geometry - cargo build --target aarch64-unknown-linux-gnu env: global: From fe80bad31b0d0a07419f0532921c6014a390cf1f Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 11:53:50 -0400 Subject: [PATCH 04/10] Build with nightly on CI. --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba7802b4..bb108037 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: rust +rust: + - nightly + - stable addons: apt: packages: @@ -7,13 +10,14 @@ addons: - libsdl2-dev - cmake script: - - cargo build - - cargo test - - rustup target add aarch64-unknown-linux-gnu - cd simd - cargo build --target aarch64-unknown-linux-gnu - cd ../geometry - cargo build --target aarch64-unknown-linux-gnu + - cd .. + - cargo build + - cargo test + - rustup target add aarch64-unknown-linux-gnu env: global: - HARFBUZZ_SYS_NO_PKG_CONFIG=true From b28e04a22d06144c7b1a2751b2570cc46a705cb3 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 12:06:26 -0400 Subject: [PATCH 05/10] Install rustup target before building. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bb108037..612f820a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ addons: - libsdl2-dev - cmake script: + - rustup target add aarch64-unknown-linux-gnu - cd simd - cargo build --target aarch64-unknown-linux-gnu - cd ../geometry @@ -17,7 +18,6 @@ script: - cd .. - cargo build - cargo test - - rustup target add aarch64-unknown-linux-gnu env: global: - HARFBUZZ_SYS_NO_PKG_CONFIG=true From f2b668f9d784779c36d5529b08b9c46b5ad1aa1c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 12:28:37 -0400 Subject: [PATCH 06/10] Add missing import. --- simd/src/arm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index 28699d57..7fb7719c 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -13,7 +13,7 @@ use std::arch::aarch64::{uint32x2_t, uint32x4_t}; use std::f32; use std::fmt::{self, Debug, Formatter}; use std::mem; -use std::ops::{Add, BitAnd, BitOr, Index, IndexMut, Mul, Shr, Sub}; +use std::ops::{Add, BitAnd, BitOr, Div, Index, IndexMut, Mul, Shr, Sub}; mod swizzle_f32x4; mod swizzle_i32x4; From db205f71d613d68efc262a1b73be252c6af4e5d8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 12:31:28 -0400 Subject: [PATCH 07/10] Fix incorrect cast ordering in arm simd. --- simd/src/arm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index 7fb7719c..8a111ccf 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -332,7 +332,7 @@ impl F32x4 { /// Converts these packed floats to integers via rounding. #[inline] pub fn to_i32x4(self) -> I32x4 { - unsafe { I32x4(round_v4f32(simd_cast(self.0))) } + unsafe { I32x4(simd_cast(round_v4f32(self.0))) } } } From e87b330123de68f19198a6d1647e567456766290 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 12:42:28 -0400 Subject: [PATCH 08/10] Add min/max to i32x2. --- simd/src/arm/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index 8a111ccf..f9db6674 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -445,6 +445,18 @@ impl I32x2 { unsafe { U32x2(simd_eq(self.0, other.0)) } } + // Basic operations + + #[inline] + pub fn max(self, other: I32x2) -> I32x2 { + self.to_i32x4().max(other.to_i32x4()).xy() + } + + #[inline] + pub fn min(self, other: I32x2) -> I32x2 { + self.to_i32x4().min(other.to_i32x4()).xy() + } + // Concatenations #[inline] @@ -459,6 +471,11 @@ impl I32x2 { pub fn to_f32x2(self) -> F32x2 { unsafe { F32x2(simd_cast(self.0)) } } + + #[inline] + pub fn to_i32x4(self) -> I32x4 { + self.concat_xy_xy(I32x2::default()) + } } impl Default for I32x2 { From 43adc9c24ac4dc296f2de22f0e4dc347df15ff2a Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 15:35:03 -0400 Subject: [PATCH 09/10] Fix arm I32x4 min/max operations that require on floating point values. --- simd/src/arm/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index f9db6674..3fa5c7da 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -559,12 +559,12 @@ impl I32x4 { #[inline] pub fn max(self, other: I32x4) -> I32x4 { - unsafe { I32x4(simd_fmax(self.0, other.0)) } + unsafe { I32x4(simd_cast(simd_fmax(self.to_f32x4().0, other.to_f32x4().0))) } } #[inline] pub fn min(self, other: I32x4) -> I32x4 { - unsafe { I32x4(simd_fmin(self.0, other.0)) } + unsafe { I32x4(simd_cast(simd_fmin(self.to_f32x4().0, other.to_f32x4().0))) } } // Packed comparisons From 3a8339fecef37c1cc831be11536847fcde0ca7f3 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 15:36:46 -0400 Subject: [PATCH 10/10] Allow dividing a Vector2F by an f32 value. --- geometry/src/vector.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/geometry/src/vector.rs b/geometry/src/vector.rs index a2031e25..6bd754c2 100644 --- a/geometry/src/vector.rs +++ b/geometry/src/vector.rs @@ -246,6 +246,14 @@ impl Div for Vector2F { } } +impl Div for Vector2F { + type Output = Vector2F; + #[inline] + fn div(self, other: f32) -> Vector2F { + self / Vector2F::splat(other) + } +} + impl Neg for Vector2F { type Output = Vector2F; #[inline]