[PATCH] D60212: [AArch64] Add lowering pattern for scalar fp16 facge and facgt

Diogo N. Sampaio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 3 09:50:38 PDT 2019


dnsampaio created this revision.
dnsampaio added reviewers: olista01, pablooliveira, javed.absar.
Herald added subscribers: llvm-commits, kristof.beyls.
Herald added a project: LLVM.
dnsampaio edited reviewers, added: pbarrio; removed: pablooliveira.

The fp16 scalar version of facge and facgt requires a custom patter matching, as the result type is not the same width of the operands.


Repository:
  rL LLVM

https://reviews.llvm.org/D60212

Files:
  lib/Target/AArch64/AArch64InstrInfo.td
  test/CodeGen/AArch64/fp16_intrinsic_scalar_2op.ll


Index: test/CodeGen/AArch64/fp16_intrinsic_scalar_2op.ll
===================================================================
--- test/CodeGen/AArch64/fp16_intrinsic_scalar_2op.ll
+++ test/CodeGen/AArch64/fp16_intrinsic_scalar_2op.ll
@@ -318,3 +318,27 @@
   %vcvth_n_u32_f16 = tail call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 16)
   ret i32 %vcvth_n_u32_f16
 }
+
+declare i32 @llvm.aarch64.neon.facge.i32.f16(half, half)
+define dso_local i16 @vcageh_f16_test(half %a, half %b) {
+; CHECK-LABEL: vcageh_f16_test:
+; CHECK:        facge   h0, h0, h1
+; CHECK-NEXT:        fmov    w0, s0
+; CHECK-NEXT:        ret
+entry:
+  %facg = tail call i32 @llvm.aarch64.neon.facge.i32.f16(half %a, half %b)
+  %0 = trunc i32 %facg to i16
+  ret i16 %0
+}
+
+declare i32 @llvm.aarch64.neon.facgt.i32.f16(half, half)
+define dso_local i16 @vcagth_f16_test(half %a, half %b) {
+; CHECK-LABEL: vcagth_f16_test:
+; CHECK:        facgt   h0, h0, h1
+; CHECK-NEXT:        fmov    w0, s0
+; CHECK-NEXT:        ret
+entry:
+  %facg = tail call i32 @llvm.aarch64.neon.facgt.i32.f16(half %a, half %b)
+  %0 = trunc i32 %facg to i16
+  ret i16 %0
+}
Index: lib/Target/AArch64/AArch64InstrInfo.td
===================================================================
--- lib/Target/AArch64/AArch64InstrInfo.td
+++ lib/Target/AArch64/AArch64InstrInfo.td
@@ -5355,6 +5355,16 @@
             (i64 (IMPLICIT_DEF)),
             (FCVTZUh FPR16:$Rn, vecshiftR64:$imm),
             hsub))>;
+def : Pat<(i32 (int_aarch64_neon_facge (f16 FPR16:$Rn), (f16 FPR16:$Rm))),
+          (i32 (INSERT_SUBREG
+            (i32 (IMPLICIT_DEF)),
+            (FACGE16 FPR16:$Rn, FPR16:$Rm),
+            hsub))>;
+def : Pat<(i32 (int_aarch64_neon_facgt (f16 FPR16:$Rn), (f16 FPR16:$Rm))),
+          (i32 (INSERT_SUBREG
+            (i32 (IMPLICIT_DEF)),
+            (FACGT16 FPR16:$Rn, FPR16:$Rm),
+            hsub))>;
 
 defm SHL      : SIMDScalarLShiftD<   0, 0b01010, "shl", AArch64vshl>;
 defm SLI      : SIMDScalarLShiftDTied<1, 0b01010, "sli">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60212.193528.patch
Type: text/x-patch
Size: 2024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/8791e7eb/attachment.bin>


More information about the llvm-commits mailing list