[PATCH] D84500: [ARM] Added additional patterns to VABD instruction

Meera Nakrani via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 04:25:09 PDT 2020


MeeraN updated this revision to Diff 280402.
MeeraN added a comment.

Added second test for f16 case and made test cases much shorter. Also moved position of pattern definition so that the size is handled clearly


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

https://reviews.llvm.org/D84500

Files:
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-vabd.ll


Index: llvm/test/CodeGen/Thumb2/mve-vabd.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/Thumb2/mve-vabd.ll
@@ -0,0 +1,31 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve.fp %s -o - | FileCheck %s
+
+define arm_aapcs_vfpcc void @vabd_v4f32(<4 x float> %x, <4 x float> %y, <4 x float>* %z) {
+; CHECK-LABEL: vabd_v4f32
+; CHECK:       @ %bb.0: @ %entry
+; CHECK-NEXT:  vabd.f32 q0, q0, q1
+; CHECK-NEXT:  vstrw.32 q0, [r0]
+; CHECK-NEXT:  bx lr
+entry:
+  %0 = fsub fast <4 x float> %x, %y
+  %1 = call fast <4 x float> @llvm.fabs.v4f32(<4 x float> %0)
+  store <4 x float> %1, <4 x float>* %z, align 4
+  ret void
+}
+
+define arm_aapcs_vfpcc void @vabd_v8f16(<8 x half> %x, <8 x half> %y, <8 x half>* %z) {
+; CHECK-LABEL: vabd_v8f16
+; CHECK:       @ %bb.0: @ %entry
+; CHECK-NEXT:  vabd.f16 q0, q0, q1
+; CHECK-NEXT:  vstrw.32 q0, [r0]
+; CHECK-NEXT:  bx lr
+entry:
+  %0 = fsub fast <8 x half> %x, %y
+  %1 = call fast <8 x half> @llvm.fabs.v8f16(<8 x half> %0)
+  store <8 x half> %1, <8 x half>* %z
+  ret void
+}
+
+declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
+declare <8 x half> @llvm.fabs.v8f16(<8 x half>)
Index: llvm/lib/Target/ARM/ARMInstrMVE.td
===================================================================
--- llvm/lib/Target/ARM/ARMInstrMVE.td
+++ llvm/lib/Target/ARM/ARMInstrMVE.td
@@ -3708,6 +3708,13 @@
 defm MVE_VABDf32 : MVE_VABD_fp_m<MVE_v4f32>;
 defm MVE_VABDf16 : MVE_VABD_fp_m<MVE_v8f16>;
 
+let Predicates = [HasMVEFloat] in {
+  def : Pat<(v8f16 (fabs (fsub (v8f16 MQPR:$Qm), (v8f16 MQPR:$Qn)))),
+        (MVE_VABDf16 MQPR:$Qm, MQPR:$Qn)>;
+  def : Pat<(v4f32 (fabs (fsub (v4f32 MQPR:$Qm), (v4f32 MQPR:$Qn)))),
+        (MVE_VABDf32 MQPR:$Qm, MQPR:$Qn)>;
+}
+
 class MVE_VCVT_fix<string suffix, bit fsi, bit U, bit op,
                    Operand imm_operand_type>
   : MVE_float<"vcvt", suffix,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84500.280402.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/43589c42/attachment.bin>


More information about the llvm-commits mailing list