File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,28 @@ final class DataLayoutTests: XCTestCase {
8787 if let n = m. layout. stackAlignment { XCTAssertNotEqual ( n, 0 ) }
8888 }
8989
90+ func testStackAlignmentOfTargetSpecifyingOne( ) throws {
91+ #if !SWIFTY_LLVM_CROSS_COMPILATION_ENABLED
92+ throw XCTSkip ( )
93+ #else
94+ // The data layout of x86_64 Linux specifies a natural stack alignment of 128 bits.
95+ let t = try TargetSpecification ( target: . init( " x86_64-unknown-linux-gnu " ) )
96+ let m = Module ( " foo " , targetMachine: . init( target: t) )
97+ XCTAssertEqual ( m. layout. stackAlignment, 16 )
98+ #endif
99+ }
100+
101+ func testStackAlignmentOfTargetSpecifyingNone( ) throws {
102+ #if !SWIFTY_LLVM_CROSS_COMPILATION_ENABLED
103+ throw XCTSkip ( )
104+ #else
105+ // The data layout of AVR doesn't specify any natural stack alignment.
106+ let t = try TargetSpecification ( target: . init( " avr-unknown-unknown " ) )
107+ let m = Module ( " foo " , targetMachine: . init( target: t) )
108+ XCTAssertNil ( m. layout. stackAlignment)
109+ #endif
110+ }
111+
90112 func testPointerSize( ) throws {
91113 let m = try Module ( " foo " , targetMachine: . host( ) )
92114
You can’t perform that action at this time.
0 commit comments