Skip to content

[test][IRGen] Cover more tests for WebAssembly target #69061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/IRGen/c_layout.sil
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,22 @@ bb0:
// CHECK-s390x-LABEL: declare{{( dllimport)?}} signext i32 @ints(i32 signext)
// CHECK-s390x-LABEL: declare{{( dllimport)?}} zeroext i32 @unsigneds(i32 zeroext)

// CHECK-wasm32-LABEL: define swiftcc void @testIntegerExtension(i8 %0, i8 %1, i8 %2, i16 %3, i16 %4, i32 %5, i32 %6) #0 {
// CHECK-wasm32: call signext i8 @chareth(i8 signext %0)
// CHECK-wasm32: call signext i8 @signedChareth(i8 signext %1)
// CHECK-wasm32: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-wasm32: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-wasm32: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-wasm32: call i32 @ints(i32 %5)
// CHECK-wasm32: call i32 @unsigneds(i32 %6)
// CHECK-wasm32-LABEL: declare signext i8 @chareth(i8 signext) #0
// CHECK-wasm32-LABEL: declare signext i8 @signedChareth(i8 signext) #0
// CHECK-wasm32-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext) #0
// CHECK-wasm32-LABEL: declare signext i16 @eatMyShorts(i16 signext) #0
// CHECK-wasm32-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext) #0
// CHECK-wasm32-LABEL: declare i32 @ints(i32) #0
// CHECK-wasm32-LABEL: declare i32 @unsigneds(i32) #0

sil @testIntegerExtension : $@convention(thin) (CChar, CSignedChar, CUnsignedChar, CShort, CUnsignedShort, CInt, CUnsignedInt) -> () {
entry(%a : $CChar, %b : $CSignedChar, %c : $CUnsignedChar, %d : $CShort, %e : $CUnsignedShort, %f : $CInt, %g : $CUnsignedInt):
%h = function_ref @chareth : $@convention(c) (CChar) -> CChar
Expand Down
3 changes: 3 additions & 0 deletions test/IRGen/errors.sil
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ entry:
// CHECK-LABEL-aarch64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-arm64_32: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-arm64e: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-wasm32: define swiftcc void @does_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
sil @does_throw : $@convention(thin) () -> @error Error {
// CHECK: [[T0:%.*]] = call swiftcc ptr @create_error()
%0 = function_ref @create_error : $@convention(thin) () -> @owned Error
Expand All @@ -49,6 +50,7 @@ sil @does_throw : $@convention(thin) () -> @error Error {
// CHECK-LABEL-aarch64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-arm64e: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-arm64_32: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
// CHECK-LABEL-wasm32: define swiftcc void @doesnt_throw(ptr swiftself %0, ptr swifterror %1) {{.*}} {
sil @doesnt_throw : $@convention(thin) () -> @error Error {
// We don't have to do anything here because the caller always
// zeroes the error slot before a call.
Expand All @@ -74,6 +76,7 @@ entry(%0 : $AnyObject):
// CHECK-aarch64: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] ptr, align
// CHECK-arm64_32: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] ptr, align
// CHECK-powerpc64le: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] ptr, align
// CHECK-wasm32: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] ptr, align
// CHECK-NEXT: store ptr null, ptr [[ERRORSLOT]], align

// CHECK-objc-NEXT: [[RESULT:%.*]] = call swiftcc ptr @try_apply_helper(ptr %0, ptr swiftself undef, ptr noalias nocapture [[SWIFTERROR]]{{( )?}}dereferenceable({{.}}) [[ERRORSLOT]])
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/has_symbol_clang.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public func testClangDecls() {
}

// --- clangFunc(_:) ---
// CHECK: define linkonce_odr hidden i1 @"$sSo9clangFuncyys5Int32VFTwS"() #1 {
// CHECK: define linkonce_odr hidden i1 @"$sSo9clangFuncyys5Int32VFTwS"() #1{{( comdat)?}} {
// CHECK: ret i1 icmp ne (ptr @clangFunc, ptr null)
4 changes: 4 additions & 0 deletions test/IRGen/objc_simd.sil
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func forceStuff(x: float4, y: float3) -> (Float, Float, Float, Float) {
// powerpc64-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0)
// powerpc64le-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0)
// s390x-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0)
// wasm32-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0)
sil @simd_c_args : $@convention(c) (float4) -> float4 {
entry(%x : $float4):
return %x : $float4
Expand All @@ -47,6 +48,7 @@ entry(%x : $float4):
// powerpc64-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0)
// powerpc64le-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0)
// s390x-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0)
// wasm32-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0)
sil @simd_c_args_float3 : $@convention(c) (float3) -> float3 {
entry(%x : $float3):
// x86_64: [[COERCE:%.*]] = alloca <3 x float>, align 16
Expand All @@ -66,6 +68,7 @@ entry(%x : $float3):
// powerpc64-LABEL: define{{( dllexport)?}}{{( protected)?}} void @simd_native_args(ptr noalias nocapture sret({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) %1)
// powerpc64le-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3)
// s390x-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3)
// wasm32-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3)
sil @simd_native_args : $@convention(thin) (float4) -> float4 {
entry(%x : $float4):
%f = function_ref @simd_c_args : $@convention(c) (float4) -> float4
Expand All @@ -84,6 +87,7 @@ entry(%x : $float4):
// powerpc64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2)
// powerpc64le-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2)
// s390x-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2)
// wasm32-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2)
sil @simd_native_args_float3 : $@convention(thin) (float3) -> float3 {
entry(%x : $float3):
%f = function_ref @simd_c_args_float3 : $@convention(c) (float3) -> float3
Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/protocol_resilience.sil
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ import resilient_protocol
// CHECK-SAME: %swift.protocol_requirement { i32 {{(-1745420271)|(17)}}, i32 0 },

// CHECK-SAME: %swift.protocol_requirement { i32 {{(-544407535)|(17)}},
// CHECK-SAME: i32{{ | trunc \(i64 }}sub ([[INT]] ptrtoint (ptr @defaultC to [[INT]]),
// CHECK-SAME: {{(i32( | trunc \(i64 )sub \()?}}[[INT]] ptrtoint (ptr @defaultC to [[INT]])
// CHECK-SAME: },

// CHECK-SAME: %swift.protocol_requirement { i32 {{(1717370897)|(17)}},
// CHECK-SAME: i32{{ | trunc \(i64 }}sub ([[INT]] ptrtoint (ptr @defaultD to [[INT]]),
// CHECK-SAME: {{(i32( | trunc \(i64 )sub \()?}}[[INT]] ptrtoint (ptr @defaultD to [[INT]])
// CHECK-SAME: },

// CHECK-SAME: %swift.protocol_requirement { i32 {{(297926657)|(1)}},
// CHECK-SAME: i32{{ | trunc \(i64 }}sub ([[INT]] ptrtoint (ptr @defaultE to [[INT]]),
// CHECK-SAME: {{(i32( | trunc \(i64 )sub \()?}}[[INT]] ptrtoint (ptr @defaultE to [[INT]])
// CHECK-SAME: },

// CHECK-SAME: %swift.protocol_requirement { i32 {{(351797249)|(1)}},
// CHECK-SAME: i32{{ | trunc \(i64 }}sub ([[INT]] ptrtoint (ptr @defaultF to [[INT]]),
// CHECK-SAME: {{(i32( | trunc \(i64 )sub \()?}}[[INT]] ptrtoint (ptr @defaultF to [[INT]])
// CHECK-SAME: }
// CHECK-SAME: }

Expand Down