Skip to content

Commit a17cebd

Browse files
author
Krzysztof Parzyszek
committed
[Hexagon] Add testcases for stack alignment and variable-sized objects
llvm-svn: 235602
1 parent 7fc89d2 commit a17cebd

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -march=hexagon < %s | FileCheck %s
2+
; CHECK: and(r29, #-32)
3+
; CHECK-DAG: add(r29, #0)
4+
; CHECK-DAG: add(r29, #28)
5+
6+
target triple = "hexagon-unknown-unknown"
7+
8+
; Function Attrs: nounwind uwtable
9+
define void @foo() #0 {
10+
entry:
11+
%x = alloca i32, align 4
12+
%y = alloca i32, align 32
13+
%0 = bitcast i32* %x to i8*
14+
%1 = bitcast i32* %y to i8*
15+
call void @bar(i8* %0, i8* %1)
16+
ret void
17+
}
18+
19+
declare void @bar(i8*, i8*) #0
20+
21+
attributes #0 = { nounwind }
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
; RUN: llc -O0 -march=hexagon < %s | FileCheck %s
2+
; CHECK: and(r29, #-128)
3+
; CHECK-DAG: add(r29, #0)
4+
; CHECK-DAG: add(r29, #64)
5+
; CHECK-DAG: add(r29, #96)
6+
; CHECK-DAG: add(r29, #124)
7+
8+
target triple = "hexagon-unknown-unknown"
9+
10+
; Function Attrs: nounwind uwtable
11+
define void @foo() #0 {
12+
entry:
13+
%x = alloca i32, align 4
14+
%y = alloca i32, align 32
15+
%z = alloca i32, align 64
16+
%w = alloca i32, align 128
17+
%0 = bitcast i32* %x to i8*
18+
%1 = bitcast i32* %y to i8*
19+
%2 = bitcast i32* %z to i8*
20+
%3 = bitcast i32* %w to i8*
21+
call void @bar(i8* %0, i8* %1, i8* %2, i8* %3)
22+
ret void
23+
}
24+
25+
declare void @bar(i8*, i8*, i8*, i8*) #0
26+
27+
attributes #0 = { nounwind }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; RUN: llc -O0 -march=hexagon < %s | FileCheck %s
2+
; CHECK: sub(r29, r[[REG:[0-9]+]])
3+
; CHECK: r29 = r[[REG]]
4+
5+
target triple = "hexagon-unknown-unknown"
6+
7+
; Function Attrs: nounwind uwtable
8+
define void @foo(i32 %n) #0 {
9+
entry:
10+
%x = alloca i32, i32 %n
11+
%0 = bitcast i32* %x to i8*
12+
call void @bar(i8* %0)
13+
ret void
14+
}
15+
16+
declare void @bar(i8*) #0
17+
18+
attributes #0 = { nounwind }
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; RUN: llc -O0 -march=hexagon < %s | FileCheck %s
2+
; CHECK-DAG: r[[AP:[0-9]+]] = and(r30, #-32)
3+
; CHECK-DAG: r1 = add(r[[AP]], #-32)
4+
5+
; CHECK-DAG: sub(r29, r[[SP:[0-9]+]])
6+
; CHECK-DAG: r29 = r[[SP]]
7+
8+
target triple = "hexagon-unknown-unknown"
9+
10+
; Function Attrs: nounwind uwtable
11+
define void @foo(i32 %n) #0 {
12+
entry:
13+
%x = alloca i32, i32 %n
14+
%y = alloca i32, align 32
15+
%0 = bitcast i32* %x to i8*
16+
%1 = bitcast i32* %y to i8*
17+
call void @bar(i8* %0, i8* %1)
18+
ret void
19+
}
20+
21+
declare void @bar(i8*, i8* %y) #0
22+
23+
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)