1
1
// RUN: %empty-directory(%t)
2
2
// RUN: %target-swift-frontend -emit-module-path %t/pre_specialized_module.swiftmodule %S/Inputs/pre_specialized_module.swift
3
- // RUN: %target-swift-frontend -I %t -O -emit-sil %s | %FileCheck %s --check-prefix=OPT
4
- // RUN: %target-swift-frontend -I %t -Onone -emit-sil %s | %FileCheck %s --check-prefix=NONE
3
+ // RUN: %target-swift-frontend -I %t -O -emit-sil %s | %FileCheck %s --check-prefix=OPT -check-prefix=OPT-%target-os
4
+ // RUN: %target-swift-frontend -I %t -Onone -emit-sil %s | %FileCheck %s --check-prefix=NONE -check-prefix=NONE-%target-os
5
5
6
6
7
7
// RUN: %empty-directory(%t)
13
13
// RUN: %target-swift-frontend -I %t -O -emit-sil %s | %FileCheck %s --check-prefix=OPT
14
14
15
15
// RUN: %empty-directory(%t)
16
- // RUN: %target-swift-frontend -O -swift-version 5 -enable-library-evolution -emit-module -o /dev/null -emit-module-interface-path %t/pre_specialized_module.swiftinterface %S/Inputs/pre_specialized_module.swift
16
+ // RUN: %target-swift-frontend -O -swift-version 5 -enable-library-evolution -emit-module -o /dev/null -emit-module-interface-path %t/pre_specialized_module.swiftinterface %S/Inputs/pre_specialized_module.swift -module-name pre_specialized_module
17
17
// RUN: %target-swift-frontend -I %t -O -emit-sil %s | %FileCheck %s --check-prefix=OPT
18
18
19
19
import pre_specialized_module
20
20
21
21
// Make sure we generate the public pre-specialized entry points.
22
22
23
- // OPT: sil @$s14pre_specialize10testPublic1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
24
- // OPT: sil @$s14pre_specialize10testPublic1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
23
+ // OPT-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
24
+ // OPT-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
25
+ // OPT-macosx-DAG: sil [available 10.5] @$s14pre_specialize10testPublic1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
26
+ // OPT-linux-gnu-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
25
27
26
- // NONE: sil @$s14pre_specialize10testPublic1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
27
- // NONE: sil @$s14pre_specialize10testPublic1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
28
+ // NONE-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
29
+ // NONE-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
30
+ // NONE-macosx-DAG: sil [available 10.5] @$s14pre_specialize10testPublic1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
31
+ // NONE-linux-gnu-DAG: sil @$s14pre_specialize10testPublic1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
28
32
29
33
@_specialize ( exported: true , where T == Int)
30
34
@_specialize ( exported: true , where T == Float)
35
+ @_specialize ( exported: true , availability: macOS 10.5 , * ; where T == Double)
31
36
public func testPublic< T> ( t: T ) {
32
37
print ( t)
33
38
}
34
39
35
- // OPT: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
36
- // OPT: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
40
+ // OPT-macosx-DAG: sil [available 10.5] @$s14pre_specialize18testEmitIntoClient1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
41
+ // OPT-linux-gnu-DAG: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSd_Ts5 : $@convention(thin) (Double) -> () {
42
+ // OPT-DAG: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
43
+ // OPT-DAG: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
37
44
38
45
// NONE: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
39
46
// NONE: sil @$s14pre_specialize18testEmitIntoClient1tyx_tlFSi_Ts5 : $@convention(thin) (Int) -> () {
40
47
41
48
@_specialize ( exported: true , where T == Int)
42
49
@_specialize ( exported: true , where T == Float)
50
+ @_specialize ( exported: true , availability: macOS 10.5 , * ; where T == Double)
43
51
@_alwaysEmitIntoClient
44
52
internal func testEmitIntoClient< T> ( t: T ) {
45
53
print ( t)
@@ -50,6 +58,8 @@ internal func testEmitIntoClient<T>(t: T) {
50
58
// OPT: apply [[F1]]
51
59
// OPT: [[F2:%.*]] = function_ref @$s22pre_specialized_module20publicPrespecializedyyxlFSd_Ts5 : $@convention(thin) (Double) -> ()
52
60
// OPT: apply [[F2]]
61
+ // OPT-macosx: [[F6:%.*]] = function_ref @$s22pre_specialized_module20publicPrespecializedyyxlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
62
+ // OPT-macosx: apply [[F6]]<SomeData>
53
63
// OPT: [[F3:%.*]] = function_ref @$s22pre_specialized_module36internalEmitIntoClientPrespecializedyyxlFSi_Ts5 : $@convention(thin) (Int) -> ()
54
64
// OPT: apply [[F3]]
55
65
// OPT: [[F4:%.*]] = function_ref @$s22pre_specialized_module36internalEmitIntoClientPrespecializedyyxlFSd_Ts5 : $@convention(thin) (Double) -> ()
@@ -80,10 +90,19 @@ internal func testEmitIntoClient<T>(t: T) {
80
90
public func usePrespecializedEntryPoints( ) {
81
91
publicPrespecialized ( 1 )
82
92
publicPrespecialized ( 1.0 )
93
+ publicPrespecialized ( SomeData ( ) )
83
94
useInternalEmitIntoClientPrespecialized ( 2 )
84
95
useInternalEmitIntoClientPrespecialized ( 2.0 )
85
96
useInternalThing ( 2 )
86
97
}
98
+ // OPT-macosx: sil [available 10.50] @$s14pre_specialize40usePrespecializedEntryPointsAvailabilityyyF : $@convention(thin) () -> () {
99
+ // OPT-macosx: [[F1:%.*]] = function_ref @$s22pre_specialized_module20publicPrespecializedyyxlFAA8SomeDataV_Ts5 : $@convention(thin) (SomeData) -> ()
100
+ // OPT-macosx: apply [[F1]](
101
+ // OPT-macosx: } // end sil function '$s14pre_specialize40usePrespecializedEntryPointsAvailabilityyyF'
102
+ @available ( macOS 10 . 50 , * )
103
+ public func usePrespecializedEntryPointsAvailability( ) {
104
+ publicPrespecialized ( SomeData ( ) )
105
+ }
87
106
// OPT: sil [signature_optimized_thunk] [always_inline] @$s22pre_specialized_module16publicInlineableyyxlFSd_Ts5 : $@convention(thin) (Double) -> () {
88
107
// NONE: sil @$s22pre_specialized_module16publicInlineableyyxlFSd_Ts5 : $@convention(thin) (Double) -> () {
89
108
@_specialize ( exported: true , target: publicInlineable ( _: ) , where T == Double)
0 commit comments