Skip to content

Commit cdf5236

Browse files
committed
Fix neon.rs
1 parent f02793c commit cdf5236

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

example/neon.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ unsafe fn test_vpmin_s8() {
1414
let a = i8x8::from([1, -2, 3, -4, 5, 6, 7, 8]);
1515
let b = i8x8::from([0, 3, 2, 5, 4, 7, 6, 9]);
1616
let e = i8x8::from([-2, -4, 5, 7, 0, 2, 4, 6]);
17-
let r: i8x8 = transmute(vpmin_s8(transmute(a), transmute(b)));
17+
let r: i8x8 = unsafe { transmute(vpmin_s8(transmute(a), transmute(b))) };
1818
assert_eq!(r, e);
1919
}
2020

@@ -23,7 +23,7 @@ unsafe fn test_vpmin_s16() {
2323
let a = i16x4::from([1, 2, 3, -4]);
2424
let b = i16x4::from([0, 3, 2, 5]);
2525
let e = i16x4::from([1, -4, 0, 2]);
26-
let r: i16x4 = transmute(vpmin_s16(transmute(a), transmute(b)));
26+
let r: i16x4 = unsafe { transmute(vpmin_s16(transmute(a), transmute(b))) };
2727
assert_eq!(r, e);
2828
}
2929

@@ -32,7 +32,7 @@ unsafe fn test_vpmin_s32() {
3232
let a = i32x2::from([1, -2]);
3333
let b = i32x2::from([0, 3]);
3434
let e = i32x2::from([-2, 0]);
35-
let r: i32x2 = transmute(vpmin_s32(transmute(a), transmute(b)));
35+
let r: i32x2 = unsafe { transmute(vpmin_s32(transmute(a), transmute(b))) };
3636
assert_eq!(r, e);
3737
}
3838

@@ -41,7 +41,7 @@ unsafe fn test_vpmin_u8() {
4141
let a = u8x8::from([1, 2, 3, 4, 5, 6, 7, 8]);
4242
let b = u8x8::from([0, 3, 2, 5, 4, 7, 6, 9]);
4343
let e = u8x8::from([1, 3, 5, 7, 0, 2, 4, 6]);
44-
let r: u8x8 = transmute(vpmin_u8(transmute(a), transmute(b)));
44+
let r: u8x8 = unsafe { transmute(vpmin_u8(transmute(a), transmute(b))) };
4545
assert_eq!(r, e);
4646
}
4747

@@ -50,7 +50,7 @@ unsafe fn test_vpmin_u16() {
5050
let a = u16x4::from([1, 2, 3, 4]);
5151
let b = u16x4::from([0, 3, 2, 5]);
5252
let e = u16x4::from([1, 3, 0, 2]);
53-
let r: u16x4 = transmute(vpmin_u16(transmute(a), transmute(b)));
53+
let r: u16x4 = unsafe { transmute(vpmin_u16(transmute(a), transmute(b))) };
5454
assert_eq!(r, e);
5555
}
5656

@@ -59,7 +59,7 @@ unsafe fn test_vpmin_u32() {
5959
let a = u32x2::from([1, 2]);
6060
let b = u32x2::from([0, 3]);
6161
let e = u32x2::from([1, 0]);
62-
let r: u32x2 = transmute(vpmin_u32(transmute(a), transmute(b)));
62+
let r: u32x2 = unsafe { transmute(vpmin_u32(transmute(a), transmute(b))) };
6363
assert_eq!(r, e);
6464
}
6565

@@ -68,7 +68,7 @@ unsafe fn test_vpmin_f32() {
6868
let a = f32x2::from([1., -2.]);
6969
let b = f32x2::from([0., 3.]);
7070
let e = f32x2::from([-2., 0.]);
71-
let r: f32x2 = transmute(vpmin_f32(transmute(a), transmute(b)));
71+
let r: f32x2 = unsafe { transmute(vpmin_f32(transmute(a), transmute(b))) };
7272
assert_eq!(r, e);
7373
}
7474

@@ -77,7 +77,7 @@ unsafe fn test_vpmax_s8() {
7777
let a = i8x8::from([1, -2, 3, -4, 5, 6, 7, 8]);
7878
let b = i8x8::from([0, 3, 2, 5, 4, 7, 6, 9]);
7979
let e = i8x8::from([1, 3, 6, 8, 3, 5, 7, 9]);
80-
let r: i8x8 = transmute(vpmax_s8(transmute(a), transmute(b)));
80+
let r: i8x8 = unsafe { transmute(vpmax_s8(transmute(a), transmute(b))) };
8181
assert_eq!(r, e);
8282
}
8383

@@ -86,7 +86,7 @@ unsafe fn test_vpmax_s16() {
8686
let a = i16x4::from([1, 2, 3, -4]);
8787
let b = i16x4::from([0, 3, 2, 5]);
8888
let e = i16x4::from([2, 3, 3, 5]);
89-
let r: i16x4 = transmute(vpmax_s16(transmute(a), transmute(b)));
89+
let r: i16x4 = unsafe { transmute(vpmax_s16(transmute(a), transmute(b))) };
9090
assert_eq!(r, e);
9191
}
9292

