@@ -11,6 +11,142 @@ use crate::{core_arch::simd::*, hint::unreachable_unchecked, intrinsics::simd::*
11
11
#[ cfg( test) ]
12
12
use stdarch_test:: assert_instr;
13
13
14
+ #[ cfg_attr(
15
+ not( target_arch = "arm" ) ,
16
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
17
+ ) ]
18
+ #[ cfg_attr(
19
+ target_arch = "arm" ,
20
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
21
+ ) ]
22
+ pub trait AsUnsigned {
23
+ #[ cfg_attr(
24
+ not( target_arch = "arm" ) ,
25
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
26
+ ) ]
27
+ #[ cfg_attr(
28
+ target_arch = "arm" ,
29
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
30
+ ) ]
31
+ type Unsigned : ?Sized ;
32
+
33
+ #[ cfg_attr(
34
+ not( target_arch = "arm" ) ,
35
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
36
+ ) ]
37
+ #[ cfg_attr(
38
+ target_arch = "arm" ,
39
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
40
+ ) ]
41
+ unsafe fn as_unsigned ( self ) -> Self :: Unsigned ;
42
+ }
43
+
44
+ #[ cfg_attr(
45
+ not( target_arch = "arm" ) ,
46
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
47
+ ) ]
48
+ #[ cfg_attr(
49
+ target_arch = "arm" ,
50
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
51
+ ) ]
52
+ pub trait AsSigned {
53
+ #[ cfg_attr(
54
+ not( target_arch = "arm" ) ,
55
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
56
+ ) ]
57
+ #[ cfg_attr(
58
+ target_arch = "arm" ,
59
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
60
+ ) ]
61
+ type Signed : ?Sized ;
62
+
63
+ #[ cfg_attr(
64
+ not( target_arch = "arm" ) ,
65
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
66
+ ) ]
67
+ #[ cfg_attr(
68
+ target_arch = "arm" ,
69
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
70
+ ) ]
71
+ unsafe fn as_signed ( self ) -> Self :: Signed ;
72
+ }
73
+
74
+ macro_rules! impl_sign_conversions {
75
+ ( $( ( $signed: ty, $unsigned: ty) ) * ) => ( $(
76
+ #[ cfg_attr(
77
+ not( target_arch = "arm" ) ,
78
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
79
+ ) ]
80
+ #[ cfg_attr(
81
+ target_arch = "arm" ,
82
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
83
+ ) ]
84
+ impl AsUnsigned for $signed {
85
+ type Unsigned = $unsigned;
86
+
87
+ #[ inline]
88
+ unsafe fn as_unsigned( self ) -> $unsigned {
89
+ crate :: mem:: transmute( self )
90
+ }
91
+ }
92
+
93
+ #[ cfg_attr(
94
+ not( target_arch = "arm" ) ,
95
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
96
+ ) ]
97
+ #[ cfg_attr(
98
+ target_arch = "arm" ,
99
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
100
+ ) ]
101
+ impl AsSigned for $unsigned {
102
+ type Signed = $signed;
103
+
104
+ #[ inline]
105
+ unsafe fn as_signed( self ) -> $signed {
106
+ crate :: mem:: transmute( self )
107
+ }
108
+ }
109
+ ) * )
110
+ }
111
+
112
+ macro_rules! impl_sign_conversions_neon {
113
+ ( $( ( $signed: ty, $unsigned: ty) ) * ) => ( $(
114
+ #[ cfg_attr(
115
+ not( target_arch = "arm" ) ,
116
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
117
+ ) ]
118
+ #[ cfg_attr(
119
+ target_arch = "arm" ,
120
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
121
+ ) ]
122
+ impl AsUnsigned for $signed {
123
+ type Unsigned = $unsigned;
124
+
125
+ #[ inline]
126
+ unsafe fn as_unsigned( self ) -> $unsigned {
127
+ crate :: mem:: transmute( self )
128
+ }
129
+ }
130
+
131
+ #[ cfg_attr(
132
+ not( target_arch = "arm" ) ,
133
+ stable( feature = "neon_intrinsics" , since = "1.59.0" )
134
+ ) ]
135
+ #[ cfg_attr(
136
+ target_arch = "arm" ,
137
+ unstable( feature = "stdarch_arm_neon_intrinsics" , issue = "111800" )
138
+ ) ]
139
+ impl AsSigned for $unsigned {
140
+ type Signed = $signed;
141
+
142
+ #[ inline]
143
+ unsafe fn as_signed( self ) -> $signed {
144
+ crate :: mem:: transmute( self )
145
+ }
146
+ }
147
+ ) * )
148
+ }
149
+
14
150
pub ( crate ) type p8 = u8 ;
15
151
pub ( crate ) type p16 = u16 ;
16
152
pub ( crate ) type p64 = u64 ;
@@ -1033,6 +1169,88 @@ pub struct poly64x2x4_t(
1033
1169
pub poly64x2_t ,
1034
1170
) ;
1035
1171
1172
+ impl_sign_conversions ! {
1173
+ ( i8 , u8 )
1174
+ ( i16 , u16 )
1175
+ ( i32 , u32 )
1176
+ ( i64 , u64 )
1177
+ ( * const i8 , * const u8 )
1178
+ ( * const i16 , * const u16 )
1179
+ ( * const i32 , * const u32 )
1180
+ ( * const i64 , * const u64 )
1181
+ ( * mut i8 , * mut u8 )
1182
+ ( * mut i16 , * mut u16 )
1183
+ ( * mut i32 , * mut u32 )
1184
+ ( * mut i64 , * mut u64 )
1185
+ ( int16x4_t, uint16x4_t)
1186
+ ( int16x8_t, uint16x8_t)
1187
+ ( int32x2_t, uint32x2_t)
1188
+ ( int32x4_t, uint32x4_t)
1189
+ ( int64x1_t, uint64x1_t)
1190
+ ( int64x2_t, uint64x2_t)
1191
+ ( int8x16_t, uint8x16_t)
1192
+ ( int8x8_t, uint8x8_t)
1193
+ ( uint16x4_t, int16x4_t)
1194
+ ( uint16x8_t, int16x8_t)
1195
+ ( uint32x2_t, int32x2_t)
1196
+ ( uint32x4_t, int32x4_t)
1197
+ ( uint64x1_t, int64x1_t)
1198
+ ( uint64x2_t, int64x2_t)
1199
+ ( uint8x16_t, int8x16_t)
1200
+ ( uint8x8_t, int8x8_t)
1201
+ }
1202
+
1203
+ impl_sign_conversions_neon ! {
1204
+ ( int16x4x2_t, uint16x4x2_t)
1205
+ ( int16x4x3_t, uint16x4x3_t)
1206
+ ( int16x4x4_t, uint16x4x4_t)
1207
+ ( int16x8x2_t, uint16x8x2_t)
1208
+ ( int16x8x3_t, uint16x8x3_t)
1209
+ ( int16x8x4_t, uint16x8x4_t)
1210
+ ( int32x2x2_t, uint32x2x2_t)
1211
+ ( int32x2x3_t, uint32x2x3_t)
1212
+ ( int32x2x4_t, uint32x2x4_t)
1213
+ ( int32x4x2_t, uint32x4x2_t)
1214
+ ( int32x4x3_t, uint32x4x3_t)
1215
+ ( int32x4x4_t, uint32x4x4_t)
1216
+ ( int64x1x2_t, uint64x1x2_t)
1217
+ ( int64x1x3_t, uint64x1x3_t)
1218
+ ( int64x1x4_t, uint64x1x4_t)
1219
+ ( int64x2x2_t, uint64x2x2_t)
1220
+ ( int64x2x3_t, uint64x2x3_t)
1221
+ ( int64x2x4_t, uint64x2x4_t)
1222
+ ( int8x16x2_t, uint8x16x2_t)
1223
+ ( int8x16x3_t, uint8x16x3_t)
1224
+ ( int8x16x4_t, uint8x16x4_t)
1225
+ ( int8x8x2_t, uint8x8x2_t)
1226
+ ( int8x8x3_t, uint8x8x3_t)
1227
+ ( int8x8x4_t, uint8x8x4_t)
1228
+ ( uint16x4x2_t, int16x4x2_t)
1229
+ ( uint16x4x3_t, int16x4x3_t)
1230
+ ( uint16x4x4_t, int16x4x4_t)
1231
+ ( uint16x8x2_t, int16x8x2_t)
1232
+ ( uint16x8x3_t, int16x8x3_t)
1233
+ ( uint16x8x4_t, int16x8x4_t)
1234
+ ( uint32x2x2_t, int32x2x2_t)
1235
+ ( uint32x2x3_t, int32x2x3_t)
1236
+ ( uint32x2x4_t, int32x2x4_t)
1237
+ ( uint32x4x2_t, int32x4x2_t)
1238
+ ( uint32x4x3_t, int32x4x3_t)
1239
+ ( uint32x4x4_t, int32x4x4_t)
1240
+ ( uint64x1x2_t, int64x1x2_t)
1241
+ ( uint64x1x3_t, int64x1x3_t)
1242
+ ( uint64x1x4_t, int64x1x4_t)
1243
+ ( uint64x2x2_t, int64x2x2_t)
1244
+ ( uint64x2x3_t, int64x2x3_t)
1245
+ ( uint64x2x4_t, int64x2x4_t)
1246
+ ( uint8x16x2_t, int8x16x2_t)
1247
+ ( uint8x16x3_t, int8x16x3_t)
1248
+ ( uint8x16x4_t, int8x16x4_t)
1249
+ ( uint8x8x2_t, int8x8x2_t)
1250
+ ( uint8x8x3_t, int8x8x3_t)
1251
+ ( uint8x8x4_t, int8x8x4_t)
1252
+ }
1253
+
1036
1254
#[ allow( improper_ctypes) ]
1037
1255
extern "unadjusted" {
1038
1256
// absolute value (64-bit)
0 commit comments