Files
swift-mirror/test/Misc/tbi.sil
Michael Gottesman 9d2d4bb61d 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.
2017-04-30 17:16:13 -07:00

44 lines
1.6 KiB
Plaintext

// *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 -parse-sil -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
// RUN: -Xfrontend -enable-sil-ownership | \
// RUN: %FileCheck --check-prefix=TBI %s
// RUN: %swiftc_driver -parse-sil -target arm64-apple-ios7.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
// RUN: -Xfrontend -enable-sil-ownership | \
// 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 @testTBI : $@convention(thin) (Builtin.Int64) -> Builtin.Int64 {
bb0(%0 : @trivial $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
}