Merge pull request #296 from servo/jdm-patch-1

Add arm64 CI and fix build errors
This commit is contained in:
Patrick Walton 2020-04-09 10:28:55 -07:00 committed by GitHub
commit 205a63340c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View File

@ -1,4 +1,7 @@
language: rust language: rust
rust:
- nightly
- stable
addons: addons:
apt: apt:
packages: packages:
@ -7,6 +10,12 @@ addons:
- libsdl2-dev - libsdl2-dev
- cmake - cmake
script: script:
- 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 build
- cargo test - cargo test
env: env:

View File

@ -246,6 +246,14 @@ impl Div<Vector2F> for Vector2F {
} }
} }
impl Div<f32> for Vector2F {
type Output = Vector2F;
#[inline]
fn div(self, other: f32) -> Vector2F {
self / Vector2F::splat(other)
}
}
impl Neg for Vector2F { impl Neg for Vector2F {
type Output = Vector2F; type Output = Vector2F;
#[inline] #[inline]

View File

@ -13,7 +13,7 @@ use std::arch::aarch64::{uint32x2_t, uint32x4_t};
use std::f32; use std::f32;
use std::fmt::{self, Debug, Formatter}; use std::fmt::{self, Debug, Formatter};
use std::mem; 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_f32x4;
mod swizzle_i32x4; mod swizzle_i32x4;
@ -332,7 +332,7 @@ impl F32x4 {
/// Converts these packed floats to integers via rounding. /// Converts these packed floats to integers via rounding.
#[inline] #[inline]
pub fn to_i32x4(self) -> I32x4 { pub fn to_i32x4(self) -> I32x4 {
unsafe { I32x4(round_v4f32(simd_cast(self.0))) } unsafe { I32x4(simd_cast(round_v4f32(self.0))) }
} }
} }
@ -445,6 +445,18 @@ impl I32x2 {
unsafe { U32x2(simd_eq(self.0, other.0)) } 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 // Concatenations
#[inline] #[inline]
@ -459,6 +471,11 @@ impl I32x2 {
pub fn to_f32x2(self) -> F32x2 { pub fn to_f32x2(self) -> F32x2 {
unsafe { F32x2(simd_cast(self.0)) } unsafe { F32x2(simd_cast(self.0)) }
} }
#[inline]
pub fn to_i32x4(self) -> I32x4 {
self.concat_xy_xy(I32x2::default())
}
} }
impl Default for I32x2 { impl Default for I32x2 {
@ -542,12 +559,12 @@ impl I32x4 {
#[inline] #[inline]
pub fn max(self, other: I32x4) -> I32x4 { 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] #[inline]
pub fn min(self, other: I32x4) -> I32x4 { 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 // Packed comparisons