Skip to content

Commit 8b5fda6

Browse files
committed
Fix bug in stdarch-test and nop intrinsics
1 parent 8512ed3 commit 8b5fda6

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

crates/core_arch/src/arm/neon/mod.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,9 +1274,7 @@ pub unsafe fn vmovq_n_u8(value: u8) -> uint8x16_t {
12741274
#[inline]
12751275
#[target_feature(enable = "neon")]
12761276
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1277-
// This doesn't actually has an assembly instruction but simdarch-verify
1278-
//requires it to have one ... it's a function so it returns.
1279-
#[cfg_attr(test, assert_instr(ret))]
1277+
#[cfg_attr(test, assert_instr(nop))]
12801278
pub unsafe fn vreinterpret_u64_u32(a: uint32x2_t) -> uint64x1_t {
12811279
transmute(a)
12821280
}
@@ -1285,9 +1283,7 @@ pub unsafe fn vreinterpret_u64_u32(a: uint32x2_t) -> uint64x1_t {
12851283
#[inline]
12861284
#[target_feature(enable = "neon")]
12871285
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1288-
// This doesn't actually has an assembly instruction but simdarch-verify
1289-
//requires it to have one ... it's a function so it returns.
1290-
#[cfg_attr(test, assert_instr(ret))]
1286+
#[cfg_attr(test, assert_instr(nop))]
12911287
pub unsafe fn vreinterpretq_s8_u8(a: uint8x16_t) -> int8x16_t {
12921288
transmute(a)
12931289
}
@@ -1296,9 +1292,7 @@ pub unsafe fn vreinterpretq_s8_u8(a: uint8x16_t) -> int8x16_t {
12961292
#[inline]
12971293
#[target_feature(enable = "neon")]
12981294
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1299-
// This doesn't actually has an assembly instruction but simdarch-verify
1300-
//requires it to have one ... it's a function so it returns.
1301-
#[cfg_attr(test, assert_instr(ret))]
1295+
#[cfg_attr(test, assert_instr(nop))]
13021296
pub unsafe fn vreinterpretq_u16_u8(a: uint8x16_t) -> uint16x8_t {
13031297
transmute(a)
13041298
}
@@ -1307,9 +1301,7 @@ pub unsafe fn vreinterpretq_u16_u8(a: uint8x16_t) -> uint16x8_t {
13071301
#[inline]
13081302
#[target_feature(enable = "neon")]
13091303
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1310-
// This doesn't actually has an assembly instruction but simdarch-verify
1311-
//requires it to have one ... it's a function so it returns.
1312-
#[cfg_attr(test, assert_instr(ret))]
1304+
#[cfg_attr(test, assert_instr(nop))]
13131305
pub unsafe fn vreinterpretq_u32_u8(a: uint8x16_t) -> uint32x4_t {
13141306
transmute(a)
13151307
}
@@ -1318,9 +1310,7 @@ pub unsafe fn vreinterpretq_u32_u8(a: uint8x16_t) -> uint32x4_t {
13181310
#[inline]
13191311
#[target_feature(enable = "neon")]
13201312
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1321-
// This doesn't actually has an assembly instruction but simdarch-verify
1322-
//requires it to have one ... it's a function so it returns.
1323-
#[cfg_attr(test, assert_instr(ret))]
1313+
#[cfg_attr(test, assert_instr(nop))]
13241314
pub unsafe fn vreinterpretq_u64_u8(a: uint8x16_t) -> uint64x2_t {
13251315
transmute(a)
13261316
}
@@ -1329,9 +1319,7 @@ pub unsafe fn vreinterpretq_u64_u8(a: uint8x16_t) -> uint64x2_t {
13291319
#[inline]
13301320
#[target_feature(enable = "neon")]
13311321
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
1332-
// This doesn't actually has an assembly instruction but simdarch-verify
1333-
//requires it to have one ... it's a function so it returns.
1334-
#[cfg_attr(test, assert_instr(ret))]
1322+
#[cfg_attr(test, assert_instr(nop))]
13351323
pub unsafe fn vreinterpretq_u8_s8(a: int8x16_t) -> uint8x16_t {
13361324
transmute(a)
13371325
}

crates/stdarch-test/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ pub fn assert(_fnptr: usize, fnname: &str, expected: &str) {
8888
instrs = &instrs[..instrs.len() - 1];
8989
}
9090

91+
// If the expected intrinsic is a nop it is compiled away so we
92+
// can't check for it - aka the intrinsic is not generating any code
93+
if expected == "nop" {
94+
return;
95+
}
96+
9197
// Look for `expected` as the first part of any instruction in this
9298
// function, e.g., tzcntl in tzcntl %rax,%rax.
9399
let found = instrs.iter().any(|s| s.starts_with(expected));

0 commit comments

Comments
 (0)