@@ -95,7 +95,7 @@ unsafe fn test_vpmax_s32() {
9595
let a = i32x2::from([1, -2]);
9696
let b = i32x2::from([0, 3]);
9797
let e = i32x2::from([1, 3]);
98-
let r: i32x2 = transmute(vpmax_s32(transmute(a), transmute(b)));
98+
let r: i32x2 = unsafe { transmute(vpmax_s32(transmute(a), transmute(b))) };
9999
assert_eq!(r, e);
100100
}
101101

@@ -104,7 +104,7 @@ unsafe fn test_vpmax_u8() {
104104
let a = u8x8::from([1, 2, 3, 4, 5, 6, 7, 8]);
105105
let b = u8x8::from([0, 3, 2, 5, 4, 7, 6, 9]);
106106
let e = u8x8::from([2, 4, 6, 8, 3, 5, 7, 9]);
107-
let r: u8x8 = transmute(vpmax_u8(transmute(a), transmute(b)));
107+
let r: u8x8 = unsafe { transmute(vpmax_u8(transmute(a), transmute(b))) };
108108
assert_eq!(r, e);
109109
}
110110

@@ -113,7 +113,7 @@ unsafe fn test_vpmax_u16() {
113113
let a = u16x4::from([1, 2, 3, 4]);
114114
let b = u16x4::from([0, 3, 2, 5]);
115115
let e = u16x4::from([2, 4, 3, 5]);
116-
let r: u16x4 = transmute(vpmax_u16(transmute(a), transmute(b)));
116+
let r: u16x4 = unsafe { transmute(vpmax_u16(transmute(a), transmute(b))) };
117117
assert_eq!(r, e);
118118
}
119119

@@ -122,7 +122,7 @@ unsafe fn test_vpmax_u32() {
122122
let a = u32x2::from([1, 2]);
123123
let b = u32x2::from([0, 3]);
124124
let e = u32x2::from([2, 3]);
125-
let r: u32x2 = transmute(vpmax_u32(transmute(a), transmute(b)));
125+
let r: u32x2 = unsafe { transmute(vpmax_u32(transmute(a), transmute(b))) };
126126
assert_eq!(r, e);
127127
}
128128

@@ -131,55 +131,55 @@ unsafe fn test_vpmax_f32() {
131131
let a = f32x2::from([1., -2.]);
132132
let b = f32x2::from([0., 3.]);
133133
let e = f32x2::from([1., 3.]);
134-
let r: f32x2 = transmute(vpmax_f32(transmute(a), transmute(b)));
134+
let r: f32x2 = unsafe { transmute(vpmax_f32(transmute(a), transmute(b))) };
135135
assert_eq!(r, e);
136136
}
137137

