Skip to content

Commit 685d3b5

Browse files
committed
Work around bug in simdarch-verify
1 parent 6492bab commit 685d3b5

File tree

3 files changed

+24
-80
lines changed

3 files changed

+24
-80
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ Cargo.lock
22
.*.swp
33
target
44
tags
5+
crates/stdarch-gen/aarch64.rs
6+
crates/stdarch-gen/arm.rs

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

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,46 +2166,6 @@ pub unsafe fn vmulq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
21662166
simd_mul(a, b)
21672167
}
21682168

2169-
/// Multiply
2170-
#[inline]
2171-
#[target_feature(enable = "neon")]
2172-
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
2173-
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(mul))]
2174-
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mul))]
2175-
pub unsafe fn vmul_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t {
2176-
simd_mul(a, b)
2177-
}
2178-
2179-
/// Multiply
2180-
#[inline]
2181-
#[target_feature(enable = "neon")]
2182-
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
2183-
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(mul))]
2184-
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mul))]
2185-
pub unsafe fn vmulq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
2186-
simd_mul(a, b)
2187-
}
2188-
2189-
/// Multiply
2190-
#[inline]
2191-
#[target_feature(enable = "neon")]
2192-
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
2193-
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(mul))]
2194-
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mul))]
2195-
pub unsafe fn vmul_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
2196-
simd_mul(a, b)
2197-
}
2198-
2199-
/// Multiply
2200-
#[inline]
2201-
#[target_feature(enable = "neon")]
2202-
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
2203-
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(mul))]
2204-
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mul))]
2205-
pub unsafe fn vmulq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
2206-
simd_mul(a, b)
2207-
}
2208-
22092169
/// Multiply
22102170
#[inline]
22112171
#[target_feature(enable = "neon")]
@@ -4413,56 +4373,20 @@ mod test {
44134373
assert_eq!(r, e);
44144374
}
44154375

4416-
#[simd_test(enable = "neon")]
4417-
unsafe fn test_vmul_s64() {
4418-
let a: i64x1 = i64x1::new(1);
4419-
let b: i64x1 = i64x1::new(1);
4420-
let e: i64x1 = i64x1::new(1);
4421-
let r: i64x1 = transmute(vmul_s64(transmute(a), transmute(b)));
4422-
assert_eq!(r, e);
4423-
}
4424-
4425-
#[simd_test(enable = "neon")]
4426-
unsafe fn test_vmulq_s64() {
4427-
let a: i64x2 = i64x2::new(1, 2);
4428-
let b: i64x2 = i64x2::new(1, 2);
4429-
let e: i64x2 = i64x2::new(1, 4);
4430-
let r: i64x2 = transmute(vmulq_s64(transmute(a), transmute(b)));
4431-
assert_eq!(r, e);
4432-
}
4433-
4434-
#[simd_test(enable = "neon")]
4435-
unsafe fn test_vmul_u64() {
4436-
let a: u64x1 = u64x1::new(1);
4437-
let b: u64x1 = u64x1::new(1);
4438-
let e: u64x1 = u64x1::new(1);
4439-
let r: u64x1 = transmute(vmul_u64(transmute(a), transmute(b)));
4440-
assert_eq!(r, e);
4441-
}
4442-
4443-
#[simd_test(enable = "neon")]
4444-
unsafe fn test_vmulq_u64() {
4445-
let a: u64x2 = u64x2::new(1, 2);
4446-
let b: u64x2 = u64x2::new(1, 2);
4447-
let e: u64x2 = u64x2::new(1, 4);
4448-
let r: u64x2 = transmute(vmulq_u64(transmute(a), transmute(b)));
4449-
assert_eq!(r, e);
4450-
}
4451-
44524376
#[simd_test(enable = "neon")]
44534377
unsafe fn test_vmul_f32() {
44544378
let a: f32x2 = f32x2::new(1.0, 2.0);
4455-
let b: f32x2 = f32x2::new(1.0, 2.0);
4456-
let e: f32x2 = f32x2::new(1.0, 4.0);
4379+
let b: f32x2 = f32x2::new(2.0, 3.0);
4380+
let e: f32x2 = f32x2::new(2.0, 6.0);
44574381
let r: f32x2 = transmute(vmul_f32(transmute(a), transmute(b)));
44584382
assert_eq!(r, e);
44594383
}
44604384

44614385
#[simd_test(enable = "neon")]
44624386
unsafe fn test_vmulq_f32() {
44634387
let a: f32x4 = f32x4::new(1.0, 2.0, 1.0, 2.0);
4464-
let b: f32x4 = f32x4::new(1.0, 2.0, 3.0, 4.0);
4465-
let e: f32x4 = f32x4::new(1.0, 4.0, 3.0, 8.0);
4388+
let b: f32x4 = f32x4::new(2.0, 3.0, 4.0, 5.0);
4389+
let e: f32x4 = f32x4::new(2.0, 6.0, 4.0, 10.0);
44664390
let r: f32x4 = transmute(vmulq_f32(transmute(a), transmute(b)));
44674391
assert_eq!(r, e);
44684392
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,9 @@ 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))]
12771280
pub unsafe fn vreinterpret_u64_u32(a: uint32x2_t) -> uint64x1_t {
12781281
transmute(a)
12791282
}
@@ -1282,6 +1285,9 @@ pub unsafe fn vreinterpret_u64_u32(a: uint32x2_t) -> uint64x1_t {
12821285
#[inline]
12831286
#[target_feature(enable = "neon")]
12841287
#[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))]
12851291
pub unsafe fn vreinterpretq_s8_u8(a: uint8x16_t) -> int8x16_t {
12861292
transmute(a)
12871293
}
@@ -1290,6 +1296,9 @@ pub unsafe fn vreinterpretq_s8_u8(a: uint8x16_t) -> int8x16_t {
12901296
#[inline]
12911297
#[target_feature(enable = "neon")]
12921298
#[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))]
12931302
pub unsafe fn vreinterpretq_u16_u8(a: uint8x16_t) -> uint16x8_t {
12941303
transmute(a)
12951304
}
@@ -1298,6 +1307,9 @@ pub unsafe fn vreinterpretq_u16_u8(a: uint8x16_t) -> uint16x8_t {
12981307
#[inline]
12991308
#[target_feature(enable = "neon")]
13001309
#[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))]
13011313
pub unsafe fn vreinterpretq_u32_u8(a: uint8x16_t) -> uint32x4_t {
13021314
transmute(a)
13031315
}
@@ -1306,6 +1318,9 @@ pub unsafe fn vreinterpretq_u32_u8(a: uint8x16_t) -> uint32x4_t {
13061318
#[inline]
13071319
#[target_feature(enable = "neon")]
13081320
#[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))]
13091324
pub unsafe fn vreinterpretq_u64_u8(a: uint8x16_t) -> uint64x2_t {
13101325
transmute(a)
13111326
}
@@ -1314,6 +1329,9 @@ pub unsafe fn vreinterpretq_u64_u8(a: uint8x16_t) -> uint64x2_t {
13141329
#[inline]
13151330
#[target_feature(enable = "neon")]
13161331
#[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))]
13171335
pub unsafe fn vreinterpretq_u8_s8(a: uint8x16_t) -> uint8x16_t {
13181336
transmute(a)
13191337
}

0 commit comments

Comments
 (0)