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