1 ; RUN: llc -march=sparc -verify-machineinstrs < %s | FileCheck %s
3 ;; Test reserve-* options.
4 ; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-g1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-G1
5 ; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-o1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-O1
6 ; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-l1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-L1
7 ; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-i1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-I1
9 ;; Test multiple reserve-* options together.
10 ; RUN: llc -mtriple=sparc64-linux-gnu -mattr=+reserve-g1 -mattr=+reserve-o1 -mattr=+reserve-l1 -mattr=+reserve-i1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVED-G1,CHECK-RESERVED-O1,CHECK-RESERVED-L1,CHECK-RESERVED-I1
12 @g = common global [32 x i32] zeroinitializer, align 16
13 @h = common global [16 x i64] zeroinitializer, align 16
15 ;; Ensures that we don't use registers which are supposed to be reserved.
17 ; CHECK-LABEL: use_all_i32_regs:
19 ; CHECK: .cfi_register %o7, %i7
28 ; CHECK-RESERVED-G1-NOT: %g1
29 ; CHECK-RESERVED-O1-NOT: %o1
30 ; CHECK-RESERVED-L1-NOT: %l1
31 ; CHECK-RESERVED-I1-NOT: %i1
33 define void @use_all_i32_regs() {
35 %0 = load volatile i32, ptr @g, align 16
36 %1 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 1), align 4
37 %2 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 2), align 8
38 %3 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 3), align 4
39 %4 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 4), align 16
40 %5 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 5), align 4
41 %6 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 6), align 8
42 %7 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 7), align 4
43 %8 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 8), align 16
44 %9 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 9), align 4
45 %10 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 10), align 8
46 %11 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 11), align 4
47 %12 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 12), align 16
48 %13 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 13), align 4
49 %14 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 14), align 8
50 %15 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 15), align 4
51 %16 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 16), align 16
52 %17 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 17), align 4
53 %18 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 18), align 8
54 %19 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 19), align 4
55 %20 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 20), align 16
56 %21 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 21), align 4
57 %22 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 22), align 8
58 %23 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 23), align 4
59 %24 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 24), align 16
60 %25 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 25), align 4
61 %26 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 26), align 8
62 %27 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 27), align 4
63 %28 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 28), align 16
64 %29 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 29), align 4
65 %30 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 30), align 8
66 %31 = load volatile i32, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 31), align 4
67 store volatile i32 %1, ptr @g, align 16
68 store volatile i32 %2, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 1), align 4
69 store volatile i32 %3, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 2), align 8
70 store volatile i32 %4, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 3), align 4
71 store volatile i32 %5, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 4), align 16
72 store volatile i32 %6, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 5), align 4
73 store volatile i32 %7, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 6), align 8
74 store volatile i32 %8, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 7), align 4
75 store volatile i32 %9, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 8), align 16
76 store volatile i32 %10, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 9), align 4
77 store volatile i32 %11, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 10), align 8
78 store volatile i32 %12, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 11), align 4
79 store volatile i32 %13, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 12), align 16
80 store volatile i32 %14, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 13), align 4
81 store volatile i32 %15, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 14), align 8
82 store volatile i32 %16, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 15), align 4
83 store volatile i32 %17, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 16), align 16
84 store volatile i32 %18, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 17), align 4
85 store volatile i32 %19, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 18), align 8
86 store volatile i32 %20, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 19), align 4
87 store volatile i32 %21, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 20), align 16
88 store volatile i32 %22, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 21), align 4
89 store volatile i32 %23, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 22), align 8
90 store volatile i32 %24, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 23), align 4
91 store volatile i32 %25, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 24), align 16
92 store volatile i32 %26, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 25), align 4
93 store volatile i32 %27, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 26), align 8
94 store volatile i32 %28, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 27), align 4
95 store volatile i32 %29, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 28), align 16
96 store volatile i32 %30, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 29), align 4
97 store volatile i32 %31, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 30), align 8
98 store volatile i32 %0, ptr getelementptr inbounds ([32 x i32], ptr @g, i64 0, i64 31), align 4
103 ; CHECK-LABEL: use_all_i64_regs:
105 ; CHECK: .cfi_register %o7, %i7
116 ; CHECK-RESERVED-G1-NOT: %g1
117 ; CHECK-RESERVED-O1-NOT: %o1
118 ; CHECK-RESERVED-L1-NOT: %l1
119 ; CHECK-RESERVED-I1-NOT: %i1
121 define void @use_all_i64_regs() {
123 %0 = load volatile i64, ptr @h, align 16
124 %1 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 1), align 4
125 %2 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 2), align 8
126 %3 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 3), align 4
127 %4 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 4), align 16
128 %5 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 5), align 4
129 %6 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 6), align 8
130 %7 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 7), align 4
131 %8 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 8), align 16
132 %9 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 9), align 4
133 %10 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 10), align 8
134 %11 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 11), align 4
135 %12 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 12), align 16
136 %13 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 13), align 4
137 %14 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 14), align 8
138 %15 = load volatile i64, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 15), align 4
139 store volatile i64 %1, ptr @h, align 16
140 store volatile i64 %2, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 1), align 4
141 store volatile i64 %3, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 2), align 8
142 store volatile i64 %4, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 3), align 4
143 store volatile i64 %5, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 4), align 16
144 store volatile i64 %6, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 5), align 4
145 store volatile i64 %7, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 6), align 8
146 store volatile i64 %8, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 7), align 4
147 store volatile i64 %9, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 8), align 16
148 store volatile i64 %10, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 9), align 4
149 store volatile i64 %11, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 10), align 8
150 store volatile i64 %12, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 11), align 4
151 store volatile i64 %13, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 12), align 16
152 store volatile i64 %14, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 13), align 4
153 store volatile i64 %15, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 14), align 8
154 store volatile i64 %0, ptr getelementptr inbounds ([16 x i64], ptr @h, i64 0, i64 15), align 4