[PATCH] D142978: [AArch64][SVE] Fix crash for DestructiveBinaryCommWithRev zero merging
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 19:14:06 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG341b1df5bc7e: [AArch64][SVE] Fix crash for DestructiveBinaryCommWithRev zero merging (authored by Allen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142978/new/
https://reviews.llvm.org/D142978
Files:
llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
llvm/test/CodeGen/AArch64/sve-intrinsics-int-binaryCommWithRev-merging.mir
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-int-binaryCommWithRev-merging.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-int-binaryCommWithRev-merging.mir
@@ -0,0 +1,41 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=aarch64 -mattr=+sve -mattr=+use-experimental-zeroing-pseudos -run-pass=aarch64-expand-pseudo %s -o - | FileCheck %s
+
+# Should create an additional LSL to zero the lanes as the DstReg is not unique
+
+--- |
+ define <vscale x 4 x float> @fsub_s_zero(<vscale x 4 x i1> %pg, <vscale x 4 x float> %a){
+ %a_z = select <vscale x 4 x i1> %pg, <vscale x 4 x float> %a, <vscale x 4 x float> zeroinitializer
+ %out = call <vscale x 4 x float> @llvm.aarch64.sve.fsub.nxv4f32(<vscale x 4 x i1> %pg,
+ <vscale x 4 x float> %a_z,
+ <vscale x 4 x float> %a_z)
+ ret <vscale x 4 x float> %out
+ }
+
+ declare <vscale x 4 x float> @llvm.aarch64.sve.fsub.nxv4f32(<vscale x 4 x i1>, <vscale x 4 x float>, <vscale x 4 x float>)
+...
+---
+name: fsub_s_zero
+alignment: 4
+tracksRegLiveness: true
+tracksDebugUserValues: true
+registers: []
+liveins:
+ - { reg: '$p0', virtual-reg: '' }
+ - { reg: '$z0', virtual-reg: '' }
+body: |
+ bb.0 (%ir-block.0):
+ liveins: $p0, $z0
+
+ ; CHECK-LABEL: name: fsub_s_zero
+ ; CHECK: liveins: $p0, $z0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: BUNDLE implicit-def $z0, implicit-def $q0, implicit-def $d0, implicit-def $s0, implicit-def $h0, implicit-def $b0, implicit-def $z0_hi, implicit $p0, implicit $z0 {
+ ; CHECK-NEXT: $z0 = MOVPRFX_ZPzZ_S $p0, $z0
+ ; CHECK-NEXT: $z0 = LSL_ZPmI_S renamable $p0, internal $z0, 0
+ ; CHECK-NEXT: $z0 = FSUBR_ZPmZ_S renamable $p0, internal killed $z0, internal killed renamable $z0
+ ; CHECK-NEXT: }
+ ; CHECK-NEXT: RET undef $lr, implicit $z0
+ renamable $z0 = nnan ninf nsz arcp contract afn reassoc FSUB_ZPZZ_ZERO_S renamable $p0, killed renamable $z0, renamable $z0
+ RET_ReallyLR implicit $z0
+...
Index: llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
+++ llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
@@ -589,7 +589,8 @@
// If we cannot prefix the requested instruction we'll instead emit a
// prefixed_zeroing_mov for DestructiveBinary.
assert((DOPRegIsUnique || DType == AArch64::DestructiveBinary ||
- DType == AArch64::DestructiveBinaryComm) &&
+ DType == AArch64::DestructiveBinaryComm ||
+ DType == AArch64::DestructiveBinaryCommWithRev) &&
"The destructive operand should be unique");
assert(ElementSize != AArch64::ElementSizeNone &&
"This instruction is unpredicated");
@@ -607,7 +608,8 @@
// unique. Zeros the lanes in z0 that aren't active in p0 with sequence
// movprfx z0.b, p0/z, z0.b; lsl z0.b, p0/m, z0.b, #0;
if ((DType == AArch64::DestructiveBinary ||
- DType == AArch64::DestructiveBinaryComm) &&
+ DType == AArch64::DestructiveBinaryComm ||
+ DType == AArch64::DestructiveBinaryCommWithRev) &&
!DOPRegIsUnique) {
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(LSLZero))
.addReg(DstReg, RegState::Define)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142978.495351.patch
Type: text/x-patch
Size: 3546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230207/47d09da2/attachment.bin>
More information about the llvm-commits
mailing list