Skip to content

Commit 7b5d269

Browse files
taiki-eAmanieu
authored andcommitted
core_arch: Remove uses of arm crypto target feature
1 parent 41caec4 commit 7b5d269

File tree

1 file changed

+42
-56
lines changed

1 file changed

+42
-56
lines changed

crates/core_arch/src/arm_shared/crypto.rs

+42-56
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ use stdarch_test::assert_instr;
5555
///
5656
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaeseq_u8)
5757
#[inline]
58-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
59-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
58+
#[target_feature(enable = "aes")]
59+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
6060
#[cfg_attr(test, assert_instr(aese))]
6161
pub unsafe fn vaeseq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
6262
vaeseq_u8_(data, key)
@@ -66,8 +66,8 @@ pub unsafe fn vaeseq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
6666
///
6767
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesdq_u8)
6868
#[inline]
69-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
70-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
69+
#[target_feature(enable = "aes")]
70+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
7171
#[cfg_attr(test, assert_instr(aesd))]
7272
pub unsafe fn vaesdq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
7373
vaesdq_u8_(data, key)
@@ -77,8 +77,8 @@ pub unsafe fn vaesdq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
7777
///
7878
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesmcq_u8)
7979
#[inline]
80-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
81-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
80+
#[target_feature(enable = "aes")]
81+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
8282
#[cfg_attr(test, assert_instr(aesmc))]
8383
pub unsafe fn vaesmcq_u8(data: uint8x16_t) -> uint8x16_t {
8484
vaesmcq_u8_(data)
@@ -88,8 +88,8 @@ pub unsafe fn vaesmcq_u8(data: uint8x16_t) -> uint8x16_t {
8888
///
8989
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesimcq_u8)
9090
#[inline]
91-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
92-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
91+
#[target_feature(enable = "aes")]
92+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
9393
#[cfg_attr(test, assert_instr(aesimc))]
9494
pub unsafe fn vaesimcq_u8(data: uint8x16_t) -> uint8x16_t {
9595
vaesimcq_u8_(data)
@@ -99,8 +99,8 @@ pub unsafe fn vaesimcq_u8(data: uint8x16_t) -> uint8x16_t {
9999
///
100100
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1h_u32)
101101
#[inline]
102-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
103-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
102+
#[target_feature(enable = "sha2")]
103+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
104104
#[cfg_attr(test, assert_instr(sha1h))]
105105
pub unsafe fn vsha1h_u32(hash_e: u32) -> u32 {
106106
vsha1h_u32_(hash_e)
@@ -110,8 +110,8 @@ pub unsafe fn vsha1h_u32(hash_e: u32) -> u32 {
110110
///
111111
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1cq_u32)
112112
#[inline]
113-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
114-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
113+
#[target_feature(enable = "sha2")]
114+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
115115
#[cfg_attr(test, assert_instr(sha1c))]
116116
pub unsafe fn vsha1cq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
117117
vsha1cq_u32_(hash_abcd, hash_e, wk)
@@ -121,8 +121,8 @@ pub unsafe fn vsha1cq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
121121
///
122122
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1mq_u32)
123123
#[inline]
124-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
125-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
124+
#[target_feature(enable = "sha2")]
125+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
126126
#[cfg_attr(test, assert_instr(sha1m))]
127127
pub unsafe fn vsha1mq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
128128
vsha1mq_u32_(hash_abcd, hash_e, wk)
@@ -132,8 +132,8 @@ pub unsafe fn vsha1mq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
132132
///
133133
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1pq_u32)
134134
#[inline]
135-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
136-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
135+
#[target_feature(enable = "sha2")]
136+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
137137
#[cfg_attr(test, assert_instr(sha1p))]
138138
pub unsafe fn vsha1pq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
139139
vsha1pq_u32_(hash_abcd, hash_e, wk)
@@ -143,8 +143,8 @@ pub unsafe fn vsha1pq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
143143
///
144144
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1su0q_u32)
145145
#[inline]
146-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
147-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
146+
#[target_feature(enable = "sha2")]
147+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
148148
#[cfg_attr(test, assert_instr(sha1su0))]
149149
pub unsafe fn vsha1su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t, w8_11: uint32x4_t) -> uint32x4_t {
150150
vsha1su0q_u32_(w0_3, w4_7, w8_11)
@@ -154,8 +154,8 @@ pub unsafe fn vsha1su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t, w8_11: uint32x4_
154154
///
155155
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1su1q_u32)
156156
#[inline]
157-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
158-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
157+
#[target_feature(enable = "sha2")]
158+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
159159
#[cfg_attr(test, assert_instr(sha1su1))]
160160
pub unsafe fn vsha1su1q_u32(tw0_3: uint32x4_t, w12_15: uint32x4_t) -> uint32x4_t {
161161
vsha1su1q_u32_(tw0_3, w12_15)
@@ -165,8 +165,8 @@ pub unsafe fn vsha1su1q_u32(tw0_3: uint32x4_t, w12_15: uint32x4_t) -> uint32x4_t
165165
///
166166
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256hq_u32)
167167
#[inline]
168-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
169-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
168+
#[target_feature(enable = "sha2")]
169+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
170170
#[cfg_attr(test, assert_instr(sha256h))]
171171
pub unsafe fn vsha256hq_u32(
172172
hash_abcd: uint32x4_t,
@@ -180,8 +180,8 @@ pub unsafe fn vsha256hq_u32(
180180
///
181181
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256h2q_u32)
182182
#[inline]
183-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
184-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
183+
#[target_feature(enable = "sha2")]
184+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
185185
#[cfg_attr(test, assert_instr(sha256h2))]
186186
pub unsafe fn vsha256h2q_u32(
187187
hash_efgh: uint32x4_t,
@@ -195,8 +195,8 @@ pub unsafe fn vsha256h2q_u32(
195195
///
196196
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256su0q_u32)
197197
#[inline]
198-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
199-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
198+
#[target_feature(enable = "sha2")]
199+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
200200
#[cfg_attr(test, assert_instr(sha256su0))]
201201
pub unsafe fn vsha256su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t) -> uint32x4_t {
202202
vsha256su0q_u32_(w0_3, w4_7)
@@ -206,8 +206,8 @@ pub unsafe fn vsha256su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t) -> uint32x4_t
206206
///
207207
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256su1q_u32)
208208
#[inline]
209-
#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
210-
#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
209+
#[target_feature(enable = "sha2")]
210+
#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
211211
#[cfg_attr(test, assert_instr(sha256su1))]
212212
pub unsafe fn vsha256su1q_u32(
213213
tw0_3: uint32x4_t,
@@ -224,8 +224,7 @@ mod tests {
224224
use std::mem;
225225
use stdarch_test::simd_test;
226226

227-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
228-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
227+
#[simd_test(enable = "aes")]
229228
unsafe fn test_vaeseq_u8() {
230229
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
231230
let key = mem::transmute(u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7));
@@ -238,8 +237,7 @@ mod tests {
238237
);
239238
}
240239

241-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
242-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
240+
#[simd_test(enable = "aes")]
243241
unsafe fn test_vaesdq_u8() {
244242
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
245243
let key = mem::transmute(u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7));
@@ -250,8 +248,7 @@ mod tests {
250248
);
251249
}
252250

