diff options
author | Brendon Cahoon <bcahoon@codeaurora.org> | 2018-05-18 18:14:44 +0000 |
---|---|---|
committer | Brendon Cahoon <bcahoon@codeaurora.org> | 2018-05-18 18:14:44 +0000 |
commit | e5ed563cc57f69b3f6a5bd242d8ff029dee3f271 (patch) | |
tree | e2d8a09a27093f0b14ad50ee8d375b38d09e069d /llvm/test/CodeGen/Hexagon | |
parent | 083ea389d673e4dcfa3bee476598440f07d66ce6 (diff) | |
download | bcm5719-llvm-e5ed563cc57f69b3f6a5bd242d8ff029dee3f271.tar.gz bcm5719-llvm-e5ed563cc57f69b3f6a5bd242d8ff029dee3f271.zip |
[Hexagon] Generate post-increment for floating point types
The code that generates post-increments for Hexagon considered
integer values only. This patch adds support to generate them for
floating point values, f32 and f64.
Differential Revision: https://reviews.llvm.org/D47036
llvm-svn: 332748
Diffstat (limited to 'llvm/test/CodeGen/Hexagon')
-rw-r--r-- | llvm/test/CodeGen/Hexagon/postinc-float.ll | 86 | ||||
-rw-r--r-- | llvm/test/CodeGen/Hexagon/swp-memrefs-epilog.ll | 3 |
2 files changed, 87 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/Hexagon/postinc-float.ll b/llvm/test/CodeGen/Hexagon/postinc-float.ll new file mode 100644 index 00000000000..55bf82ddff5 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/postinc-float.ll @@ -0,0 +1,86 @@ +; RUN: llc -mtriple=hexagon-unknown-elf < %s | FileCheck %s + +; CHECK-LABEL: ldf +; CHECK: memw(r{{[0-9]+}}++#4) +; CHECK: memw(r{{[0-9]+}}++#4) +define float @ldf(float* nocapture readonly %x, float* nocapture readonly %y) local_unnamed_addr #0 { +entry: + br label %for.body + +for.body: + %arrayidx.phi = phi float* [ %x, %entry ], [ %arrayidx.inc, %for.body ] + %arrayidx1.phi = phi float* [ %y, %entry ], [ %arrayidx1.inc, %for.body ] + %i.09 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %acc.08 = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ] + %0 = load float, float* %arrayidx.phi, align 4 + %1 = load float, float* %arrayidx1.phi, align 4 + %mul = fmul contract float %0, %1 + %add = fadd contract float %acc.08, %mul + %inc = add nuw nsw i32 %i.09, 1 + %exitcond = icmp eq i32 %inc, 1024 + %arrayidx.inc = getelementptr float, float* %arrayidx.phi, i32 1 + %arrayidx1.inc = getelementptr float, float* %arrayidx1.phi, i32 1 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret float %add +} + +; CHECK-LABEL: ldd +; CHECK: memd(r{{[0-9]+}}++#8) +; CHECK: memd(r{{[0-9]+}}++#8) +define double @ldd(double* nocapture readonly %x, double* nocapture readonly %y) local_unnamed_addr #0 { +entry: + br label %for.body + +for.body: + %arrayidx.phi = phi double* [ %x, %entry ], [ %arrayidx.inc, %for.body ] + %arrayidx1.phi = phi double* [ %y, %entry ], [ %arrayidx1.inc, %for.body ] + %i.09 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %acc.08 = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ] + %0 = load double, double* %arrayidx.phi, align 8 + %1 = load double, double* %arrayidx1.phi, align 8 + %mul = fmul contract double %0, %1 + %add = fadd contract double %acc.08, %mul + %inc = add nuw nsw i32 %i.09, 1 + %exitcond = icmp eq i32 %inc, 1024 + %arrayidx.inc = getelementptr double, double* %arrayidx.phi, i32 1 + %arrayidx1.inc = getelementptr double, double* %arrayidx1.phi, i32 1 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret double %add +} + +; CHECK-LABEL: stf +; CHECK: memw(r{{[0-9]+}}++#4) +define double* @stf(float* returned %p) local_unnamed_addr #0 { +entry: + br label %for.body + +for.body: + %arrayidx.phi = phi float* [ %arrayidx.inc, %for.body ], [ %p, %entry ] + %call = tail call float @foof() #2 + store float %call, float* %arrayidx.phi, align 8 + %arrayidx.inc = getelementptr float, float* %arrayidx.phi, i32 1 + br label %for.body +} + +declare float @foof() local_unnamed_addr #1 + +; CHECK-LABEL: std +; CHECK: memd(r{{[0-9]+}}++#8) +define double* @std(double* returned %p) local_unnamed_addr #0 { +entry: + br label %for.body + +for.body: + %arrayidx.phi = phi double* [ %arrayidx.inc, %for.body ], [ %p, %entry ] + %call = tail call double @food() #2 + store double %call, double* %arrayidx.phi, align 8 + %arrayidx.inc = getelementptr double, double* %arrayidx.phi, i32 1 + br label %for.body +} + +declare double @food() local_unnamed_addr #1 + diff --git a/llvm/test/CodeGen/Hexagon/swp-memrefs-epilog.ll b/llvm/test/CodeGen/Hexagon/swp-memrefs-epilog.ll index ee017114e5a..81f4d22cfd5 100644 --- a/llvm/test/CodeGen/Hexagon/swp-memrefs-epilog.ll +++ b/llvm/test/CodeGen/Hexagon/swp-memrefs-epilog.ll @@ -10,8 +10,7 @@ ; to r29+32. If the memoperands are updated incorrectly, these are swapped. ; CHECK: [[REG0:r([0-9]+)]] = add(r29,#24) -; CHECK: [[REG1:r([0-9]+)]] = add([[REG0]],#4) -; CHECK: memw([[REG1]]+#{{[0-9]}}) = r{{[0-9]+}} +; CHECK: memw([[REG0]]++#4) = r{{[0-9]+}} ; CHECK: r{{[0-9]+}} = memw(r29+#{{[0-9]+}}) %s.0 = type { %s.1 } |