@@ -24,57 +24,57 @@ pub(crate) fn detect_features() -> cache::Initializer {
24
24
///
25
25
/// [hwcap]: https://github.com/torvalds/linux/blob/master/arch/arm64/include/uapi/asm/hwcap.h
26
26
struct AtHwcap {
27
- fp : bool , // 0
28
- asimd : bool , // 1
29
- // evtstrm: bool, // 2 No LLVM support
30
- aes : bool , // 3
31
- pmull : bool , // 4
32
- sha1 : bool , // 5
33
- sha2 : bool , // 6
34
- crc32 : bool , // 7
35
- atomics : bool , // 8
36
- fphp : bool , // 9
37
- asimdhp : bool , // 10
38
- // cpuid: bool, // 11 No LLVM support
39
- asimdrdm : bool , // 12
40
- jscvt : bool , // 13
41
- fcma : bool , // 14
42
- lrcpc : bool , // 15
43
- dcpop : bool , // 16
44
- sha3 : bool , // 17
45
- sm3 : bool , // 18
46
- sm4 : bool , // 19
47
- asimddp : bool , // 20
48
- sha512 : bool , // 21
49
- sve : bool , // 22
50
- fhm : bool , // 23
51
- dit : bool , // 24
52
- uscat : bool , // 25
53
- ilrcpc : bool , // 26
54
- flagm : bool , // 27
55
- ssbs : bool , // 28
56
- sb : bool , // 29
57
- paca : bool , // 30
58
- pacg : bool , // 31
59
- dcpodp : bool , // 32
60
- sve2 : bool , // 33
61
- sveaes : bool , // 34
62
- // svepmull: bool, // 35 No LLVM support
27
+ fp : bool , // 0
28
+ asimd : bool , // 1
29
+ // evtstrm: bool, // 2 No LLVM support
30
+ aes : bool , // 3
31
+ pmull : bool , // 4
32
+ sha1 : bool , // 5
33
+ sha2 : bool , // 6
34
+ crc32 : bool , // 7
35
+ atomics : bool , // 8
36
+ fphp : bool , // 9
37
+ asimdhp : bool , // 10
38
+ // cpuid: bool, // 11 No LLVM support
39
+ asimdrdm : bool , // 12
40
+ jscvt : bool , // 13
41
+ fcma : bool , // 14
42
+ lrcpc : bool , // 15
43
+ dcpop : bool , // 16
44
+ sha3 : bool , // 17
45
+ sm3 : bool , // 18
46
+ sm4 : bool , // 19
47
+ asimddp : bool , // 20
48
+ sha512 : bool , // 21
49
+ sve : bool , // 22
50
+ fhm : bool , // 23
51
+ dit : bool , // 24
52
+ uscat : bool , // 25
53
+ ilrcpc : bool , // 26
54
+ flagm : bool , // 27
55
+ ssbs : bool , // 28
56
+ sb : bool , // 29
57
+ paca : bool , // 30
58
+ pacg : bool , // 31
59
+ dcpodp : bool , // 32
60
+ sve2 : bool , // 33
61
+ sveaes : bool , // 34
62
+ // svepmull: bool, // 35 No LLVM support
63
63
svebitperm : bool , // 36
64
64
svesha3 : bool , // 37
65
65
svesm4 : bool , // 38
66
- // flagm2: bool, // 39 No LLVM support
67
- frint : bool , // 40
68
- // svei8mm: bool, // 41 See i8mm feature
69
- svef32mm : bool , // 42
70
- svef64mm : bool , // 43
71
- // svebf16: bool, // 44 See bf16 feature
72
- i8mm : bool , // 45
73
- bf16 : bool , // 46
74
- // dgh: bool, // 47 No LLVM support
75
- rng : bool , // 48
76
- bti : bool , // 49
77
- mte : bool , // 50
66
+ // flagm2: bool, // 39 No LLVM support
67
+ frint : bool , // 40
68
+ // svei8mm: bool, // 41 See i8mm feature
69
+ svef32mm : bool , // 42
70
+ svef64mm : bool , // 43
71
+ // svebf16: bool, // 44 See bf16 feature
72
+ i8mm : bool , // 45
73
+ bf16 : bool , // 46
74
+ // dgh: bool, // 47 No LLVM support
75
+ rng : bool , // 48
76
+ bti : bool , // 49
77
+ mte : bool , // 50
78
78
}
79
79
80
80
impl From < auxvec:: AuxVec > for AtHwcap {
@@ -83,7 +83,7 @@ impl From<auxvec::AuxVec> for AtHwcap {
83
83
AtHwcap {
84
84
fp : bit:: test ( auxv. hwcap , 0 ) ,
85
85
asimd : bit:: test ( auxv. hwcap , 1 ) ,
86
- // evtstrm: bit::test(auxv.hwcap, 2),
86
+ // evtstrm: bit::test(auxv.hwcap, 2),
87
87
aes : bit:: test ( auxv. hwcap , 3 ) ,
88
88
pmull : bit:: test ( auxv. hwcap , 4 ) ,
89
89
sha1 : bit:: test ( auxv. hwcap , 5 ) ,
@@ -92,7 +92,7 @@ impl From<auxvec::AuxVec> for AtHwcap {
92
92
atomics : bit:: test ( auxv. hwcap , 8 ) ,
93
93
fphp : bit:: test ( auxv. hwcap , 9 ) ,
94
94
asimdhp : bit:: test ( auxv. hwcap , 10 ) ,
95
- // cpuid: bit::test(auxv.hwcap, 11),
95
+ // cpuid: bit::test(auxv.hwcap, 11),
96
96
asimdrdm : bit:: test ( auxv. hwcap , 12 ) ,
97
97
jscvt : bit:: test ( auxv. hwcap , 13 ) ,
98
98
fcma : bit:: test ( auxv. hwcap , 14 ) ,
@@ -116,19 +116,19 @@ impl From<auxvec::AuxVec> for AtHwcap {
116
116
dcpodp : bit:: test ( auxv. hwcap , 32 ) ,
117
117
sve2 : bit:: test ( auxv. hwcap , 33 ) ,
118
118
sveaes : bit:: test ( auxv. hwcap , 34 ) ,
119
- // svepmull: bit::test(auxv.hwcap, 35),
119
+ // svepmull: bit::test(auxv.hwcap, 35),
120
120
svebitperm : bit:: test ( auxv. hwcap , 36 ) ,
121
121
svesha3 : bit:: test ( auxv. hwcap , 37 ) ,
122
122
svesm4 : bit:: test ( auxv. hwcap , 38 ) ,
123
- // flagm2: bit::test(auxv.hwcap, 39),
123
+ // flagm2: bit::test(auxv.hwcap, 39),
124
124
frint : bit:: test ( auxv. hwcap , 40 ) ,
125
- // svei8mm: bit::test(auxv.hwcap, 41),
125
+ // svei8mm: bit::test(auxv.hwcap, 41),
126
126
svef32mm : bit:: test ( auxv. hwcap , 42 ) ,
127
127
svef64mm : bit:: test ( auxv. hwcap , 43 ) ,
128
- // svebf16: bit::test(auxv.hwcap, 44),
128
+ // svebf16: bit::test(auxv.hwcap, 44),
129
129
i8mm : bit:: test ( auxv. hwcap , 45 ) ,
130
130
bf16 : bit:: test ( auxv. hwcap , 46 ) ,
131
- // dgh: bit::test(auxv.hwcap, 47),
131
+ // dgh: bit::test(auxv.hwcap, 47),
132
132
rng : bit:: test ( auxv. hwcap , 48 ) ,
133
133
bti : bit:: test ( auxv. hwcap , 49 ) ,
134
134
mte : bit:: test ( auxv. hwcap , 50 ) ,
@@ -147,7 +147,7 @@ impl From<super::cpuinfo::CpuInfo> for AtHwcap {
147
147
// cover that yet.
148
148
fp : f. has ( "fp" ) ,
149
149
asimd : f. has ( "asimd" ) ,
150
- // evtstrm: f.has("evtstrm"),
150
+ // evtstrm: f.has("evtstrm"),
151
151
aes : f. has ( "aes" ) ,
152
152
pmull : f. has ( "pmull" ) ,
153
153
sha1 : f. has ( "sha1" ) ,
@@ -156,7 +156,7 @@ impl From<super::cpuinfo::CpuInfo> for AtHwcap {
156
156
atomics : f. has ( "atomics" ) ,
157
157
fphp : f. has ( "fphp" ) ,
158
158
asimdhp : f. has ( "asimdhp" ) ,
159
- // cpuid: f.has("cpuid"),
159
+ // cpuid: f.has("cpuid"),
160
160
asimdrdm : f. has ( "asimdrdm" ) ,
161
161
jscvt : f. has ( "jscvt" ) ,
162
162
fcma : f. has ( "fcma" ) ,
@@ -180,19 +180,19 @@ impl From<super::cpuinfo::CpuInfo> for AtHwcap {
180
180
dcpodp : f. has ( "dcpodp" ) ,
181
181
sve2 : f. has ( "sve2" ) ,
182
182
sveaes : f. has ( "sveaes" ) ,
183
- // svepmull: f.has("svepmull"),
183
+ // svepmull: f.has("svepmull"),
184
184
svebitperm : f. has ( "svebitperm" ) ,
185
185
svesha3 : f. has ( "svesha3" ) ,
186
186
svesm4 : f. has ( "svesm4" ) ,
187
- // flagm2: f.has("flagm2"),
187
+ // flagm2: f.has("flagm2"),
188
188
frint : f. has ( "frint" ) ,
189
- // svei8mm: f.has("svei8mm"),
189
+ // svei8mm: f.has("svei8mm"),
190
190
svef32mm : f. has ( "svef32mm" ) ,
191
191
svef64mm : f. has ( "svef64mm" ) ,
192
- // svebf16: f.has("svebf16"),
192
+ // svebf16: f.has("svebf16"),
193
193
i8mm : f. has ( "i8mm" ) ,
194
194
bf16 : f. has ( "bf16" ) ,
195
- // dgh: f.has("dgh"),
195
+ // dgh: f.has("dgh"),
196
196
rng : f. has ( "rng" ) ,
197
197
bti : f. has ( "bti" ) ,
198
198
mte : f. has ( "mte" ) ,
@@ -264,16 +264,25 @@ impl AtHwcap {
264
264
enable_feature ( Feature :: aes, self . aes && asimd) ;
265
265
enable_feature ( Feature :: sha2, self . sha1 && self . sha2 && asimd) ;
266
266
// SHA512/SHA3 require SHA1 & SHA256
267
- enable_feature ( Feature :: sha3, self . sha512 && self . sha3 && self . sha1 && self . sha2 && asimd) ;
267
+ enable_feature (
268
+ Feature :: sha3,
269
+ self . sha512 && self . sha3 && self . sha1 && self . sha2 && asimd,
270
+ ) ;
268
271
enable_feature ( Feature :: sm4, self . sm3 && self . sm4 && asimd) ;
269
272
270
273
// SVE2 requires SVE
271
274
let sve2 = self . sve2 && self . sve && asimd;
272
275
enable_feature ( Feature :: sve2, sve2) ;
273
276
// SVE2 extensions require SVE2 and crypto features
274
277
enable_feature ( Feature :: sve2_aes, self . sveaes && sve2 && self . aes ) ;
275
- enable_feature ( Feature :: sve2_sm4, self . svesm4 && sve2 && self . sm3 && self . sm4 ) ;
276
- enable_feature ( Feature :: sve2_sha3, self . svesha3 && sve2 && self . sha512 && self . sha3 && self . sha1 && self . sha2 ) ;
278
+ enable_feature (
279
+ Feature :: sve2_sm4,
280
+ self . svesm4 && sve2 && self . sm3 && self . sm4 ,
281
+ ) ;
282
+ enable_feature (
283
+ Feature :: sve2_sha3,
284
+ self . svesha3 && sve2 && self . sha512 && self . sha3 && self . sha1 && self . sha2 ,
285
+ ) ;
277
286
enable_feature ( Feature :: sve2_bitperm, self . svebitperm && self . sve2 ) ;
278
287
}
279
288
value
0 commit comments