mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
31 lines
936 B
Swift
31 lines
936 B
Swift
// RUN: %target-swift-frontend -parse-as-library -O -target-cpu core2 -emit-ir %s | %FileCheck %s
|
|
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib,CPU=x86_64
|
|
|
|
// This is an end-to-end test to ensure that the optimizer generates
|
|
// a simple literal for character literals.
|
|
|
|
// Please note: this test targets "core2" to ensure consistent output
|
|
// on all x86 host processors.
|
|
|
|
// CHECK-LABEL: define {{.*}}charArray
|
|
// CHECK: store <2 x i64> <i64 97, i64 98>
|
|
// CHECK: store <2 x i64> <i64 99, i64 100>
|
|
// CHECK: ret
|
|
public func charArray(_ i: Int) -> [Character] {
|
|
return [ "a", "b", "c", "d" ]
|
|
}
|
|
|
|
// CHECK-LABEL: define {{.*}}singleChar
|
|
// CHECK: ret {{.*}} 97
|
|
public func singleChar() -> Character {
|
|
return "a"
|
|
}
|
|
|
|
// FIXME: The following part of this test is temporarily disabled.
|
|
|
|
// CHECK-LABEL: define {{.*}}singleNonAsciiChar
|
|
// CHECK: ret {{.*}} 26085
|
|
public func singleNonAsciiChar() -> Character {
|
|
return "日"
|
|
}
|