138138
#[cfg(target_arch = "aarch64")]
139139
unsafe fn test_vpadd_s16() {
140140
let a = i16x4::from([1, 2, 3, 4]);
141141
let b = i16x4::from([0, -1, -2, -3]);
142-
let r: i16x4 = transmute(vpadd_s16(transmute(a), transmute(b)));
142+
let r: i16x4 = unsafe { transmute(vpadd_s16(transmute(a), transmute(b))) };
143143
let e = i16x4::from([3, 7, -1, -5]);
144144
assert_eq!(r, e);
145145
}
146146
#[cfg(target_arch = "aarch64")]
147147
unsafe fn test_vpadd_s32() {
148148
let a = i32x2::from([1, 2]);
149149
let b = i32x2::from([0, -1]);
150-
let r: i32x2 = transmute(vpadd_s32(transmute(a), transmute(b)));
150+
let r: i32x2 = unsafe { transmute(vpadd_s32(transmute(a), transmute(b))) };
151151
let e = i32x2::from([3, -1]);
152152
assert_eq!(r, e);
153153
}
154154
#[cfg(target_arch = "aarch64")]
155155
unsafe fn test_vpadd_s8() {
156156
let a = i8x8::from([1, 2, 3, 4, 5, 6, 7, 8]);
157157
let b = i8x8::from([0, -1, -2, -3, -4, -5, -6, -7]);
158-
let r: i8x8 = transmute(vpadd_s8(transmute(a), transmute(b)));
158+
let r: i8x8 = unsafe { transmute(vpadd_s8(transmute(a), transmute(b))) };
159159
let e = i8x8::from([3, 7, 11, 15, -1, -5, -9, -13]);
160160
assert_eq!(r, e);
161161
}
162162
#[cfg(target_arch = "aarch64")]
163163
unsafe fn test_vpadd_u16() {
164164
let a = u16x4::from([1, 2, 3, 4]);
165165
let b = u16x4::from([30, 31, 32, 33]);
166-
let r: u16x4 = transmute(vpadd_u16(transmute(a), transmute(b)));
166+
let r: u16x4 = unsafe { transmute(vpadd_u16(transmute(a), transmute(b))) };
167167
let e = u16x4::from([3, 7, 61, 65]);
168168
assert_eq!(r, e);
169169
}
170170
#[cfg(target_arch = "aarch64")]
171171
unsafe fn test_vpadd_u32() {
172172
let a = u32x2::from([1, 2]);
173173
let b = u32x2::from([30, 31]);
174-
let r: u32x2 = transmute(vpadd_u32(transmute(a), transmute(b)));
174+
let r: u32x2 = unsafe { transmute(vpadd_u32(transmute(a), transmute(b))) };
175175
let e = u32x2::from([3, 61]);
176176
assert_eq!(r, e);
177177
}
178178
#[cfg(target_arch = "aarch64")]
179179
unsafe fn test_vpadd_u8() {
180180
let a = u8x8::from([1, 2, 3, 4, 5, 6, 7, 8]);
181181
let b = u8x8::from([30, 31, 32, 33, 34, 35, 36, 37]);
182-
let r: u8x8 = transmute(vpadd_u8(transmute(a), transmute(b)));
182+
let r: u8x8 = unsafe { transmute(vpadd_u8(transmute(a), transmute(b))) };
183183
let e = u8x8::from([3, 7, 11, 15, 61, 65, 69, 73]);
184184
assert_eq!(r, e);
185185
}
@@ -188,7 +188,7 @@ unsafe fn test_vpadd_u8() {
188188
unsafe fn test_vqsub_u8() {
189189
let a = u8x8::from([1, 2, 3, 4, 5, 6, 7, 0xff]);
190190
let b = u8x8::from([30, 1, 1, 1, 34, 0xff, 36, 37]);
191-
let r: u8x8 = transmute(vqsub_u8(transmute(a), transmute(b)));
191+
let r: u8x8 = unsafe { transmute(vqsub_u8(transmute(a), transmute(b))) };
192192
let e = u8x8::from([0, 1, 2, 3, 0, 0, 0, 218]);
193193
assert_eq!(r, e);
194194
}
@@ -197,7 +197,7 @@ unsafe fn test_vqsub_u8() {
197197
unsafe fn test_vqadd_u8() {
198198
let a = u8x8::from([1, 2, 3, 4, 5, 6, 7, 0xff]);
199199
let b = u8x8::from([30, 1, 1, 1, 34, 0xff, 36, 37]);
200-
let r: u8x8 = transmute(vqadd_u8(transmute(a), transmute(b)));
200+
let r: u8x8 = unsafe { transmute(vqadd_u8(transmute(a), transmute(b))) };
201201
let e = u8x8::from([31, 3, 4, 5, 39, 0xff, 43, 0xff]);
202202
assert_eq!(r, e);
203203
}
@@ -208,7 +208,7 @@ unsafe fn test_vmaxq_f32() {
208208
let a = f32x4::from([0., -1., 2., -3.]);
209209
let b = f32x4::from([-4., 5., -6., 7.]);
210210
let e = f32x4::from([0., 5., 2., 7.]);
211-
let r: f32x4 = transmute(vmaxq_f32(transmute(a), transmute(b)));
211+
let r: f32x4 = unsafe { transmute(vmaxq_f32(transmute(a), transmute(b))) };
212212
assert_eq!(r, e);
213213
}
214214

@@ -218,7 +218,7 @@ unsafe fn test_vminq_f32() {
218218
let a = f32x4::from([0., -1., 2., -3.]);
219219
let b = f32x4::from([-4., 5., -6., 7.]);
220220
let e = f32x4::from([-4., -1., -6., -3.]);
221-
let r: f32x4 = transmute(vminq_f32(transmute(a), transmute(b)));
221+
let r: f32x4 = unsafe { transmute(vminq_f32(transmute(a), transmute(b))) };
222222
assert_eq!(r, e);
223223
}
224224

@@ -227,7 +227,7 @@ unsafe fn test_vaddvq_f32() {
227227
// AArch64 llvm intrinsic: llvm.aarch64.neon.faddv.f32.v4f32
228228
let a = f32x4::from([0., 1., 2., 3.]);
229229
let e = 6f32;
230-
let r = vaddvq_f32(transmute(a));
230+
let r = unsafe { vaddvq_f32(transmute(a)) };
231231
assert_eq!(r, e);
232232
}
233233

@@ -236,7 +236,7 @@ unsafe fn test_vrndnq_f32() {
236236
// llvm intrinsic: llvm.roundeven.v4f32
237237
let a = f32x4::from([0.1, -1.9, 4.5, 5.5]);
238238
let e = f32x4::from([0., -2., 4., 6.]);
239-
let r: f32x4 = transmute(vrndnq_f32(transmute(a)));
239+
let r: f32x4 = unsafe { transmute(vrndnq_f32(transmute(a))) };
240240
assert_eq!(r, e);
241241
}
242242

0 commit comments

Comments
 (0)