Skip to content

Commit 5e26417

Browse files
authored
Augment abitypes.swift to support testing on watch simulator... (#65768)
...when running on Apple Silicon Addresses rdar://108794689
2 parents 2407256 + ec4bf2e commit 5e26417

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

test/IRGen/abitypes.swift

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Foundation
1818
// arm64-tvos: [[ARM64_MYRECT:%.*]] = type { float, float, float, float }
1919
// armv7k-watchos: [[ARMV7K_MYRECT:%.*]] = type { float, float, float, float }
2020
// arm64_32-watchos: [[ARM64_MYRECT:%.*]] = type { float, float, float, float }
21+
// arm64-watchos: [[ARM64_MYRECT:%.*]] = type { float, float, float, float }
2122
// arm64-macosx: [[ARM64_MYRECT:%.*]] = type { float, float, float, float }
2223

2324
class Foo {
@@ -43,6 +44,8 @@ class Foo {
4344
// armv7k-watchos: define internal [[ARMV7K_MYRECT]] @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
4445
// armv64_32-watchos: define hidden swiftcc { float, float, float, float } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}F"(%T8abitypes3FooC* swiftself %0) {{.*}} {
4546
// armv64_32-watchos: define internal [[ARMV7K_MYRECT]] @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
47+
// arm64-watchos: define hidden swiftcc { float, float, float, float } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}F"(%T8abitypes3FooC* swiftself %0) {{.*}} {
48+
// arm64-watchos: define internal [[ARM64_MYRECT]] @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
4649
// x86_64-watchos: define hidden swiftcc { float, float, float, float } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}F"(%T8abitypes3FooC* swiftself %0) {{.*}} {
4750
// x86_64-watchos: define internal { <2 x float>, <2 x float> } @"$s8abitypes3FooC3bar{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1) {{[#0-9]*}} {
4851
@objc dynamic func bar() -> MyRect {
@@ -323,6 +326,11 @@ class Foo {
323326
// i386-watchos: [[R2:%[0-9]+]] = call swiftcc i1 @"$s8abitypes3FooC6negate{{[_0-9a-zA-Z]*}}F"(i1 [[R1]]
324327
// i386-watchos: [[R3:%[0-9]+]] = call swiftcc i1 @"$s10ObjectiveC22_convertBoolToObjCBoolyAA0eF0VSbF"(i1 [[R2]])
325328
// i386-watchos: ret i1 [[R3]]
329+
//
330+
// arm64-watchos-fixme: define hidden i1 @"$s8abitypes3FooC6negate{{[_0-9a-zA-Z]*}}F"(i1, %T8abitypes3FooC*) {{.*}} {
331+
// arm64-watchos-fixme: define internal zeroext i1 @"$s8abitypes3FooC6negate{{[_0-9a-zA-Z]*}}FTo"
332+
// arm64-watchos-fixme: [[R2:%[0-9]+]] = call i1 @"$s8abitypes3FooC6negate{{[_0-9a-zA-Z]*}}F"
333+
// arm64-watchos-fixme: ret i1 [[R2]]
326334

327335
@objc dynamic func negate(_ b: Bool) -> Bool {
328336
return !b
@@ -445,7 +453,16 @@ class Foo {
445453
// armv7k-watchos: [[TOOBJCBOOL:%[0-9]+]] = call swiftcc i1 @"$s10ObjectiveC22_convertBoolToObjCBool{{[_0-9a-zA-Z]*}}F"(i1 [[NEG]])
446454
// armv7k-watchos: ret i1 [[TOOBJCBOOL]]
447455
//
448-
456+
// arm64-watchos: define hidden swiftcc i1 @"$s8abitypes3FooC7negate2{{[_0-9a-zA-Z]*}}F"(i1 %0, %T8abitypes3FooC* swiftself %1) {{.*}} {
457+
// arm64-watchos: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(negate:)", align 8
458+
// arm64-watchos: [[NEG:%[0-9]+]] = call zeroext i1 bitcast (void ()* @objc_msgSend to i1 ([[RECEIVER:.*]]*, i8*, i1)*)([[RECEIVER]]* {{%[0-9]+}}, i8* [[SEL]], i1 zeroext %0)
459+
// arm64-watchos: ret i1 [[NEG]]
460+
//
461+
// arm64-watchos: define internal zeroext i1 @"$s8abitypes3FooC7negate2{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1, i1 zeroext %2)
462+
// arm64-watchos: [[NEG:%[0-9]+]] = call swiftcc i1 @"$s8abitypes3FooC7negate2{{[_0-9a-zA-Z]*}}F"(i1
463+
// arm64-watchos: [[TOOBJCBOOL:%[0-9]+]] = call swiftcc i1 @"$s10ObjectiveC22_convertBoolToObjCBool{{[_0-9a-zA-Z]*}}F"(i1 [[NEG]])
464+
// arm64-watchos: ret i1 [[TOOBJCBOOL]]
465+
//
449466
// arm64-macosx: define internal zeroext i1 @"$s8abitypes3FooC7negate2{{[_0-9a-zA-Z]*}}FTo"(i8* %0, i8* %1, i1 zeroext %2)
450467
// arm64-macosx: [[NEG:%[0-9]+]] = call swiftcc i1 @"$s8abitypes3FooC7negate2{{[_0-9a-zA-Z]*}}F"(i1
451468
// arm64-macosx: [[TOOBJCBOOL:%[0-9]+]] = call swiftcc i1 @"$s10ObjectiveC22_convertBoolToObjCBool{{[_0-9a-zA-Z]*}}F"(i1 [[NEG]])
@@ -556,6 +573,9 @@ class Foo {
556573
// arm64-tvos: define internal void @"$s8abitypes3FooC14callJustReturn{{[_0-9a-zA-Z]*}}FTo"(%TSo9BigStructV* noalias nocapture sret({{.*}}) %0, i8* %1, i8* %2, [[OPAQUE:.*]]* %3, %TSo9BigStructV* %4) {{[#0-9]*}} {
557574
// arm64-macosx: define hidden swiftcc { i64, i64, i64, i64 } @"$s8abitypes3FooC14callJustReturn{{[_0-9a-zA-Z]*}}F"(%TSo13StructReturnsC* %0, i64 %1, i64 %2, i64 %3, i64 %4, %T8abitypes3FooC* swiftself %5) {{.*}} {
558575
// arm64-macosx: define internal void @"$s8abitypes3FooC14callJustReturn{{[_0-9a-zA-Z]*}}FTo"(%TSo9BigStructV* noalias nocapture sret({{.*}}) %0, i8* %1, i8* %2, [[OPAQUE:.*]]* %3, %TSo9BigStructV* %4) {{.*}} {
576+
//
577+
// arm64-watchos: define hidden swiftcc { i64, i64, i64, i64 } @"$s8abitypes3FooC14callJustReturn{{[_0-9a-zA-Z]*}}F"(%TSo13StructReturnsC* %0, i64 %1, i64 %2, i64 %3, i64 %4, %T8abitypes3FooC* swiftself %5) {{.*}} {
578+
// arm64-watchos: define internal void @"$s8abitypes3FooC14callJustReturn{{[_0-9a-zA-Z]*}}FTo"(%TSo9BigStructV* noalias nocapture sret({{.*}}) %0, i8* %1, i8* %2, [[OPAQUE:.*]]* %3, %TSo9BigStructV* %4) {{[#0-9]*}} {
559579
@objc dynamic func callJustReturn(_ r: StructReturns, with v: BigStruct) -> BigStruct {
560580
return r.justReturn(v)
561581
}
@@ -621,6 +641,17 @@ public func testInlineAgg(_ rect: MyRect) -> Float {
621641
// arm64-macosx: store i8 0, i8* [[BYTE_ADDR]], align 8
622642
// arm64-macosx: [[ARG:%.*]] = load i64, i64* [[COERCED]]
623643
// arm64-macosx: call void bitcast (void ()* @objc_msgSend to void (i8*, i8*, i64)*)(i8* {{.*}}, i8* {{.*}}, i64 [[ARG]])
644+
//
645+
// arm64-watchos: define swiftcc void @"$s8abitypes14testBOOLStructyyF"()
646+
// arm64-watchos: [[COERCED:%.*]] = alloca i64
647+
// arm64-watchos: [[STRUCTPTR:%.*]] = bitcast i64* [[COERCED]] to %TSo14FiveByteStructV
648+
// arm64-watchos: [[PTR0:%.*]] = getelementptr inbounds %TSo14FiveByteStructV, %TSo14FiveByteStructV* [[STRUCTPTR]], {{i.*}} 0, {{i.*}} 0
649+
// arm64-watchos: [[PTR1:%.*]] = getelementptr inbounds %T10ObjectiveC8ObjCBoolV, %T10ObjectiveC8ObjCBoolV* [[PTR0]], {{i.*}} 0, {{i.*}} 0
650+
// arm64-watchos: [[PTR2:%.*]] = getelementptr inbounds %TSb, %TSb* [[PTR1]], {{i.*}} 0, {{i.*}} 0
651+
// arm64-watchos: [[BYTE_ADDR:%.*]] = bitcast i1* [[PTR2]] to i8*
652+
// arm64-watchos: store i8 0, i8* [[BYTE_ADDR]], align 8
653+
// arm64-watchos: [[ARG:%.*]] = load i64, i64* [[COERCED]]
654+
// arm64-watchos: call void bitcast (void ()* @objc_msgSend to void (i8*, i8*, i64)*)(i8* {{.*}}, i8* {{.*}}, i64 [[ARG]])
624655
public func testBOOLStruct() {
625656
let s = FiveByteStruct()
626657
MyClass.mymethod(s)

0 commit comments

Comments
 (0)