Skip to content

Commit f51bf86

Browse files
authored
Merge pull request #2140 from heiher/fix-legacy-const-index
loongarch: Fix visibility and legacy const generic index
2 parents 6cf0988 + dd0dc62 commit f51bf86

3 files changed

Lines changed: 49 additions & 49 deletions

File tree

crates/core_arch/src/loongarch64/lasx/portable.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const unsafe fn simd_pickod_h<T: Copy>(a: T, b: T) -> T {
6969

7070
#[inline(always)]
7171
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
72-
pub(crate) const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
72+
const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
7373
simd_shuffle!(
7474
b,
7575
a,
@@ -82,25 +82,25 @@ pub(crate) const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
8282

8383
#[inline(always)]
8484
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
85-
pub(crate) const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
85+
const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
8686
simd_shuffle!(b, a, [4, 20, 5, 21, 6, 22, 7, 23, 12, 28, 13, 29, 14, 30, 15, 31])
8787
}
8888

8989
#[inline(always)]
9090
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
91-
pub(crate) const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
91+
const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
9292
simd_shuffle!(b, a, [2, 10, 3, 11, 6, 14, 7, 15])
9393
}
9494

9595
#[inline(always)]
9696
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
97-
pub(crate) const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
97+
const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
9898
simd_shuffle!(b, a, [1, 5, 3, 7])
9999
}
100100

101101
#[inline(always)]
102102
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
103-
pub(crate) const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
103+
const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
104104
simd_shuffle!(
105105
b,
106106
a,
@@ -113,25 +113,25 @@ pub(crate) const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
113113

114114
#[inline(always)]
115115
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
116-
pub(crate) const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
116+
const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
117117
simd_shuffle!(b, a, [0, 16, 1, 17, 2, 18, 3, 19, 8, 24, 9, 25, 10, 26, 11, 27])
118118
}
119119

120120
#[inline(always)]
121121
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
122-
pub(crate) const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
122+
const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
123123
simd_shuffle!(b, a, [0, 8, 1, 9, 4, 12, 5, 13])
124124
}
125125

126126
#[inline(always)]
127127
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
128-
pub(crate) const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
128+
const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
129129
simd_shuffle!(b, a, [0, 4, 2, 6])
130130
}
131131

132132
#[inline(always)]
133133
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
134-
pub(crate) const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
134+
const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
135135
simd_shuffle!(
136136
a,
137137
a,
@@ -145,7 +145,7 @@ pub(crate) const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
145145

146146
#[inline(always)]
147147
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
148-
pub(crate) const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
148+
const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
149149
simd_shuffle!(
150150
a,
151151
a,
@@ -158,19 +158,19 @@ pub(crate) const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
158158

159159
#[inline(always)]
160160
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
161-
pub(crate) const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
161+
const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
162162
simd_shuffle!(a, a, [I, I, I, I, I + 4, I + 4, I + 4, I + 4])
163163
}
164164

165165
#[inline(always)]
166166
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
167-
pub(crate) const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
167+
const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
168168
simd_shuffle!(a, a, [I, I, I + 2, I + 2])
169169
}
170170

