]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/issue-44056-macos-tls-align.rs
Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomez
[rust.git] / src / test / codegen / issue-44056-macos-tls-align.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-tidy-linelength
12 // only-macos
13 // no-system-llvm
14 // min-llvm-version 6.0
15 // compile-flags: -O
16
17 #![crate_type = "rlib"]
18 #![feature(thread_local)]
19
20 // CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
21 #[no_mangle]
22 #[thread_local]
23 static mut STATIC_VAR_1: [u32; 8] = [0; 8];
24
25 // CHECK: @STATIC_VAR_2 = thread_local local_unnamed_addr global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4
26 #[no_mangle]
27 #[thread_local]
28 static mut STATIC_VAR_2: [u32; 8] = [4; 8];
29
30 #[no_mangle]
31 pub unsafe fn f(x: &mut [u32; 8]) {
32     std::mem::swap(x, &mut STATIC_VAR_1)
33 }
34
35 #[no_mangle]
36 pub unsafe fn g(x: &mut [u32; 8]) {
37     std::mem::swap(x, &mut STATIC_VAR_2)
38 }