Skip to content

Commit e0a9c35

Browse files
committed
Fix the tbi test even harder.
A few things here: 1. I changed the .swift file to be a .sil file. This one is for Jordan. It should also make the test not run into any issues due to swift level codegen changes. So we should have an even more robust test. 2. I fixed the watchossimulator test by eliminating any dependency of this test on an SDK. This is a pure compiler/target test. Just like the stdlib is not necessary, SDKs are not necessary either.
1 parent 105cf60 commit e0a9c35

File tree

2 files changed

+43
-25
lines changed

2 files changed

+43
-25
lines changed

test/Misc/tbi.sil

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// *NOTE* This is an end to end test. Specifically, we are ensuring that the
2+
// driver is properly generated -enable-aarch64-tbi and also that the frontend
3+
// respects this option and that we get the proper tbi behavior.
4+
5+
// RUN: %swiftc_driver -parse-sil -target arm64-apple-ios8.0 -target-cpu cyclone \
6+
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
7+
// RUN: -Xfrontend -enable-sil-ownership | \
8+
// RUN: %FileCheck --check-prefix=TBI %s
9+
10+
// RUN: %swiftc_driver -parse-sil -target arm64-apple-ios7.0 -target-cpu cyclone \
11+
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
12+
// RUN: -Xfrontend -enable-sil-ownership | \
13+
// RUN: %FileCheck --check-prefix=NO_TBI %s
14+
15+
// REQUIRES: CODEGENERATOR=AArch64
16+
17+
// Verify that TBI is on by default in Swift on targets that support it. For our
18+
// purposes this means iOS8.0 or later.
19+
20+
// NO_TBI-LABEL: .globl _testTBI
21+
// NO_TBI: _testTBI
22+
// NO_TBI-NEXT: and
23+
// NO_TBI-NEXT: ldr
24+
// NO_TBI-NEXT: ret
25+
26+
// TBI-LABEL: .globl _testTBI
27+
// TBI: _testTBI:
28+
// TBI-NEXT: ldr
29+
// TBI-NEXT: ret
30+
31+
sil_stage canonical
32+
33+
import Builtin
34+
35+
sil @testTBI : $@convention(thin) (Builtin.Int64) -> Builtin.Int64 {
36+
bb0(%0 : @trivial $Builtin.Int64):
37+
%1 = integer_literal $Builtin.Int64, 0x00FFFFFFFFFFFFFF
38+
%2 = builtin "and_Int64"(%0 : $Builtin.Int64, %1 : $Builtin.Int64) : $Builtin.Int64
39+
%3 = builtin "inttoptr_Int64"(%2 : $Builtin.Int64) : $Builtin.RawPointer
40+
%4 = pointer_to_address %3 : $Builtin.RawPointer to [strict] $*Builtin.Int64
41+
%5 = load [trivial] %4 : $*Builtin.Int64
42+
return %5 : $Builtin.Int64
43+
}

test/Misc/tbi.swift

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

0 commit comments

Comments
 (0)