Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -O2 -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s |
Ehsan Amiri | 322eca3 | 2016-04-06 20:12:29 +0000 | [diff] [blame] | 2 | |
| 3 | ; Function Attrs: norecurse nounwind |
| 4 | define void @test1(float* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* 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, i32* %b, i64 %idxprom |
| 11 | %0 = load i32, i32* %arrayidx, align 4, !tbaa !1 |
| 12 | %conv = sitofp i32 %0 to float |
| 13 | %mul = fmul float %conv, 0x4002916880000000 |
| 14 | %arrayidx2 = getelementptr inbounds float, float* %a, i64 %idxprom |
| 15 | store float %mul, float* %arrayidx2, align 4, !tbaa !5 |
| 16 | ret void |
| 17 | |
| 18 | ; CHECK-NOT: mtvsrwa |
| 19 | ; CHECK-NOT: mtfprwa |
| 20 | ; CHECK: lxsiwax [[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(i32* nocapture readonly %b) #0 { |
| 32 | |
| 33 | ; CHECK-LABEL: test2 |
| 34 | |
| 35 | entry: |
| 36 | %0 = load i32, i32* %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: lxsiwax [[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(float* noalias nocapture %a, i32* noalias nocapture readonly %b, i32* 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, i32* %b, i64 %idxprom |
| 61 | %0 = load i32, i32* %arrayidx, align 4, !tbaa !1 |
| 62 | %conv = sitofp i32 %0 to float |
| 63 | %mul = fmul float %conv, 0x4002916880000000 |
| 64 | %arrayidx2 = getelementptr inbounds float, float* %a, i64 %idxprom |
| 65 | store float %mul, float* %arrayidx2, align 4, !tbaa !5 |
| 66 | %arrayidx6 = getelementptr inbounds i32, i32* %c, i64 %idxprom |
| 67 | %1 = load i32, i32* %arrayidx6, align 4, !tbaa !1 |
| 68 | %add = add nsw i32 %1, %0 |
| 69 | store i32 %add, i32* %arrayidx6, align 4, !tbaa !1 |
| 70 | ret void |
| 71 | |
| 72 | ; CHECK: mtvsrwa |
| 73 | ; CHECK: blr |
| 74 | |
| 75 | } |
| 76 | |
| 77 | !0 = !{!"clang version 3.9.0 (http://llvm.org/git/clang.git b88a395e7ba26c0fb96cd99a2a004d76f4f41d0c) (http://llvm.org/git/llvm.git 1ac3fbac0f5b037c17c0b0f9d271c32c4d7ca1b5)"} |
| 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} |