1; RUN: llc < %s | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
4target triple = "armv7-none--gnueabihf"
5
6%struct.s = type { float, float }
7%union.t = type { [4 x float] }
8
9; Equivalent C code:
10; struct s { float a; float b; };
11; float foo(float a, double b, struct s c) { return c.a; }
12; Argument allocation:
13; a -> s0
14; b -> d1
15; c -> s4, s5
16; s1 is unused
17; return in s0
18define float @test1(float %a, double %b, %struct.s %c) {
19entry:
20; CHECK-LABEL: test1
21; CHECK: vmov.f32  s0, s4
22; CHECK-NOT: vmov.f32        s0, s1
23
24  %result = extractvalue %struct.s %c, 0
25  ret float %result
26}
27
28; Equivalent C code:
29; union t { float a[4] };
30; float foo(float a, double b, union s c) { return c.a[0]; }
31; Argument allocation:
32; a -> s0
33; b -> d1
34; c -> s4..s7
35define float @test2(float %a, double %b, %union.t %c) #0 {
36entry:
37; CHECK-LABEL: test2
38; CHECK: vmov.f32  s0, s4
39; CHECK-NOT: vmov.f32        s0, s1
40
41  %result = extractvalue %union.t %c, 0, 0
42  ret float %result
43}
44
45; Equivalent C code:
46; struct s { float a; float b; };
47; float foo(float a, double b, struct s c, float d) { return d; }
48; Argument allocation:
49; a -> s0
50; b -> d1
51; c -> s4, s5
52; d -> s1
53; return in s0
54define float @test3(float %a, double %b, %struct.s %c, float %d) {
55entry:
56; CHECK-LABEL: test3
57; CHECK: vmov.f32  s0, s1
58; CHECK-NOT: vmov.f32        s0, s5
59
60  ret float %d
61}
62
63; Equivalent C code:
64; struct s { float a; float b; };
65; float foo(struct s a, struct s b) { return b.b; }
66; Argument allocation:
67; a -> s0, s1
68; b -> s2, s3
69; return in s0
70define float @test4(%struct.s %a, %struct.s %b) {
71entry:
72; CHECK-LABEL: test4
73; CHECK: vmov.f32  s0, s3
74
75  %result = extractvalue %struct.s %b, 1
76  ret float %result
77}
78
79; Equivalent C code:
80; struct s { float a; float b; };
81; float foo(struct s a, float b, struct s c) { return c.a; }
82; Argument allocation:
83; a -> s0, s1
84; b -> s2
85; c -> s3, s4
86; return in s0
87define float @test5(%struct.s %a, float %b, %struct.s %c) {
88entry:
89; CHECK-LABEL: test5
90; CHECK: vmov.f32  s0, s3
91
92  %result = extractvalue %struct.s %c, 0
93  ret float %result
94}
95