Skip to content

Commit 02ae6b0

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 76dcd3c commit 02ae6b0

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
@@ -171,7 +171,9 @@ pub unsafe fn _mm_max_ps(a: f32x4, b: f32x4) -> f32x4 {
171171
/// Bitwise AND of packed single-precision (32-bit) floating-point elements.
172172
#[inline(always)]
173173
#[target_feature = "+sse"]
174-
#[cfg_attr(test, assert_instr(andps))]
174+
// i586 only seems to generate plain `and` instructions, so ignore it.
175+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
176+
assert_instr(andps))]
175177
pub unsafe fn _mm_and_ps(a: f32x4, b: f32x4) -> f32x4 {
176178
let aa: i32x4 = mem::transmute(a);
177179
let bb: i32x4 = mem::transmute(b);
@@ -183,7 +185,9 @@ pub unsafe fn _mm_and_ps(a: f32x4, b: f32x4) -> f32x4 {
183185
/// Computes `!a & b` for each bit in `a` and `b`.
184186
#[inline(always)]
185187
#[target_feature = "+sse"]
186-
#[cfg_attr(test, assert_instr(andnps))]
188+
// i586 only seems to generate plain `not` and `and` instructions, so ignore it.
189+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
190+
assert_instr(andnps))]
187191
pub unsafe fn _mm_andnot_ps(a: f32x4, b: f32x4) -> f32x4 {
188192
let aa: i32x4 = mem::transmute(a);
189193
let bb: i32x4 = mem::transmute(b);
@@ -193,7 +197,9 @@ pub unsafe fn _mm_andnot_ps(a: f32x4, b: f32x4) -> f32x4 {
193197
/// Bitwise OR of packed single-precision (32-bit) floating-point elements.
194198
#[inline(always)]
195199
#[target_feature = "+sse"]
196-
#[cfg_attr(test, assert_instr(orps))]
200+
// i586 only seems to generate plain `or` instructions, so we ignore it.
201+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
202+
assert_instr(orps))]
197203
pub unsafe fn _mm_or_ps(a: f32x4, b: f32x4) -> f32x4 {
198204
let aa: i32x4 = mem::transmute(a);
199205
let bb: i32x4 = mem::transmute(b);
@@ -204,7 +210,9 @@ pub unsafe fn _mm_or_ps(a: f32x4, b: f32x4) -> f32x4 {
204210
/// elements.
205211
#[inline(always)]
206212
#[target_feature = "+sse"]
207-
#[cfg_attr(test, assert_instr(xorps))]
213+
// i586 only seems to generate plain `xor` instructions, so we ignore it.
214+
#[cfg_attr(all(test, any(target_arch = "x86_64", target_feature = "sse2")),
215+
assert_instr(xorps))]
208216
pub unsafe fn _mm_xor_ps(a: f32x4, b: f32x4) -> f32x4 {
209217
let aa: i32x4 = mem::transmute(a);
210218
let bb: i32x4 = mem::transmute(b);

0 commit comments

Comments
 (0)