Skip to content

Commit f8f6797

Browse files
gnzlbgalexcrichton
authored andcommitted
[ci] test i686-apple-darwin (#221)
* [ci] test i686-apple-darwin * fix overflow on i686-apple-darwin
1 parent db8c6ac commit f8f6797

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ matrix:
1212
- env: TARGET=arm-unknown-linux-gnueabihf
1313
- env: TARGET=armv7-unknown-linux-gnueabihf
1414
- env: TARGET=aarch64-unknown-linux-gnu
15+
- os: osx
16+
env: TARGET=i686-apple-darwin
17+
script: ci/run.sh
1518
- os: osx
1619
env: TARGET=x86_64-apple-darwin NO_ADD=1
1720
script: ci/run.sh

coresimd/src/x86/i586/sse2.rs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,38 +3686,33 @@ mod tests {
36863686
assert_eq!(r, 0b11);
36873687
}
36883688

3689+
#[repr(align(16))]
3690+
struct Memory {
3691+
data: [f64; 4],
3692+
}
3693+
36893694
#[simd_test = "sse2"]
36903695
unsafe fn _mm_load_pd() {
3691-
let vals = &[1.0f64, 2.0, 3.0, 4.0];
3692-
let mut d = vals.as_ptr();
3693-
3694-
// Align d to 16-byte boundary
3695-
let mut offset = 0;
3696-
while (d as usize) & 0xf != 0 {
3697-
d = d.offset(1 as isize);
3698-
offset += 1;
3699-
}
3696+
let mem = Memory {
3697+
data: [1.0f64, 2.0, 3.0, 4.0],
3698+
};
3699+
let vals = &mem.data;
3700+
let d = vals.as_ptr();
37003701

37013702
let r = sse2::_mm_load_pd(d);
3702-
assert_eq!(r, f64x2::new(1.0, 2.0) + f64x2::splat(offset as f64));
3703+
assert_eq!(r, f64x2::new(1.0, 2.0));
37033704
}
37043705

37053706
#[simd_test = "sse2"]
37063707
unsafe fn _mm_store_pd() {
3707-
let mut vals = [0.0f64; 4];
3708+
let mut mem = Memory { data: [0.0f64; 4] };
3709+
let vals = &mut mem.data;
37083710
let a = f64x2::new(1.0, 2.0);
3709-
let mut d = vals.as_mut_ptr();
3710-
3711-
// Align d to 16-byte boundary
3712-
let mut offset = 0;
3713-
while (d as usize) & 0xf != 0 {
3714-
d = d.offset(1 as isize);
3715-
offset += 1;
3716-
}
3711+
let d = vals.as_mut_ptr();
37173712

37183713
sse2::_mm_store_pd(d, *black_box(&a));
3719-
assert_eq!(vals[offset + 0], 1.0);
3720-
assert_eq!(vals[offset + 1], 2.0);
3714+
assert_eq!(vals[0], 1.0);
3715+
assert_eq!(vals[1], 2.0);
37213716
}
37223717

37233718
#[simd_test = "sse"]

0 commit comments

Comments
 (0)