1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc -march=sparc < %s | FileCheck %s --check-prefixes=CHECK32
3 ; RUN: llc -march=sparcv9 < %s | FileCheck %s --check-prefixes=CHECK64
5 define void @variable_alloca_with_overalignment(i32 %num) nounwind {
6 ; CHECK32-LABEL: variable_alloca_with_overalignment:
8 ; CHECK32-NEXT: save %sp, -96, %sp
9 ; CHECK32-NEXT: add %sp, 80, %i1
10 ; CHECK32-NEXT: and %i1, -64, %o0
11 ; CHECK32-NEXT: add %o0, -96, %sp
12 ; CHECK32-NEXT: add %i0, 7, %i0
13 ; CHECK32-NEXT: and %i0, -8, %i0
14 ; CHECK32-NEXT: sub %sp, %i0, %i0
15 ; CHECK32-NEXT: add %i0, -8, %sp
16 ; CHECK32-NEXT: call foo
17 ; CHECK32-NEXT: add %i0, 88, %o1
19 ; CHECK32-NEXT: restore
21 ; CHECK64-LABEL: variable_alloca_with_overalignment:
23 ; CHECK64-NEXT: save %sp, -128, %sp
24 ; CHECK64-NEXT: add %sp, 2159, %i1
25 ; CHECK64-NEXT: and %i1, -64, %o0
26 ; CHECK64-NEXT: add %o0, -2175, %sp
27 ; CHECK64-NEXT: srl %i0, 0, %i0
28 ; CHECK64-NEXT: add %i0, 15, %i0
29 ; CHECK64-NEXT: sethi 4194303, %i1
30 ; CHECK64-NEXT: or %i1, 1008, %i1
31 ; CHECK64-NEXT: sethi 0, %i2
32 ; CHECK64-NEXT: or %i2, 1, %i2
33 ; CHECK64-NEXT: sllx %i2, 32, %i2
34 ; CHECK64-NEXT: or %i2, %i1, %i1
35 ; CHECK64-NEXT: and %i0, %i1, %i0
36 ; CHECK64-NEXT: sub %sp, %i0, %i0
37 ; CHECK64-NEXT: add %i0, 2175, %o1
38 ; CHECK64-NEXT: mov %i0, %sp
39 ; CHECK64-NEXT: call foo
40 ; CHECK64-NEXT: add %sp, -48, %sp
41 ; CHECK64-NEXT: add %sp, 48, %sp
43 ; CHECK64-NEXT: restore
44 %aligned = alloca i32, align 64
45 %var_size = alloca i8, i32 %num, align 4
46 call void @foo(ptr %aligned, ptr %var_size)
50 ;; Same but with the alloca itself overaligned
51 define void @variable_alloca_with_overalignment_2(i32 %num) nounwind {
52 ; CHECK32-LABEL: variable_alloca_with_overalignment_2:
54 ; CHECK32-NEXT: save %sp, -96, %sp
55 ; CHECK32-NEXT: add %i0, 7, %i0
56 ; CHECK32-NEXT: and %i0, -8, %i0
57 ; CHECK32-NEXT: sub %sp, %i0, %i0
58 ; CHECK32-NEXT: add %i0, 88, %i0
59 ; CHECK32-NEXT: and %i0, -64, %o1
60 ; CHECK32-NEXT: add %o1, -96, %sp
61 ; CHECK32-NEXT: call foo
62 ; CHECK32-NEXT: mov %g0, %o0
64 ; CHECK32-NEXT: restore
66 ; CHECK64-LABEL: variable_alloca_with_overalignment_2:
68 ; CHECK64-NEXT: save %sp, -128, %sp
69 ; CHECK64-NEXT: srl %i0, 0, %i0
70 ; CHECK64-NEXT: add %i0, 15, %i0
71 ; CHECK64-NEXT: sethi 4194303, %i1
72 ; CHECK64-NEXT: or %i1, 1008, %i1
73 ; CHECK64-NEXT: sethi 0, %i2
74 ; CHECK64-NEXT: or %i2, 1, %i2
75 ; CHECK64-NEXT: sllx %i2, 32, %i2
76 ; CHECK64-NEXT: or %i2, %i1, %i1
77 ; CHECK64-NEXT: and %i0, %i1, %i0
78 ; CHECK64-NEXT: sub %sp, %i0, %i0
79 ; CHECK64-NEXT: add %i0, 2175, %i0
80 ; CHECK64-NEXT: and %i0, -64, %o1
81 ; CHECK64-NEXT: add %o1, -2175, %sp
82 ; CHECK64-NEXT: add %sp, -48, %sp
83 ; CHECK64-NEXT: call foo
84 ; CHECK64-NEXT: mov %g0, %o0
85 ; CHECK64-NEXT: add %sp, 48, %sp
87 ; CHECK64-NEXT: restore
88 %var_size = alloca i8, i32 %num, align 64
89 call void @foo(ptr null, ptr %var_size)
93 declare void @foo(ptr, ptr);