171171
#[inline(always)]
172172
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
173-
pub(super) const unsafe fn simd_replve0_b<T: Copy>(a: T) -> T {
173+
const unsafe fn simd_replve0_b<T: Copy>(a: T) -> T {
174174
simd_shuffle!(
175175
a,
176176
a,
@@ -183,31 +183,31 @@ pub(super) const unsafe fn simd_replve0_b<T: Copy>(a: T) -> T {
183183

184184
#[inline(always)]
185185
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
186-
pub(super) const unsafe fn simd_replve0_h<T: Copy>(a: T) -> T {
186+
const unsafe fn simd_replve0_h<T: Copy>(a: T) -> T {
187187
simd_shuffle!(a, a, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
188188
}
189189

190190
#[inline(always)]
191191
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
192-
pub(super) const unsafe fn simd_replve0_w<T: Copy>(a: T) -> T {
192+
const unsafe fn simd_replve0_w<T: Copy>(a: T) -> T {
193193
simd_shuffle!(a, a, [0, 0, 0, 0, 0, 0, 0, 0])
194194
}
195195

196196
#[inline(always)]
197197
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
198-
pub(super) const unsafe fn simd_replve0_d<T: Copy>(a: T) -> T {
198+
const unsafe fn simd_replve0_d<T: Copy>(a: T) -> T {
199199
simd_shuffle!(a, a, [0, 0, 0, 0])
200200
}
201201

202202
#[inline(always)]
203203
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
204-
pub(super) const unsafe fn simd_replve0_q<T: Copy>(a: T) -> T {
204+
const unsafe fn simd_replve0_q<T: Copy>(a: T) -> T {
205205
simd_shuffle!(a, a, [0, 1, 0, 1])
206206
}
207207

208208
#[inline(always)]
209209
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
210-
pub(crate) const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
210+
const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
211211
simd_shuffle!(
212212
b,
213213
a,
@@ -220,25 +220,25 @@ pub(crate) const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
220220

221221
#[inline(always)]
222222
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
223-
pub(crate) const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
223+
const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
224224
simd_shuffle!(b, a, [0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30])
225225
}
226226

227227
#[inline(always)]
228228
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
229-
pub(crate) const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
229+
const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
230230
simd_shuffle!(b, a, [0, 8, 2, 10, 4, 12, 6, 14])
231231
}
232232

233233
#[inline(always)]
234234
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
235-
pub(crate) const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
235+
const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
236236
simd_shuffle!(b, a, [0, 4, 2, 6])
237237
}
238238

239239
#[inline(always)]
240240
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
241-
pub(crate) const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
241+
const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
242242
simd_shuffle!(
243243
b,
244244
a,
@@ -251,19 +251,19 @@ pub(crate) const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
251251

252252
#[inline(always)]
253253
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
254-
pub(crate) const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
254+
const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
255255
simd_shuffle!(b, a, [1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31])
256256
}
257257

258258
#[inline(always)]
259259
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
260-
pub(crate) const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
260+
const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
261261
simd_shuffle!(b, a, [1, 9, 3, 11, 5, 13, 7, 15])
262262
}
263263

264264
#[inline(always)]
265265
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
266-
pub(crate) const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
266+
const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
267267
simd_shuffle!(b, a, [1, 5, 3, 7])
268268
}
269269

crates/core_arch/src/loongarch64/lsx/portable.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,121 +55,121 @@ const unsafe fn simd_pickod_d<T: Copy>(a: T, b: T) -> T {
5555

5656
#[inline(always)]
5757
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
58-
pub(crate) const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
58+
const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
5959
simd_shuffle!(b, a, [8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31])
6060
}
6161

6262
#[inline(always)]
6363
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
64-
pub(crate) const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
64+
const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
6565
simd_shuffle!(b, a, [4, 12, 5, 13, 6, 14, 7, 15])
6666
}
6767

6868
#[inline(always)]
6969
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
70-
pub(crate) const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
70+
const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
7171
simd_shuffle!(b, a, [2, 6, 3, 7])
7272
}
7373

7474
#[inline(always)]
7575
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
76-
pub(crate) const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
76+
const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
7777
simd_shuffle!(b, a, [1, 3])
7878
}
7979

8080
#[inline(always)]
8181
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
82-
pub(crate) const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
82+
const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
8383
simd_shuffle!(b, a, [0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23])
8484
}
8585

8686
#[inline(always)]
8787
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
88-
pub(crate) const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
88+
const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
8989
simd_shuffle!(b, a, [0, 8, 1, 9, 2, 10, 3, 11])
9090
}
9191

9292
#[inline(always)]
9393
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
94-
pub(crate) const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
94+
const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
9595
simd_shuffle!(b, a, [0, 4, 1, 5])
9696
}
9797

9898
#[inline(always)]
9999
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
100-
pub(crate) const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
100+
const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
101101
simd_shuffle!(b, a, [0, 2])
102102
}
103103

