mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* Make the underlying builtins for FP + Vector match Integer. For stdlib integer types, these are named `_value` and `init(_ _value: Builtin.xxx)`. This patch adopts the same scheme for stdlib floating point and SDK overlay vector types, and removes a legacy init for integers that was only needed to support them. There should be no changes visible outside of the stdlib, and no functional change within the stdlib; the naming of some implementation details is simply more uniform now.
21 lines
681 B
Swift
21 lines
681 B
Swift
// RUN: %target-swift-frontend -emit-ir -g %s -o - -parse-stdlib | %FileCheck %s
|
|
// REQUIRES: OS=macosx
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_array_type, baseType: ![[FLOAT:[0-9]+]], size: 64, flags: DIFlagVector, elements: ![[ELTS:[0-9]+]])
|
|
// CHECK: ![[FLOAT]] = !DIBasicType(name: "$SBf32_D", size: 32, encoding: DW_ATE_float)
|
|
// CHECK: ![[ELTS]] = !{![[SR:[0-9]+]]}
|
|
// CHECK: ![[SR]] = !DISubrange(count: 2)
|
|
|
|
|
|
import Swift
|
|
public struct float2 {
|
|
public var _vector: Builtin.Vec2xFPIEEE32
|
|
public subscript(index: Int) -> Float {
|
|
get {
|
|
let elt = Builtin.extractelement_Vec2xFPIEEE32_Int32(_vector,
|
|
Int32(index)._value)
|
|
return Float(elt)
|
|
}
|
|
}
|
|
}
|