[llvm] [GlobalISel][AArch64] Legalize G_FABS and G_FNEG for SVE (PR #114784)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 14:00:28 PST 2024


================
@@ -0,0 +1,36 @@
+//===-- AArch64GlobalISelPatterns.td - GlobalISel patterns -*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Selection and combine patterns for GlobalISel.
+//
+//===----------------------------------------------------------------------===//
+
+
+//unpredicate patterns
+
+
+
+// fneg
+def : Pat<(nxv2f64 (fneg nxv2f64:$src)),
+          (FNEG_ZPmZ_D (IMPLICIT_DEF), (PTRUE_D 31), ZPR:$src)>;
----------------
tschuett wrote:

```
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
; RUN: llc -global-isel -mtriple aarch64 -mattr=+sve -global-isel-abort=2 -stop-after=instruction-select -aarch64-enable-gisel-sve=1 %s -o - | FileCheck %s

define <vscale x 8 x half> @fabsnxv8half(<vscale x 8 x half> %a) {
  ; CHECK-LABEL: name: fabsnxv8half
  ; CHECK: bb.1.entry:
  ; CHECK-NEXT:   liveins: $z0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:zpr = COPY $z0
  ; CHECK-NEXT:   [[PTRUE_H:%[0-9]+]]:ppr_3b = PTRUE_H 31, implicit $vg
  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:zpr = IMPLICIT_DEF
  ; CHECK-NEXT:   [[FABS_ZPmZ_H_UNDEF:%[0-9]+]]:zpr = FABS_ZPmZ_H_UNDEF [[DEF]], [[PTRUE_H]], [[COPY]]
  ; CHECK-NEXT:   $z0 = COPY [[FABS_ZPmZ_H_UNDEF]]
  ; CHECK-NEXT:   RET_ReallyLR implicit $z0
entry:
   %c = tail call <vscale x 8 x half> @llvm.fabs.nxv8f16(<vscale x 8 x half> %a)
  ret <vscale x 8 x half> %c
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
```
I can get the _UNDEF, but I don't get the `killed`.

https://github.com/llvm/llvm-project/pull/114784


More information about the llvm-commits mailing list