[PATCH] D62330: [ARM] Select fp16 fma

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 04:32:15 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL361719: [ARM] Select fp16 fma (authored by dmgreen, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62330?vs=201005&id=201445#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62330/new/

https://reviews.llvm.org/D62330

Files:
  llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
  llvm/trunk/test/CodeGen/ARM/fp16-fullfp16.ll


Index: llvm/trunk/test/CodeGen/ARM/fp16-fullfp16.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/fp16-fullfp16.ll
+++ llvm/trunk/test/CodeGen/ARM/fp16-fullfp16.ll
@@ -386,15 +386,21 @@
   ret void
 }
 
-; FIXME
-;define void @test_fma(half* %p, half* %q, half* %r) {
-;  %a = load half, half* %p, align 2
-;  %b = load half, half* %q, align 2
-;  %c = load half, half* %r, align 2
-;  %v = call half @llvm.fma.f16(half %a, half %b, half %c)
-;  store half %v, half* %p
-;  ret void
-;}
+define void @test_fma(half* %p, half* %q, half* %r) {
+; CHECK-LABEL: test_fma:
+; CHECK:         vldr.16 s0, [r1]
+; CHECK-NEXT:    vldr.16 s2, [r0]
+; CHECK-NEXT:    vldr.16 s4, [r2]
+; CHECK-NEXT:    vfma.f16 s4, s2, s0
+; CHECK-NEXT:    vstr.16 s4, [r0]
+; CHECK-NEXT:    bx lr
+  %a = load half, half* %p, align 2
+  %b = load half, half* %q, align 2
+  %c = load half, half* %r, align 2
+  %v = call half @llvm.fma.f16(half %a, half %b, half %c)
+  store half %v, half* %p
+  ret void
+}
 
 define void @test_fabs(half* %p) {
 ; CHECK-LABEL: test_fabs:
Index: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
+++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
@@ -2073,6 +2073,9 @@
 def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, SPR:$Sdin)),
           (VFMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
       Requires<[HasVFP4]>;
+def : Pat<(f16 (fma HPR:$Sn, HPR:$Sm, HPR:$Sdin)),
+          (VFMAH HPR:$Sdin, HPR:$Sn, HPR:$Sm)>,
+      Requires<[HasFullFP16]>;
 
 def VFMSD : ADbI<0b11101, 0b10, 1, 0,
                  (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62330.201445.patch
Type: text/x-patch
Size: 1701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190526/43f13e1c/attachment.bin>


More information about the llvm-commits mailing list