1
- //
2
- // compile-flags: -C no-prepopulate-passes
3
- // only-riscv64
4
- // only-linux
1
+ // compile-flags: --target riscv64gc-unknown-linux-gnu -C no-prepopulate-passes
2
+ // needs-llvm-components: riscv
3
+
5
4
#![ crate_type = "lib" ]
5
+ #![ no_core]
6
+ #![ feature( no_core, lang_items) ]
6
7
#![ allow( improper_ctypes) ]
7
8
9
+ #[ lang = "sized" ]
10
+ trait Sized { }
11
+ #[ lang = "copy" ]
12
+ trait Copy { }
13
+
8
14
// CHECK: define void @f_void()
9
15
#[ no_mangle]
10
16
pub extern "C" fn f_void ( ) { }
@@ -70,8 +76,6 @@ pub struct Tiny {
70
76
// CHECK: define void @f_agg_tiny(i64 %0)
71
77
#[ no_mangle]
72
78
pub extern "C" fn f_agg_tiny ( mut e : Tiny ) {
73
- e. a += e. b ;
74
- e. c += e. d ;
75
79
}
76
80
77
81
// CHECK: define i64 @f_agg_tiny_ret()
@@ -89,14 +93,12 @@ pub struct Small {
89
93
// CHECK: define void @f_agg_small([2 x i64] %0)
90
94
#[ no_mangle]
91
95
pub extern "C" fn f_agg_small ( mut x : Small ) {
92
- x. a += unsafe { * x. b } ;
93
- x. b = & mut x. a ;
94
96
}
95
97
96
98
// CHECK: define [2 x i64] @f_agg_small_ret()
97
99
#[ no_mangle]
98
100
pub extern "C" fn f_agg_small_ret ( ) -> Small {
99
- Small { a : 1 , b : core :: ptr :: null_mut ( ) }
101
+ Small { a : 1 , b : 0 as * mut _ }
100
102
}
101
103
102
104
#[ repr( C ) ]
@@ -107,7 +109,6 @@ pub struct SmallAligned {
107
109
// CHECK: define void @f_agg_small_aligned(i128 %0)
108
110
#[ no_mangle]
109
111
pub extern "C" fn f_agg_small_aligned ( mut x : SmallAligned ) {
110
- x. a += x. a ;
111
112
}
112
113
113
114
#[ repr( C ) ]
@@ -121,7 +122,6 @@ pub struct Large {
121
122
// CHECK: define void @f_agg_large(%Large* {{.*}}%x)
122
123
#[ no_mangle]
123
124
pub extern "C" fn f_agg_large ( mut x : Large ) {
124
- x. a = x. b + x. c + x. d ;
125
125
}
126
126
127
127
// CHECK: define void @f_agg_large_ret(%Large* {{.*}}sret{{.*}}, i32 signext %i, i8 signext %j)
@@ -172,7 +172,7 @@ pub unsafe extern "C" fn f_va_caller() {
172
172
4.0f64 ,
173
173
5.0f64 ,
174
174
Tiny { a : 1 , b : 2 , c : 3 , d : 4 } ,
175
- Small { a : 10 , b : core :: ptr :: null_mut ( ) } ,
175
+ Small { a : 10 , b : 0 as * mut _ } ,
176
176
SmallAligned { a : 11 } ,
177
177
Large { a : 12 , b : 13 , c : 14 , d : 15 } ,
178
178
) ;
0 commit comments