1
1
//@ add-core-stubs
2
2
//@ assembly-output: emit-asm
3
- //@ compile-flags: -O -Zregparm=3 --target=i686-unknown-linux-gnu -C relocation-model=static
3
+ //@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static
4
+ //@ revisions: REGPARM1 REGPARM2 REGPARM3
5
+ //@[REGPARM1] compile-flags: -Zregparm=1
6
+ //@[REGPARM2] compile-flags: -Zregparm=2
7
+ //@[REGPARM3] compile-flags: -Zregparm=3
4
8
//@ needs-llvm-components: x86
5
-
6
9
#![ feature( no_core) ]
7
10
#![ no_std]
8
11
#![ no_core]
@@ -18,20 +21,38 @@ unsafe extern "C" {
18
21
19
22
#[ unsafe( no_mangle) ]
20
23
pub unsafe extern "C" fn entrypoint ( len : usize , ptr : * mut c_void , val : i32 ) -> * mut c_void {
21
- // CHECK-LABEL: entrypoint
22
- // CHECK: mov{{.*}}eax
23
- // CHECK: mov{{.*}}ecx
24
- // CHECK: mov{{.*}}esi
25
- // CHECK: jmp{{.*}}memset
24
+ // REGPARM1-LABEL: entrypoint
25
+ // REGPARM1: movl %eax, %ecx
26
+ // REGPARM1: calll memset
27
+
28
+ // REGPARM2-LABEL: entrypoint
29
+ // REGPARM2: movl %e{{.*}}, (%esp)
30
+ // REGPARM2: movl %e{{.*}}, %eax
31
+ // REGPARM2: calll memset
32
+
33
+ // REGPARM3-LABEL: entrypoint
34
+ // REGPARM3: movl %e{{.*}}, %esi
35
+ // REGPARM3: movl %e{{.*}}, %eax
36
+ // REGPARM3: movl %e{{.*}}, %ecx
37
+ // REGPARM3: jmp memset
26
38
unsafe { memset ( ptr, val, len) }
27
39
}
28
40
29
41
#[ unsafe( no_mangle) ]
30
42
pub unsafe extern "C" fn non_builtin_entrypoint ( len : usize , ptr : * mut c_void , val : i32 ) -> * mut c_void {
31
- // CHECK-LABEL: my_entrypoint
32
- // CHECK: mov{{.*}}eax
33
- // CHECK: mov{{.*}}ecx
34
- // CHECK: mov{{.*}}esi
35
- // CHECK: jmp{{.*}}memset
43
+ // REGPARM1-LABEL: non_builtin_entrypoint
44
+ // REGPARM1: movl %eax, %ecx
45
+ // REGPARM1: calll non_builtin_memset
46
+
47
+ // REGPARM2-LABEL: non_builtin_entrypoint
48
+ // REGPARM2: movl %e{{.*}}, (%esp)
49
+ // REGPARM2: movl %e{{.*}}, %eax
50
+ // REGPARM2: calll non_builtin_memset
51
+
52
+ // REGPARM3-LABEL: non_builtin_entrypoint
53
+ // REGPARM3: movl %e{{.*}}, %esi
54
+ // REGPARM3: movl %e{{.*}}, %eax
55
+ // REGPARM3: movl %e{{.*}}, %ecx
56
+ // REGPARM3: jmp non_builtin_memset
36
57
unsafe { non_builtin_memset ( ptr, val, len) }
37
58
}
0 commit comments