| 1 |
; RUN: llc -verify-machineinstrs -mcpu=ppc64 < %s | FileCheck %s -check-prefixes=CHECK,GENERIC |
| 2 |
; RUN: llc -verify-machineinstrs -mcpu=970 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 3 |
; RUN: llc -verify-machineinstrs -mcpu=a2 < %s | FileCheck %s -check-prefixes=CHECK,BASIC |
| 4 |
; RUN: llc -verify-machineinstrs -mcpu=e500mc < %s | FileCheck %s -check-prefixes=CHECK,BASIC |
| 5 |
; RUN: llc -verify-machineinstrs -mcpu=e5500 < %s | FileCheck %s -check-prefixes=CHECK,BASIC |
| 6 |
; RUN: llc -verify-machineinstrs -mcpu=pwr4 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 7 |
; RUN: llc -verify-machineinstrs -mcpu=pwr5 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 8 |
; RUN: llc -verify-machineinstrs -mcpu=pwr5x < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 9 |
; RUN: llc -verify-machineinstrs -mcpu=pwr6 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 10 |
; RUN: llc -verify-machineinstrs -mcpu=pwr6x < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 11 |
; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 12 |
; RUN: llc -verify-machineinstrs -mcpu=pwr8 < %s | FileCheck %s -check-prefixes=CHECK,PWR |
| 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 |
; CHECK-LABEL: .globl foo |
| 23 |
; GENERIC: .p2align 2 |
| 24 |
; BASIC: .p2align 4 |
| 25 |
; PWR: .p2align 4 |
| 26 |
; CHECK: @foo |
| 27 |
} |
| 28 |
|
| 29 |
; Function Attrs: nounwind |
| 30 |
define void @loop(i32 signext %x, ptr nocapture %a) #1 { |
| 31 |
entry: |
| 32 |
br label %vector.body |
| 33 |
|
| 34 |
; CHECK-LABEL: @loop |
| 35 |
; CHECK: mtctr |
| 36 |
; GENERIC-NOT: .p2align |
| 37 |
; BASIC: .p2align 4 |
| 38 |
; PWR: .p2align 4 |
| 39 |
; CHECK: lwzu |
| 40 |
; CHECK: bdnz |
| 41 |
|
| 42 |
vector.body: ; preds = %vector.body, %entry |
| 43 |
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ] |
| 44 |
%induction45 = or i64 %index, 1 |
| 45 |
%0 = getelementptr inbounds i32, ptr %a, i64 %index |
| 46 |
%1 = getelementptr inbounds i32, ptr %a, i64 %induction45 |
| 47 |
%2 = load i32, ptr %0, align 4 |
| 48 |
%3 = load i32, ptr %1, align 4 |
| 49 |
%4 = add nsw i32 %2, 4 |
| 50 |
%5 = add nsw i32 %3, 4 |
| 51 |
%6 = mul nsw i32 %4, 3 |
| 52 |
%7 = mul nsw i32 %5, 3 |
| 53 |
store i32 %6, ptr %0, align 4 |
| 54 |
store i32 %7, ptr %1, align 4 |
| 55 |
%index.next = add i64 %index, 2 |
| 56 |
%8 = icmp eq i64 %index.next, 2048 |
| 57 |
br i1 %8, label %for.end, label %vector.body |
| 58 |
|
| 59 |
for.end: ; preds = %vector.body |
| 60 |
ret void |
| 61 |
} |
| 62 |
|
| 63 |
; Function Attrs: nounwind |
| 64 |
define void @sloop(i32 signext %x, ptr nocapture %a) #1 { |
| 65 |
entry: |
| 66 |
br label %for.body |
| 67 |
|
| 68 |
; CHECK-LABEL: @sloop |
| 69 |
; CHECK: mtctr |
| 70 |
; GENERIC-NOT: .p2align |
| 71 |
; BASIC: .p2align 4 |
| 72 |
; PWR: .p2align 5 |
| 73 |
; CHECK: bdnz |
| 74 |
|
| 75 |
for.body: ; preds = %for.body, %entry |
| 76 |
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 77 |
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv |
| 78 |
%0 = load i32, ptr %arrayidx, align 4 |
| 79 |
%add = add nsw i32 %0, 4 |
| 80 |
%mul = mul nsw i32 %add, 3 |
| 81 |
store i32 %mul, ptr %arrayidx, align 4 |
| 82 |
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 83 |
%exitcond = icmp eq i64 %indvars.iv.next, 2048 |
| 84 |
br i1 %exitcond, label %for.end, label %for.body |
| 85 |
|
| 86 |
for.end: ; preds = %for.body |
| 87 |
ret void |
| 88 |
} |
| 89 |
|
| 90 |
; Function Attrs: nounwind |
| 91 |
define void @test_minsize(i32 signext %x, ptr nocapture %a) #2 { |
| 92 |
entry: |
| 93 |
br label %vector.body |
| 94 |
|
| 95 |
; CHECK-LABEL: @test_minsize |
| 96 |
; CHECK: mtctr |
| 97 |
; GENERIC-NOT: .p2align |
| 98 |
; BASIC-NOT: .p2align |
| 99 |
; PWR-NOT: .p2align |
| 100 |
; CHECK: lwzu |
| 101 |
; CHECK: bdnz |
| 102 |
|
| 103 |
vector.body: ; preds = %vector.body, %entry |
| 104 |
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ] |
| 105 |
%induction45 = or i64 %index, 1 |
| 106 |
%0 = getelementptr inbounds i32, ptr %a, i64 %index |
| 107 |
%1 = getelementptr inbounds i32, ptr %a, i64 %induction45 |
| 108 |
%2 = load i32, ptr %0, align 4 |
| 109 |
%3 = load i32, ptr %1, align 4 |
| 110 |
%4 = add nsw i32 %2, 4 |
| 111 |
%5 = add nsw i32 %3, 4 |
| 112 |
%6 = mul nsw i32 %4, 3 |
| 113 |
%7 = mul nsw i32 %5, 3 |
| 114 |
store i32 %6, ptr %0, align 4 |
| 115 |
store i32 %7, ptr %1, align 4 |
| 116 |
%index.next = add i64 %index, 2 |
| 117 |
%8 = icmp eq i64 %index.next, 2048 |
| 118 |
br i1 %8, label %for.end, label %vector.body |
| 119 |
|
| 120 |
for.end: ; preds = %vector.body |
| 121 |
ret void |
| 122 |
} |
| 123 |
attributes #0 = { nounwind readnone } |
| 124 |
attributes #1 = { nounwind } |
| 125 |
attributes #2 = { nounwind minsize} |
| 126 |
|