Skip to content

Commit f26d596

Browse files
Merge pull request #69041 from kateinoigakukun/yt/revert-23db49b4704f0a955be1a1a5fd7cff5369ecb542
Revert "[test][IRGen] Split out objc-interop specific part in abitypes.swift"
2 parents e11965a + 4424f36 commit f26d596

File tree

6 files changed

+83
-94
lines changed

6 files changed

+83
-94
lines changed

test/IRGen/Inputs/abi/CGadget.h

Lines changed: 0 additions & 52 deletions
This file was deleted.

test/IRGen/Inputs/abi/Gadget.h

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
@import Foundation;
2-
#include "CGadget.h"
2+
3+
struct MyRect {
4+
float x;
5+
float y;
6+
float width;
7+
float height;
8+
};
9+
10+
struct Trio {
11+
double i;
12+
double j;
13+
double k;
14+
};
15+
16+
struct IntPair {
17+
int a;
18+
int b;
19+
};
20+
21+
struct NestedInts {
22+
struct A {
23+
int value;
24+
} a;
25+
struct B {
26+
int value;
27+
} b;
28+
};
29+
30+
struct BigStruct {
31+
char a[32];
32+
};
333

434
@interface StructReturns : NSObject
535
- (struct MyRect)newRect;
@@ -28,6 +58,28 @@ typedef NS_ENUM(unsigned short, ChooseTo) {
2858
ChooseToLeaveIt = 1709
2959
};
3060

61+
enum RawEnum {
62+
Intergalactic,
63+
Planetary
64+
};
65+
66+
typedef struct One {
67+
float first;
68+
float second;
69+
} One;
70+
71+
static inline One makeOne(float f, float s) {
72+
One one;
73+
one.first = f;
74+
one.second = s;
75+
76+
return one;
77+
}
78+
79+
static inline float MyRect_Area(struct MyRect rect) {
80+
return rect.width * rect.height;
81+
}
82+
3183
// @literals inside static inline function
3284
static inline void* giveMeASelector(void) {
3385
return @selector(init);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
module gadget { header "Gadget.h" }
2-
module c_gadget { header "CGadget.h" }
32
module c_layout { header "c_layout.h" }

test/IRGen/abitypes_objc.swift renamed to test/IRGen/abitypes.swift

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir -module-name abitypes -enable-objc-interop | %FileCheck -check-prefix=%target-cpu-%target-os-abi %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir -enable-objc-interop | %FileCheck -check-prefix=%target-cpu-%target-os-abi %s
22

3-
// REQUIRES: objc_interop
3+
// FIXME: rdar://problem/19648117 Needs splitting objc parts out
4+
// XFAIL: OS=linux-gnu, OS=windows-msvc, OS=openbsd, OS=linux-android, OS=linux-androideabi
45

56
import gadget
6-
import c_gadget
77
import Foundation
88

99
@objc protocol P1 {}
@@ -559,6 +559,33 @@ class Foo {
559559
@objc dynamic func callJustReturn(_ r: StructReturns, with v: BigStruct) -> BigStruct {
560560
return r.justReturn(v)
561561
}
562+
563+
// Test that the makeOne() that we generate somewhere below doesn't
564+
// use arm_aapcscc for armv7.
565+
func callInline() -> Float {
566+
return makeOne(3,5).second
567+
}
568+
}
569+
570+
// armv7-ios: define internal void @makeOne(ptr noalias sret({{.*}}) align 4 %agg.result, float %f, float %s)
571+
// armv7s-ios: define internal void @makeOne(ptr noalias sret({{.*}}) align 4 %agg.result, float %f, float %s)
572+
// armv7k-watchos: define internal %struct.One @makeOne(float {{.*}}%f, float {{.*}}%s)
573+
574+
// rdar://17631440 - Expand direct arguments that are coerced to aggregates.
575+
// x86_64-macosx: define{{( protected)?}} swiftcc float @"$s8abitypes13testInlineAggySfSo6MyRectVF"(float %0, float %1, float %2, float %3) {{.*}} {
576+
// x86_64-macosx: [[COERCED:%.*]] = alloca %TSo6MyRectV, align 8
577+
// x86_64-macosx: store float %0,
578+
// x86_64-macosx: store float %1,
579+
// x86_64-macosx: store float %2,
580+
// x86_64-macosx: store float %3,
581+
// x86_64-macosx: [[T0:%.*]] = getelementptr inbounds { <2 x float>, <2 x float> }, ptr [[COERCED]], i32 0, i32 0
582+
// x86_64-macosx: [[FIRST_HALF:%.*]] = load <2 x float>, ptr [[T0]], align 8
583+
// x86_64-macosx: [[T0:%.*]] = getelementptr inbounds { <2 x float>, <2 x float> }, ptr [[COERCED]], i32 0, i32 1
584+
// x86_64-macosx: [[SECOND_HALF:%.*]] = load <2 x float>, ptr [[T0]], align 8
585+
// x86_64-macosx: [[RESULT:%.*]] = call float @MyRect_Area(<2 x float> [[FIRST_HALF]], <2 x float> [[SECOND_HALF]])
586+
// x86_64-macosx: ret float [[RESULT]]
587+
public func testInlineAgg(_ rect: MyRect) -> Float {
588+
return MyRect_Area(rect)
562589
}
563590

564591
// We need to allocate enough memory on the stack to hold the argument value we load.

test/IRGen/abitypes_arm.swift

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/IRGen/abitypes_x86_64.swift

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)