File: simd-abi-checks-s390x.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (174 lines) | stat: -rw-r--r-- 5,991 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//@ revisions: z10 z13_no_vector z13_soft_float
//@ build-fail
//@[z10] compile-flags: --target s390x-unknown-linux-gnu
//@[z10] needs-llvm-components: systemz
//@[z13_no_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector
//@[z13_no_vector] needs-llvm-components: systemz
// FIXME: +soft-float itself doesn't set -vector
//@[z13_soft_float] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector,+soft-float
//@[z13_soft_float] needs-llvm-components: systemz

#![feature(no_core, lang_items, repr_simd, s390x_target_feature)]
#![no_core]
#![crate_type = "lib"]
#![allow(non_camel_case_types, improper_ctypes_definitions)]
#![deny(abi_unsupported_vector_types)]

#[lang = "sized"]
pub trait Sized {}
#[lang = "copy"]
pub trait Copy {}
#[lang = "freeze"]
pub trait Freeze {}

impl<T: Copy, const N: usize> Copy for [T; N] {}

#[repr(simd)]
pub struct i8x8([i8; 8]);
#[repr(simd)]
pub struct i8x16([i8; 16]);
#[repr(simd)]
pub struct i8x32([i8; 32]);
#[repr(C)]
pub struct Wrapper<T>(T);
#[repr(transparent)]
pub struct TransparentWrapper<T>(T);

impl Copy for i8 {}
impl Copy for i64 {}
impl Copy for i8x8 {}
impl Copy for i8x16 {}
impl Copy for i8x32 {}
impl<T: Copy> Copy for Wrapper<T> {}
impl<T: Copy> Copy for TransparentWrapper<T> {}

#[no_mangle]
extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    *x
}
#[no_mangle]
extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    *x
}
#[no_mangle]
extern "C" fn vector_ret_large(x: &i8x32) -> i8x32 {
    // Ok
    *x
}

#[no_mangle]
#[target_feature(enable = "vector")]
unsafe extern "C" fn vector_ret_target_feature_small(x: &i8x8) -> i8x8 {
    // Ok
    *x
}
#[no_mangle]
#[target_feature(enable = "vector")]
unsafe extern "C" fn vector_target_feature_ret(x: &i8x16) -> i8x16 {
    // Ok
    *x
}
#[no_mangle]
#[target_feature(enable = "vector")]
unsafe extern "C" fn vector_ret_target_feature_large(x: &i8x32) -> i8x32 {
    // Ok
    *x
}

#[no_mangle]
extern "C" fn vector_wrapper_ret_small(x: &Wrapper<i8x8>) -> Wrapper<i8x8> {
    // Ok
    *x
}
#[no_mangle]
extern "C" fn vector_wrapper_ret(x: &Wrapper<i8x16>) -> Wrapper<i8x16> {
    // Ok
    *x
}
#[no_mangle]
extern "C" fn vector_wrapper_ret_large(x: &Wrapper<i8x32>) -> Wrapper<i8x32> {
    // Ok
    *x
}

#[no_mangle]
extern "C" fn vector_transparent_wrapper_ret_small(
    x: &TransparentWrapper<i8x8>,
) -> TransparentWrapper<i8x8> {
    //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^^^ WARN this was previously accepted
    *x
}
#[no_mangle]
extern "C" fn vector_transparent_wrapper_ret(
    x: &TransparentWrapper<i8x16>,
) -> TransparentWrapper<i8x16> {
    //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^^^ WARN this was previously accepted
    *x
}
#[no_mangle]
extern "C" fn vector_transparent_wrapper_ret_large(
    x: &TransparentWrapper<i8x32>,
) -> TransparentWrapper<i8x32> {
    // Ok
    *x
}

#[no_mangle]
extern "C" fn vector_arg_small(x: i8x8) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const i8x8 as *const i64) }
}
#[no_mangle]
extern "C" fn vector_arg(x: i8x16) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const i8x16 as *const i64) }
}
#[no_mangle]
extern "C" fn vector_arg_large(x: i8x32) -> i64 {
    // Ok
    unsafe { *(&x as *const i8x32 as *const i64) }
}

#[no_mangle]
extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const Wrapper<i8x8> as *const i64) }
}
#[no_mangle]
extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const Wrapper<i8x16> as *const i64) }
}
#[no_mangle]
extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 {
    // Ok
    unsafe { *(&x as *const Wrapper<i8x32> as *const i64) }
}

#[no_mangle]
extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const TransparentWrapper<i8x8> as *const i64) }
}
#[no_mangle]
extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
    //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled
    //~^^ WARN this was previously accepted
    unsafe { *(&x as *const TransparentWrapper<i8x16> as *const i64) }
}
#[no_mangle]
extern "C" fn vector_transparent_wrapper_arg_large(x: TransparentWrapper<i8x32>) -> i64 {
    // Ok
    unsafe { *(&x as *const TransparentWrapper<i8x32> as *const i64) }
}