Skip to content

Commit 3fc19b0

Browse files
committed
Fix _mm_{and,andnot,or,xor}_ps tests for i586
LLVM for i586 doesn't seem to generate `andps`, and instead generates 4 `and`s. Similar for the other operations.
1 parent de8f85b commit 3fc19b0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/x86/sse.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ pub unsafe fn _mm_max_ps(a: f32x4, b: f32x4) -> f32x4 {
169169
/// Bitwise AND of packed single-precision (32-bit) floating-point elements.
170170
#[inline(always)]
171171
#[target_feature = "+sse"]
172-
#[cfg_attr(test, assert_instr(andps))]
172+
// i586 only seems to generate plain `and` instructions, so ignore it.
173+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
174+
assert_instr(andps))]
173175
pub unsafe fn _mm_and_ps(a: f32x4, b: f32x4) -> f32x4 {
174176
let aa: i32x4 = mem::transmute(a);
175177
let bb: i32x4 = mem::transmute(b);
@@ -181,7 +183,9 @@ pub unsafe fn _mm_and_ps(a: f32x4, b: f32x4) -> f32x4 {
181183
/// Computes `!a & b` for each bit in `a` and `b`.
182184
#[inline(always)]
183185
#[target_feature = "+sse"]
184-
#[cfg_attr(test, assert_instr(andnps))]
186+
// i586 only seems to generate plain `not` and `and` instructions, so ignore it.
187+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
188+
assert_instr(andnps))]
185189
pub unsafe fn _mm_andnot_ps(a: f32x4, b: f32x4) -> f32x4 {
186190
let aa: i32x4 = mem::transmute(a);
187191
let bb: i32x4 = mem::transmute(b);
@@ -191,7 +195,9 @@ pub unsafe fn _mm_andnot_ps(a: f32x4, b: f32x4) -> f32x4 {
191195
/// Bitwise OR of packed single-precision (32-bit) floating-point elements.
192196
#[inline(always)]
193197
#[target_feature = "+sse"]
194-
#[cfg_attr(test, assert_instr(orps))]
198+
// i586 only seems to generate plain `or` instructions, so we ignore it.
199+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
200+
assert_instr(orps))]
195201
pub unsafe fn _mm_or_ps(a: f32x4, b: f32x4) -> f32x4 {
196202
let aa: i32x4 = mem::transmute(a);
197203
let bb: i32x4 = mem::transmute(b);
@@ -202,7 +208,9 @@ pub unsafe fn _mm_or_ps(a: f32x4, b: f32x4) -> f32x4 {
202208
/// elements.
203209
#[inline(always)]
204210
#[target_feature = "+sse"]
205-
#[cfg_attr(test, assert_instr(xorps))]
211+
// i586 only seems to generate plain `xor` instructions, so we ignore it.
212+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
213+
assert_instr(xorps))]
206214
pub unsafe fn _mm_xor_ps(a: f32x4, b: f32x4) -> f32x4 {
207215
let aa: i32x4 = mem::transmute(a);
208216
let bb: i32x4 = mem::transmute(b);

0 commit comments

Comments
 (0)