253-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
254-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
251+
#[simd_test(enable = "aes")]
255252
unsafe fn test_vaesmcq_u8() {
256253
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
257254
let r: u8x16 = mem::transmute(vaesmcq_u8(data));
@@ -261,8 +258,7 @@ mod tests {
261258
);
262259
}
263260

264-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
265-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
261+
#[simd_test(enable = "aes")]
266262
unsafe fn test_vaesimcq_u8() {
267263
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
268264
let r: u8x16 = mem::transmute(vaesimcq_u8(data));
@@ -272,15 +268,13 @@ mod tests {
272268
);
273269
}
274270

275-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
276-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
271+
#[simd_test(enable = "sha2")]
277272
unsafe fn test_vsha1h_u32() {
278273
assert_eq!(vsha1h_u32(0x1234), 0x048d);
279274
assert_eq!(vsha1h_u32(0x5678), 0x159e);
280275
}
281276

282-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
283-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
277+
#[simd_test(enable = "sha2")]
284278
unsafe fn test_vsha1su0q_u32() {
285279
let r: u32x4 = mem::transmute(vsha1su0q_u32(
286280
mem::transmute(u32x4::new(0x1234_u32, 0x5678_u32, 0x9abc_u32, 0xdef0_u32)),
@@ -290,8 +284,7 @@ mod tests {
290284
assert_eq!(r, u32x4::new(0x9abc, 0xdef0, 0x1234, 0x5678));
291285
}
292286

293-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
294-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
287+
#[simd_test(enable = "sha2")]
295288
unsafe fn test_vsha1su1q_u32() {
296289
let r: u32x4 = mem::transmute(vsha1su1q_u32(
297290
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -303,8 +296,7 @@ mod tests {
303296
);
304297
}
305298

306-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
307-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
299+
#[simd_test(enable = "sha2")]
308300
unsafe fn test_vsha1cq_u32() {
309301
let r: u32x4 = mem::transmute(vsha1cq_u32(
310302
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -317,8 +309,7 @@ mod tests {
317309
);
318310
}
319311

320-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
321-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
312+
#[simd_test(enable = "sha2")]
322313
unsafe fn test_vsha1pq_u32() {
323314
let r: u32x4 = mem::transmute(vsha1pq_u32(
324315
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -331,8 +322,7 @@ mod tests {
331322
);
332323
}
333324

334-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
335-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
325+
#[simd_test(enable = "sha2")]
336326
unsafe fn test_vsha1mq_u32() {
337327
let r: u32x4 = mem::transmute(vsha1mq_u32(
338328
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -345,8 +335,7 @@ mod tests {
345335
);
346336
}
347337

348-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
349-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
338+
#[simd_test(enable = "sha2")]
350339
unsafe fn test_vsha256hq_u32() {
351340
let r: u32x4 = mem::transmute(vsha256hq_u32(
352341
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -359,8 +348,7 @@ mod tests {
359348
);
360349
}
361350

362-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
363-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
351+
#[simd_test(enable = "sha2")]
364352
unsafe fn test_vsha256h2q_u32() {
365353
let r: u32x4 = mem::transmute(vsha256h2q_u32(
366354
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -373,8 +361,7 @@ mod tests {
373361
);
374362
}
375363

376-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
377-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
364+
#[simd_test(enable = "sha2")]
378365
unsafe fn test_vsha256su0q_u32() {
379366
let r: u32x4 = mem::transmute(vsha256su0q_u32(
380367
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -386,8 +373,7 @@ mod tests {
386373
);
387374
}
388375

389-
#[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
390-
#[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
376+
#[simd_test(enable = "sha2")]
391377
unsafe fn test_vsha256su1q_u32() {
392378
let r: u32x4 = mem::transmute(vsha256su1q_u32(
393379
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),

0 commit comments

Comments
 (0)