104104
#[inline(always)]
105105
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
106-
pub(crate) const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
106+
const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
107107
simd_shuffle!(a, a, [I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I])
108108
}
109109

110110
#[inline(always)]
111111
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
112-
pub(crate) const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
112+
const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
113113
simd_shuffle!(a, a, [I, I, I, I, I, I, I, I])
114114
}
115115

116116
#[inline(always)]
117117
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
118-
pub(crate) const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
118+
const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
119119
simd_shuffle!(a, a, [I, I, I, I])
120120
}
121121

122122
#[inline(always)]
123123
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
124-
pub(crate) const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
124+
const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
125125
simd_shuffle!(a, a, [I, I])
126126
}
127127

128128
#[inline(always)]
129129
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
130-
pub(crate) const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
130+
const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
131131
simd_shuffle!(b, a, [0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30])
132132
}
133133

134134
#[inline(always)]
135135
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
136-
pub(crate) const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
136+
const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
137137
simd_shuffle!(b, a, [0, 8, 2, 10, 4, 12, 6, 14])
138138
}
139139

140140
#[inline(always)]
141141
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
142-
pub(crate) const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
142+
const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
143143
simd_shuffle!(b, a, [0, 4, 2, 6])
144144
}
145145

146146
#[inline(always)]
147147
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
148-
pub(crate) const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
148+
const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
149149
simd_shuffle!(b, a, [0, 2])
150150
}
151151

152152
#[inline(always)]
153153
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
154-
pub(crate) const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
154+
const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
155155
simd_shuffle!(b, a, [1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31])
156156
}
157157

158158
#[inline(always)]
159159
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
160-
pub(crate) const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
160+
const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
161161
simd_shuffle!(b, a, [1, 9, 3, 11, 5, 13, 7, 15])
162162
}
163163

164164
#[inline(always)]
165165
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
166-
pub(crate) const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
166+
const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
167167
simd_shuffle!(b, a, [1, 5, 3, 7])
168168
}
169169

170170
#[inline(always)]
171171
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
172-
pub(crate) const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
172+
const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
173173
simd_shuffle!(b, a, [1, 3])
174174
}
175175

crates/core_arch/src/loongarch64/simd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ impl_simd_ext!(u64x4, u64);
4848

4949
#[inline(always)]
5050
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
51-
pub(crate) const unsafe fn simd_abs<T: Copy + const SimdExt>(a: T) -> T {
51+
pub(super) const unsafe fn simd_abs<T: Copy + const SimdExt>(a: T) -> T {
5252
let m: T = is::simd_lt(a, ls::simd_splat(0));
5353
is::simd_select(m, is::simd_neg(a), a)
5454
}
5555

5656
#[inline(always)]
5757
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
58-
pub(crate) const unsafe fn simd_absd<T: Copy>(a: T, b: T) -> T {
58+
pub(super) const unsafe fn simd_absd<T: Copy>(a: T, b: T) -> T {
5959
let m: T = is::simd_gt(a, b);
6060
is::simd_select(m, is::simd_sub(a, b), is::simd_sub(b, a))
6161
}
6262

6363
#[inline(always)]
6464
#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
65-
pub(crate) const unsafe fn simd_adda<T: Copy + const SimdExt>(a: T, b: T) -> T {
65+
pub(super) const unsafe fn simd_adda<T: Copy + const SimdExt>(a: T, b: T) -> T {
6666
is::simd_add(ls::simd_abs(a), ls::simd_abs(b))
6767
}
6868

@@ -358,7 +358,7 @@ macro_rules! impl_vugv {
358358
($ft:literal, $name:ident, $op:path, $oty:ty, $ity:ident, $gty:ty, $ibs:expr) => {
359359
#[inline]
360360
#[target_feature(enable = $ft)]
361-
#[rustc_legacy_const_generics(1)]
361+
#[rustc_legacy_const_generics(2)]
362362
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
363363
pub fn $name<const IMM: u32>(a: $oty, b: $gty) -> $oty {
364364
static_assert_uimm_bits!(IMM, $ibs);

0 commit comments

Comments
 (0)