[PowerPC] Use 16-byte alignment for modern cores for functions/loops
[oota-llvm.git] / test / CodeGen / PowerPC / code-align.ll
1 ; RUN: llc -mcpu=ppc64 < %s | FileCheck %s -check-prefix=GENERIC
2 ; RUN: llc -mcpu=970 < %s | FileCheck %s -check-prefix=BASIC
3 ; RUN: llc -mcpu=a2 < %s | FileCheck %s -check-prefix=BASIC
4 ; RUN: llc -mcpu=e500mc < %s | FileCheck %s -check-prefix=BASIC
5 ; RUN: llc -mcpu=e5500 < %s | FileCheck %s -check-prefix=BASIC
6 ; RUN: llc -mcpu=pwr4 < %s | FileCheck %s -check-prefix=BASIC
7 ; RUN: llc -mcpu=pwr5 < %s | FileCheck %s -check-prefix=BASIC
8 ; RUN: llc -mcpu=pwr5x < %s | FileCheck %s -check-prefix=BASIC
9 ; RUN: llc -mcpu=pwr6 < %s | FileCheck %s -check-prefix=BASIC
10 ; RUN: llc -mcpu=pwr6x < %s | FileCheck %s -check-prefix=BASIC
11 ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s -check-prefix=BASIC
12 ; RUN: llc -mcpu=pwr8 < %s | FileCheck %s -check-prefix=BASIC
13 target datalayout = "E-m:e-i64:64-n32:64"
14 target triple = "powerpc64-unknown-linux-gnu"
15
16 ; Function Attrs: nounwind readnone
17 define signext i32 @foo(i32 signext %x) #0 {
18 entry:
19   %mul = shl nsw i32 %x, 1
20   ret i32 %mul
21
22 ; GENERIC-LABEL: .globl  foo
23 ; BASIC-LABEL: .globl  foo
24 ; GENERIC: .align  2
25 ; BASIC: .align  4
26 ; GENERIC: @foo
27 ; BASIC: @foo
28 }
29
30 ; Function Attrs: nounwind
31 define void @loop(i32 signext %x, i32* nocapture %a) #1 {
32 entry:
33   br label %vector.body
34
35 ; GENERIC-LABEL: @loop
36 ; BASIC-LABEL: @loop
37 ; GENERIC: mtctr
38 ; BASIC: mtctr
39 ; GENERIC-NOT: .align
40 ; BASIC: .align  4
41 ; GENERIC: bdnz
42 ; BASIC: bdnz
43
44 vector.body:                                      ; preds = %vector.body, %entry
45   %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
46   %induction45 = or i64 %index, 1
47   %0 = getelementptr inbounds i32* %a, i64 %index
48   %1 = getelementptr inbounds i32* %a, i64 %induction45
49   %2 = load i32* %0, align 4
50   %3 = load i32* %1, align 4
51   %4 = add nsw i32 %2, 4
52   %5 = add nsw i32 %3, 4
53   store i32 %4, i32* %0, align 4
54   store i32 %5, i32* %1, align 4
55   %index.next = add i64 %index, 2
56   %6 = icmp eq i64 %index.next, 2048
57   br i1 %6, label %for.end, label %vector.body
58
59 for.end:                                          ; preds = %vector.body
60   ret void
61 }
62
63 attributes #0 = { nounwind readnone }
64 attributes #1 = { nounwind }
65