Skip to content

Commit d7668d8

Browse files
authored
Rollup merge of #136199 - purplesyringa:emscripten-tests, r=jieyouxu
Fix a couple Emscripten tests This fixes a couple Emscripten tests where the correct fix is more or less obvious. A couple UI tests are still broken with this PR: - `tests/ui/abi/numbers-arithmetic/return-float.rs` (#136197) - `tests/ui/no_std/no-std-unwind-binary.rs` (haven't debugged yet) - `tests/ui/test-attrs/test-passed.rs` (haven't debugged this either) `````@rustbot````` label +T-compiler +O-emscripten
2 parents aab61ad + 644e527 commit d7668d8

File tree

6 files changed

+41
-10
lines changed

6 files changed

+41
-10
lines changed

Diff for: src/tools/compiletest/src/directive-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
177177
"only-bpf",
178178
"only-cdb",
179179
"only-dist",
180+
"only-emscripten",
180181
"only-gnu",
181182
"only-i686-pc-windows-gnu",
182183
"only-i686-pc-windows-msvc",

Diff for: tests/codegen/float/f128.rs

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// 32-bit x86 returns float types differently to avoid the x87 stack.
22
// 32-bit systems will return 128bit values using a return area pointer.
3-
//@ revisions: x86 bit32 bit64
3+
// Emscripten aligns f128 to 8 bytes, not 16.
4+
//@ revisions: x86 bit32 bit64 emscripten
45
//@[x86] only-x86
56
//@[bit32] ignore-x86
7+
//@[bit32] ignore-emscripten
68
//@[bit32] only-32bit
79
//@[bit64] ignore-x86
10+
//@[bit64] ignore-emscripten
811
//@[bit64] only-64bit
12+
//@[emscripten] only-emscripten
913

1014
// Verify that our intrinsics generate the correct LLVM calls for f128
1115

@@ -59,6 +63,7 @@ pub fn f128_le(a: f128, b: f128) -> bool {
5963
// x86-LABEL: void @f128_neg({{.*}}sret([16 x i8])
6064
// bit32-LABEL: void @f128_neg({{.*}}sret([16 x i8])
6165
// bit64-LABEL: fp128 @f128_neg(
66+
// emscripten-LABEL: void @f128_neg({{.*}}sret([16 x i8])
6267
#[no_mangle]
6368
pub fn f128_neg(a: f128) -> f128 {
6469
// CHECK: fneg fp128
@@ -68,6 +73,7 @@ pub fn f128_neg(a: f128) -> f128 {
6873
// x86-LABEL: void @f128_add({{.*}}sret([16 x i8])
6974
// bit32-LABEL: void @f128_add({{.*}}sret([16 x i8])
7075
// bit64-LABEL: fp128 @f128_add(
76+
// emscripten-LABEL: void @f128_add({{.*}}sret([16 x i8])
7177
#[no_mangle]
7278
pub fn f128_add(a: f128, b: f128) -> f128 {
7379
// CHECK: fadd fp128 %{{.+}}, %{{.+}}
@@ -77,6 +83,7 @@ pub fn f128_add(a: f128, b: f128) -> f128 {
7783
// x86-LABEL: void @f128_sub({{.*}}sret([16 x i8])
7884
// bit32-LABEL: void @f128_sub({{.*}}sret([16 x i8])
7985
// bit64-LABEL: fp128 @f128_sub(
86+
// emscripten-LABEL: void @f128_sub({{.*}}sret([16 x i8])
8087
#[no_mangle]
8188
pub fn f128_sub(a: f128, b: f128) -> f128 {
8289
// CHECK: fsub fp128 %{{.+}}, %{{.+}}
@@ -86,6 +93,7 @@ pub fn f128_sub(a: f128, b: f128) -> f128 {
8693
// x86-LABEL: void @f128_mul({{.*}}sret([16 x i8])
8794
// bit32-LABEL: void @f128_mul({{.*}}sret([16 x i8])
8895
// bit64-LABEL: fp128 @f128_mul(
96+
// emscripten-LABEL: void @f128_mul({{.*}}sret([16 x i8])
8997
#[no_mangle]
9098
pub fn f128_mul(a: f128, b: f128) -> f128 {
9199
// CHECK: fmul fp128 %{{.+}}, %{{.+}}
@@ -95,6 +103,7 @@ pub fn f128_mul(a: f128, b: f128) -> f128 {
95103
// x86-LABEL: void @f128_div({{.*}}sret([16 x i8])
96104
// bit32-LABEL: void @f128_div({{.*}}sret([16 x i8])
97105
// bit64-LABEL: fp128 @f128_div(
106+
// emscripten-LABEL: void @f128_div({{.*}}sret([16 x i8])
98107
#[no_mangle]
99108
pub fn f128_div(a: f128, b: f128) -> f128 {
100109
// CHECK: fdiv fp128 %{{.+}}, %{{.+}}
@@ -104,6 +113,7 @@ pub fn f128_div(a: f128, b: f128) -> f128 {
104113
// x86-LABEL: void @f128_rem({{.*}}sret([16 x i8])
105114
// bit32-LABEL: void @f128_rem({{.*}}sret([16 x i8])
106115
// bit64-LABEL: fp128 @f128_rem(
116+
// emscripten-LABEL: void @f128_rem({{.*}}sret([16 x i8])
107117
#[no_mangle]
108118
pub fn f128_rem(a: f128, b: f128) -> f128 {
109119
// CHECK: frem fp128 %{{.+}}, %{{.+}}
@@ -164,6 +174,7 @@ pub fn f128_as_f16(a: f128) -> f16 {
164174
// x86-LABEL: i32 @f128_as_f32(
165175
// bit32-LABEL: float @f128_as_f32(
166176
// bit64-LABEL: float @f128_as_f32(
177+
// emscripten-LABEL: float @f128_as_f32(
167178
#[no_mangle]
168179
pub fn f128_as_f32(a: f128) -> f32 {
169180
// CHECK: fptrunc fp128 %{{.+}} to float
@@ -173,6 +184,7 @@ pub fn f128_as_f32(a: f128) -> f32 {
173184
// x86-LABEL: void @f128_as_f64(
174185
// bit32-LABEL: double @f128_as_f64(
175186
// bit64-LABEL: double @f128_as_f64(
187+
// emscripten-LABEL: double @f128_as_f64(
176188
#[no_mangle]
177189
pub fn f128_as_f64(a: f128) -> f64 {
178190
// CHECK: fptrunc fp128 %{{.+}} to double
@@ -182,17 +194,20 @@ pub fn f128_as_f64(a: f128) -> f64 {
182194
// x86-LABEL: void @f128_as_self({{.*}}sret([16 x i8])
183195
// bit32-LABEL: void @f128_as_self({{.*}}sret([16 x i8])
184196
// bit64-LABEL: fp128 @f128_as_self(
197+
// emscripten-LABEL: void @f128_as_self({{.*}}sret([16 x i8])
185198
#[no_mangle]
186199
pub fn f128_as_self(a: f128) -> f128 {
187200
// x86: store fp128 %a, ptr %_0, align 16
188201
// bit32: store fp128 %a, ptr %_0, align 16
189202
// bit64: ret fp128 %{{.+}}
203+
// emscripten: store fp128 %a, ptr %_0, align 8
190204
a as f128
191205
}
192206

193207
// x86-LABEL: void @f16_as_f128({{.*}}sret([16 x i8])
194208
// bit32-LABEL: void @f16_as_f128({{.*}}sret([16 x i8])
195209
// bit64-LABEL: fp128 @f16_as_f128(
210+
// emscripten-LABEL: void @f16_as_f128({{.*}}sret([16 x i8])
196211
#[no_mangle]
197212
pub fn f16_as_f128(a: f16) -> f128 {
198213
// CHECK: fpext half %{{.+}} to fp128
@@ -202,6 +217,7 @@ pub fn f16_as_f128(a: f16) -> f128 {
202217
// x86-LABEL: void @f32_as_f128({{.*}}sret([16 x i8])
203218
// bit32-LABEL: void @f32_as_f128({{.*}}sret([16 x i8])
204219
// bit64-LABEL: fp128 @f32_as_f128(
220+
// emscripten-LABEL: void @f32_as_f128({{.*}}sret([16 x i8])
205221
#[no_mangle]
206222
pub fn f32_as_f128(a: f32) -> f128 {
207223
// CHECK: fpext float %{{.+}} to fp128
@@ -211,6 +227,7 @@ pub fn f32_as_f128(a: f32) -> f128 {
211227
// x86-LABEL: void @f64_as_f128({{.*}}sret([16 x i8])
212228
// bit32-LABEL: void @f64_as_f128({{.*}}sret([16 x i8])
213229
// bit64-LABEL: fp128 @f64_as_f128(
230+
// emscripten-LABEL: void @f64_as_f128({{.*}}sret([16 x i8])
214231
#[no_mangle]
215232
pub fn f64_as_f128(a: f64) -> f128 {
216233
// CHECK: fpext double %{{.+}} to fp128
@@ -249,6 +266,7 @@ pub fn f128_as_u64(a: f128) -> u64 {
249266
// x86-LABEL: void @f128_as_u128({{.*}}sret([16 x i8])
250267
// bit32-LABEL: void @f128_as_u128({{.*}}sret([16 x i8])
251268
// bit64-LABEL: i128 @f128_as_u128(
269+
// emscripten-LABEL: void @f128_as_u128({{.*}}sret([16 x i8])
252270
#[no_mangle]
253271
pub fn f128_as_u128(a: f128) -> u128 {
254272
// CHECK: call i128 @llvm.fptoui.sat.i128.f128(fp128 %{{.+}})
@@ -285,6 +303,7 @@ pub fn f128_as_i64(a: f128) -> i64 {
285303
// x86-LABEL: void @f128_as_i128({{.*}}sret([16 x i8])
286304
// bit32-LABEL: void @f128_as_i128({{.*}}sret([16 x i8])
287305
// bit64-LABEL: i128 @f128_as_i128(
306+
// emscripten-LABEL: void @f128_as_i128({{.*}}sret([16 x i8])
288307
#[no_mangle]
289308
pub fn f128_as_i128(a: f128) -> i128 {
290309
// CHECK: call i128 @llvm.fptosi.sat.i128.f128(fp128 %{{.+}})
@@ -296,6 +315,7 @@ pub fn f128_as_i128(a: f128) -> i128 {
296315
// x86-LABEL: void @u8_as_f128({{.*}}sret([16 x i8])
297316
// bit32-LABEL: void @u8_as_f128({{.*}}sret([16 x i8])
298317
// bit64-LABEL: fp128 @u8_as_f128(
318+
// emscripten-LABEL: void @u8_as_f128({{.*}}sret([16 x i8])
299319
#[no_mangle]
300320
pub fn u8_as_f128(a: u8) -> f128 {
301321
// CHECK: uitofp i8 %{{.+}} to fp128
@@ -305,6 +325,7 @@ pub fn u8_as_f128(a: u8) -> f128 {
305325
// x86-LABEL: void @u16_as_f128({{.*}}sret([16 x i8])
306326
// bit32-LABEL: void @u16_as_f128({{.*}}sret([16 x i8])
307327
// bit64-LABEL: fp128 @u16_as_f128(
328+
// emscripten-LABEL: void @u16_as_f128({{.*}}sret([16 x i8])
308329
#[no_mangle]
309330
pub fn u16_as_f128(a: u16) -> f128 {
310331
// CHECK: uitofp i16 %{{.+}} to fp128
@@ -314,6 +335,7 @@ pub fn u16_as_f128(a: u16) -> f128 {
314335
// x86-LABEL: void @u32_as_f128({{.*}}sret([16 x i8])
315336
// bit32-LABEL: void @u32_as_f128({{.*}}sret([16 x i8])
316337
// bit64-LABEL: fp128 @u32_as_f128(
338+
// emscripten-LABEL: void @u32_as_f128({{.*}}sret([16 x i8])
317339
#[no_mangle]
318340
pub fn u32_as_f128(a: u32) -> f128 {
319341
// CHECK: uitofp i32 %{{.+}} to fp128
@@ -323,6 +345,7 @@ pub fn u32_as_f128(a: u32) -> f128 {
323345
// x86-LABEL: void @u64_as_f128({{.*}}sret([16 x i8])
324346
// bit32-LABEL: void @u64_as_f128({{.*}}sret([16 x i8])
325347
// bit64-LABEL: fp128 @u64_as_f128(
348+
// emscripten-LABEL: void @u64_as_f128({{.*}}sret([16 x i8])
326349
#[no_mangle]
327350
pub fn u64_as_f128(a: u64) -> f128 {
328351
// CHECK: uitofp i64 %{{.+}} to fp128
@@ -332,6 +355,7 @@ pub fn u64_as_f128(a: u64) -> f128 {
332355
// x86-LABEL: void @u128_as_f128({{.*}}sret([16 x i8])
333356
// bit32-LABEL: void @u128_as_f128({{.*}}sret([16 x i8])
334357
// bit64-LABEL: fp128 @u128_as_f128(
358+
// emscripten-LABEL: void @u128_as_f128({{.*}}sret([16 x i8])
335359
#[no_mangle]
336360
pub fn u128_as_f128(a: u128) -> f128 {
337361
// CHECK: uitofp i128 %{{.+}} to fp128
@@ -341,6 +365,7 @@ pub fn u128_as_f128(a: u128) -> f128 {
341365
// x86-LABEL: void @i8_as_f128({{.*}}sret([16 x i8])
342366
// bit32-LABEL: void @i8_as_f128({{.*}}sret([16 x i8])
343367
// bit64-LABEL: fp128 @i8_as_f128(
368+
// emscripten-LABEL: void @i8_as_f128({{.*}}sret([16 x i8])
344369
#[no_mangle]
345370
pub fn i8_as_f128(a: i8) -> f128 {
346371
// CHECK: sitofp i8 %{{.+}} to fp128
@@ -350,6 +375,7 @@ pub fn i8_as_f128(a: i8) -> f128 {
350375
// x86-LABEL: void @i16_as_f128({{.*}}sret([16 x i8])
351376
// bit32-LABEL: void @i16_as_f128({{.*}}sret([16 x i8])
352377
// bit64-LABEL: fp128 @i16_as_f128(
378+
// emscripten-LABEL: void @i16_as_f128({{.*}}sret([16 x i8])
353379
#[no_mangle]
354380
pub fn i16_as_f128(a: i16) -> f128 {
355381
// CHECK: sitofp i16 %{{.+}} to fp128
@@ -359,6 +385,7 @@ pub fn i16_as_f128(a: i16) -> f128 {
359385
// x86-LABEL: void @i32_as_f128({{.*}}sret([16 x i8])
360386
// bit32-LABEL: void @i32_as_f128({{.*}}sret([16 x i8])
361387
// bit64-LABEL: fp128 @i32_as_f128(
388+
// emscripten-LABEL: void @i32_as_f128({{.*}}sret([16 x i8])
362389
#[no_mangle]
363390
pub fn i32_as_f128(a: i32) -> f128 {
364391
// CHECK: sitofp i32 %{{.+}} to fp128
@@ -368,6 +395,7 @@ pub fn i32_as_f128(a: i32) -> f128 {
368395
// x86-LABEL: void @i64_as_f128({{.*}}sret([16 x i8])
369396
// bit32-LABEL: void @i64_as_f128({{.*}}sret([16 x i8])
370397
// bit64-LABEL: fp128 @i64_as_f128(
398+
// emscripten-LABEL: void @i64_as_f128({{.*}}sret([16 x i8])
371399
#[no_mangle]
372400
pub fn i64_as_f128(a: i64) -> f128 {
373401
// CHECK: sitofp i64 %{{.+}} to fp128
@@ -377,6 +405,7 @@ pub fn i64_as_f128(a: i64) -> f128 {
377405
// x86-LABEL: void @i128_as_f128({{.*}}sret([16 x i8])
378406
// bit32-LABEL: void @i128_as_f128({{.*}}sret([16 x i8])
379407
// bit64-LABEL: fp128 @i128_as_f128(
408+
// emscripten-LABEL: void @i128_as_f128({{.*}}sret([16 x i8])
380409
#[no_mangle]
381410
pub fn i128_as_f128(a: i128) -> f128 {
382411
// CHECK: sitofp i128 %{{.+}} to fp128

Diff for: tests/codegen/wasm_exceptions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ only-wasm32
2-
//@ compile-flags: -C panic=unwind
2+
//@ compile-flags: -C panic=unwind -Z emscripten-wasm-eh
33

44
#![crate_type = "lib"]
55
#![feature(core_intrinsics)]

Diff for: tests/ui/privacy/sysroot-private.default.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0405]: cannot find trait `Equivalent` in this scope
2-
--> $DIR/sysroot-private.rs:26:18
2+
--> $DIR/sysroot-private.rs:27:18
33
|
44
LL | trait Trait2<K>: Equivalent<K> {}
55
| ^^^^^^^^^^ not found in this scope
66

77
error[E0412]: cannot find type `K` in this scope
8-
--> $DIR/sysroot-private.rs:31:35
8+
--> $DIR/sysroot-private.rs:32:35
99
|
1010
LL | fn trait_member<T>(val: &T, key: &K) -> bool {
1111
| - ^
@@ -22,13 +22,13 @@ LL | fn trait_member<T, K>(val: &T, key: &K) -> bool {
2222
| +++
2323

2424
error[E0220]: associated type `ExpressionStack` not found for `Trait`
25-
--> $DIR/sysroot-private.rs:21:31
25+
--> $DIR/sysroot-private.rs:22:31
2626
|
2727
LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>;
2828
| ^^^^^^^^^^^^^^^ help: `Trait` has the following associated type: `Bar`
2929

3030
error[E0425]: cannot find function `memchr2` in this scope
31-
--> $DIR/sysroot-private.rs:39:5
31+
--> $DIR/sysroot-private.rs:40:5
3232
|
3333
LL | memchr2(b'a', b'b', buf)
3434
| ^^^^^^^ not found in this scope

Diff for: tests/ui/privacy/sysroot-private.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//! of `std`'s dependencies, but may not be robust against dependency upgrades/changes.
88
99
//@ only-unix Windows sysroots seem to not expose this dependency
10+
//@ ignore-emscripten neither does Emscripten
1011
//@ revisions: default rustc_private_enabled
1112

1213
// Enabling `rustc_private` should `std`'s dependencies accessible, so they should show up

Diff for: tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0405]: cannot find trait `Equivalent` in this scope
2-
--> $DIR/sysroot-private.rs:26:18
2+
--> $DIR/sysroot-private.rs:27:18
33
|
44
LL | trait Trait2<K>: Equivalent<K> {}
55
| ^^^^^^^^^^ not found in this scope
66

77
error[E0412]: cannot find type `K` in this scope
8-
--> $DIR/sysroot-private.rs:31:35
8+
--> $DIR/sysroot-private.rs:32:35
99
|
1010
LL | fn trait_member<T>(val: &T, key: &K) -> bool {
1111
| - ^
@@ -22,13 +22,13 @@ LL | fn trait_member<T, K>(val: &T, key: &K) -> bool {
2222
| +++
2323

2424
error[E0220]: associated type `ExpressionStack` not found for `Trait`
25-
--> $DIR/sysroot-private.rs:21:31
25+
--> $DIR/sysroot-private.rs:22:31
2626
|
2727
LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>;
2828
| ^^^^^^^^^^^^^^^ there is an associated type `ExpressionStack` in the trait `gimli::read::op::EvaluationStorage`
2929

3030
error[E0425]: cannot find function `memchr2` in this scope
31-
--> $DIR/sysroot-private.rs:39:5
31+
--> $DIR/sysroot-private.rs:40:5
3232
|
3333
LL | memchr2(b'a', b'b', buf)
3434
| ^^^^^^^ not found in this scope

0 commit comments

Comments
 (0)