@@ -5,20 +5,18 @@ use crate::arch::asm;
5
5
/// Reads the lower 32-bit stable counter value and the counter ID
6
6
#[ inline]
7
7
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
8
- pub unsafe fn rdtimel_w ( ) -> ( i32 , isize ) {
9
- let val: i32 ;
10
- let tid: isize ;
11
- asm ! ( "rdtimel.w {}, {}" , out( reg) val, out( reg) tid, options( readonly, nostack) ) ;
8
+ pub fn rdtimel_w ( ) -> ( i32 , isize ) {
9
+ let ( val, tid) : ( i32 , isize ) ;
10
+ unsafe { asm ! ( "rdtimel.w {}, {}" , out( reg) val, out( reg) tid, options( readonly, nostack) ) } ;
12
11
( val, tid)
13
12
}
14
13
15
14
/// Reads the upper 32-bit stable counter value and the counter ID
16
15
#[ inline]
17
16
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
18
- pub unsafe fn rdtimeh_w ( ) -> ( i32 , isize ) {
19
- let val: i32 ;
20
- let tid: isize ;
21
- asm ! ( "rdtimeh.w {}, {}" , out( reg) val, out( reg) tid, options( readonly, nostack) ) ;
17
+ pub fn rdtimeh_w ( ) -> ( i32 , isize ) {
18
+ let ( val, tid) : ( i32 , isize ) ;
19
+ unsafe { asm ! ( "rdtimeh.w {}, {}" , out( reg) val, out( reg) tid, options( readonly, nostack) ) } ;
22
20
( val, tid)
23
21
}
24
22
@@ -75,59 +73,59 @@ unsafe extern "unadjusted" {
75
73
/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320)
76
74
#[ inline]
77
75
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
78
- pub unsafe fn crc_w_b_w ( a : i32 , b : i32 ) -> i32 {
79
- __crc_w_b_w ( a, b)
76
+ pub fn crc_w_b_w ( a : i32 , b : i32 ) -> i32 {
77
+ unsafe { __crc_w_b_w ( a, b) }
80
78
}
81
79
82
80
/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320)
83
81
#[ inline]
84
82
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
85
- pub unsafe fn crc_w_h_w ( a : i32 , b : i32 ) -> i32 {
86
- __crc_w_h_w ( a, b)
83
+ pub fn crc_w_h_w ( a : i32 , b : i32 ) -> i32 {
84
+ unsafe { __crc_w_h_w ( a, b) }
87
85
}
88
86
89
87
/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320)
90
88
#[ inline]
91
89
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
92
- pub unsafe fn crc_w_w_w ( a : i32 , b : i32 ) -> i32 {
93
- __crc_w_w_w ( a, b)
90
+ pub fn crc_w_w_w ( a : i32 , b : i32 ) -> i32 {
91
+ unsafe { __crc_w_w_w ( a, b) }
94
92
}
95
93
96
94
/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78)
97
95
#[ inline]
98
96
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
99
- pub unsafe fn crcc_w_b_w ( a : i32 , b : i32 ) -> i32 {
100
- __crcc_w_b_w ( a, b)
97
+ pub fn crcc_w_b_w ( a : i32 , b : i32 ) -> i32 {
98
+ unsafe { __crcc_w_b_w ( a, b) }
101
99
}
102
100
103
101
/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78)
104
102
#[ inline]
105
103
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
106
- pub unsafe fn crcc_w_h_w ( a : i32 , b : i32 ) -> i32 {
107
- __crcc_w_h_w ( a, b)
104
+ pub fn crcc_w_h_w ( a : i32 , b : i32 ) -> i32 {
105
+ unsafe { __crcc_w_h_w ( a, b) }
108
106
}
109
107
110
108
/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78)
111
109
#[ inline]
112
110
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
113
- pub unsafe fn crcc_w_w_w ( a : i32 , b : i32 ) -> i32 {
114
- __crcc_w_w_w ( a, b)
111
+ pub fn crcc_w_w_w ( a : i32 , b : i32 ) -> i32 {
112
+ unsafe { __crcc_w_w_w ( a, b) }
115
113
}
116
114
117
115
/// Generates the memory barrier instruction
118
116
#[ inline]
119
117
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
120
- pub unsafe fn dbar < const IMM15 : i32 > ( ) {
118
+ pub fn dbar < const IMM15 : i32 > ( ) {
121
119
static_assert_uimm_bits ! ( IMM15 , 15 ) ;
122
- __dbar ( IMM15 ) ;
120
+ unsafe { __dbar ( IMM15 ) } ;
123
121
}
124
122
125
123
/// Generates the instruction-fetch barrier instruction
126
124
#[ inline]
127
125
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
128
- pub unsafe fn ibar < const IMM15 : i32 > ( ) {
126
+ pub fn ibar < const IMM15 : i32 > ( ) {
129
127
static_assert_uimm_bits ! ( IMM15 , 15 ) ;
130
- __ibar ( IMM15 ) ;
128
+ unsafe { __ibar ( IMM15 ) } ;
131
129
}
132
130
133
131
/// Moves data from a GPR to the FCSR
@@ -141,9 +139,9 @@ pub unsafe fn movgr2fcsr<const IMM5: i32>(a: i32) {
141
139
/// Moves data from a FCSR to the GPR
142
140
#[ inline]
143
141
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
144
- pub unsafe fn movfcsr2gr < const IMM5 : i32 > ( ) -> i32 {
142
+ pub fn movfcsr2gr < const IMM5 : i32 > ( ) -> i32 {
145
143
static_assert_uimm_bits ! ( IMM5 , 5 ) ;
146
- __movfcsr2gr ( IMM5 )
144
+ unsafe { __movfcsr2gr ( IMM5 ) }
147
145
}
148
146
149
147
/// Reads the 8-bit IO-CSR
@@ -199,8 +197,8 @@ pub unsafe fn brk<const IMM15: i32>() {
199
197
/// Reads the CPU configuration register
200
198
#[ inline]
201
199
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
202
- pub unsafe fn cpucfg ( a : i32 ) -> i32 {
203
- __cpucfg ( a)
200
+ pub fn cpucfg ( a : i32 ) -> i32 {
201
+ unsafe { __cpucfg ( a) }
204
202
}
205
203
206
204
/// Generates the syscall instruction
@@ -215,30 +213,30 @@ pub unsafe fn syscall<const IMM15: i32>() {
215
213
#[ inline]
216
214
#[ target_feature( enable = "frecipe" ) ]
217
215
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
218
- pub unsafe fn frecipe_s ( a : f32 ) -> f32 {
219
- __frecipe_s ( a)
216
+ pub fn frecipe_s ( a : f32 ) -> f32 {
217
+ unsafe { __frecipe_s ( a) }
220
218
}
221
219
222
220
/// Calculate the approximate double-precision result of 1.0 divided
223
221
#[ inline]
224
222
#[ target_feature( enable = "frecipe" ) ]
225
223
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
226
- pub unsafe fn frecipe_d ( a : f64 ) -> f64 {
227
- __frecipe_d ( a)
224
+ pub fn frecipe_d ( a : f64 ) -> f64 {
225
+ unsafe { __frecipe_d ( a) }
228
226
}
229
227
230
228
/// Calculate the approximate single-precision result of dividing 1.0 by the square root
231
229
#[ inline]
232
230
#[ target_feature( enable = "frecipe" ) ]
233
231
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
234
- pub unsafe fn frsqrte_s ( a : f32 ) -> f32 {
235
- __frsqrte_s ( a)
232
+ pub fn frsqrte_s ( a : f32 ) -> f32 {
233
+ unsafe { __frsqrte_s ( a) }
236
234
}
237
235
238
236
/// Calculate the approximate double-precision result of dividing 1.0 by the square root
239
237
#[ inline]
240
238
#[ target_feature( enable = "frecipe" ) ]
241
239
#[ unstable( feature = "stdarch_loongarch" , issue = "117427" ) ]
242
- pub unsafe fn frsqrte_d ( a : f64 ) -> f64 {
243
- __frsqrte_d ( a)
240
+ pub fn frsqrte_d ( a : f64 ) -> f64 {
241
+ unsafe { __frsqrte_d ( a) }
244
242
}
0 commit comments