| 1 |
; RUN: llc -verify-machineinstrs -O2 -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s |
| 2 |
|
| 3 |
; Function Attrs: norecurse nounwind |
| 4 |
define void @test1(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ptr nocapture readnone %c, i32 signext %n) #0 { |
| 5 |
|
| 6 |
; CHECK-LABEL: test1 |
| 7 |
|
| 8 |
entry: |
| 9 |
%idxprom = sext i32 %n to i64 |
| 10 |
%arrayidx = getelementptr inbounds i32, ptr %b, i64 %idxprom |
| 11 |
%0 = load i32, ptr %arrayidx, align 4, !tbaa !1 |
| 12 |
%conv = sitofp i32 %0 to float |
| 13 |
%mul = fmul float %conv, 0x4002916880000000 |
| 14 |
%arrayidx2 = getelementptr inbounds float, ptr %a, i64 %idxprom |
| 15 |
store float %mul, ptr %arrayidx2, align 4, !tbaa !5 |
| 16 |
ret void |
| 17 |
|
| 18 |
; CHECK-NOT: mtvsrwa |
| 19 |
; CHECK-NOT: mtfprwa |
| 20 |
; CHECK: lfiwax [[REG:[0-9]+]], {{.*}} |
| 21 |
; CHECK-NOT: mtvsrwa |
| 22 |
; CHECK-NOT: mtfprwa |
| 23 |
; CHECK: xscvsxdsp {{.*}}, [[REG]] |
| 24 |
; CHECK-NOT: mtvsrwa |
| 25 |
; CHECK-NOT: mtfprwa |
| 26 |
; CHECK: blr |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
; Function Attrs: norecurse nounwind readonly |
| 31 |
define float @test2(ptr nocapture readonly %b) #0 { |
| 32 |
|
| 33 |
; CHECK-LABEL: test2 |
| 34 |
|
| 35 |
entry: |
| 36 |
%0 = load i32, ptr %b, align 4, !tbaa !1 |
| 37 |
%conv = sitofp i32 %0 to float |
| 38 |
%mul = fmul float %conv, 0x40030A3D80000000 |
| 39 |
ret float %mul |
| 40 |
|
| 41 |
; CHECK-NOT: mtvsrwa |
| 42 |
; CHECK-NOT: mtfprwa |
| 43 |
; CHECK: lfiwax [[REG:[0-9]+]], {{.*}} |
| 44 |
; CHECK-NOT: mtvsrwa |
| 45 |
; CHECK-NOT: mtfprwa |
| 46 |
; CHECK: xscvsxdsp {{.*}}, [[REG]] |
| 47 |
; CHECK-NOT: mtvsrwa |
| 48 |
; CHECK-NOT: mtfprwa |
| 49 |
; CHECK: blr |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
; Function Attrs: norecurse nounwind |
| 54 |
define void @test3(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, ptr noalias nocapture %c, i32 signext %n) #0 { |
| 55 |
|
| 56 |
; CHECK-LABEL: test3 |
| 57 |
|
| 58 |
entry: |
| 59 |
%idxprom = sext i32 %n to i64 |
| 60 |
%arrayidx = getelementptr inbounds i32, ptr %b, i64 %idxprom |
| 61 |
%0 = load i32, ptr %arrayidx, align 4, !tbaa !1 |
| 62 |
%conv = sitofp i32 %0 to float |
| 63 |
%mul = fmul float %conv, 0x4002916880000000 |
| 64 |
%arrayidx2 = getelementptr inbounds float, ptr %a, i64 %idxprom |
| 65 |
store float %mul, ptr %arrayidx2, align 4, !tbaa !5 |
| 66 |
%arrayidx6 = getelementptr inbounds i32, ptr %c, i64 %idxprom |
| 67 |
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !1 |
| 68 |
%add = add nsw i32 %1, %0 |
| 69 |
store i32 %add, ptr %arrayidx6, align 4, !tbaa !1 |
| 70 |
ret void |
| 71 |
|
| 72 |
; CHECK: mtfprwa |
| 73 |
; CHECK: blr |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
!0 = !{!"clang version 3.9.0"} |
| 78 |
!1 = !{!2, !2, i64 0} |
| 79 |
!2 = !{!"int", !3, i64 0} |
| 80 |
!3 = !{!"omnipotent char", !4, i64 0} |
| 81 |
!4 = !{!"Simple C++ TBAA"} |
| 82 |
!5 = !{!6, !6, i64 0} |
| 83 |
!6 = !{!"float", !3, i64 0} |