[PATCH] D105860: [AArch64] Implement floating point subreg copies
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 12 17:16:10 PDT 2021
jroelofs created this revision.
jroelofs added reviewers: paquette, t.p.northover.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
jroelofs requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105860
Files:
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/postrapseudos-fmov-fp-subreg.mir
Index: llvm/test/CodeGen/AArch64/GlobalISel/postrapseudos-fmov-fp-subreg.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/GlobalISel/postrapseudos-fmov-fp-subreg.mir
@@ -0,0 +1,53 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc < %s -run-pass=postrapseudos -mtriple=arm64-apple-ios -o - | FileCheck %s
+
+...
+---
+name: fmov_d0_s0
+tracksRegLiveness: true
+liveins:
+ - { reg: '$s0' }
+body: |
+ bb.0:
+ liveins: $s0
+
+ ; CHECK-LABEL: name: fmov_d0_s0
+ ; CHECK: liveins: $s0
+ ; CHECK: $s0 = FMOVSr $s0, implicit killed $d0, implicit-def $q0
+ ; CHECK: RET_ReallyLR
+ renamable $d0 = COPY renamable $s0, implicit killed $d0, implicit-def $q0
+ RET_ReallyLR
+
+...
+---
+name: fmov_d0_h0
+tracksRegLiveness: true
+liveins:
+ - { reg: '$h0' }
+body: |
+ bb.0:
+ liveins: $h0
+
+ ; CHECK-LABEL: name: fmov_d0_h0
+ ; CHECK: liveins: $h0
+ ; CHECK: $h0 = FMOVHr $h0, implicit killed $d0, implicit-def $q0
+ ; CHECK: RET_ReallyLR
+ renamable $d0 = COPY renamable $h0, implicit killed $d0, implicit-def $q0
+ RET_ReallyLR
+
+...
+---
+name: fmov_s0_h0
+tracksRegLiveness: true
+liveins:
+ - { reg: '$h0' }
+body: |
+ bb.0:
+ liveins: $h0
+
+ ; CHECK-LABEL: name: fmov_s0_h0
+ ; CHECK: liveins: $h0
+ ; CHECK: $h0 = FMOVHr $h0, implicit killed $s0, implicit-def $q0
+ ; CHECK: RET_ReallyLR
+ renamable $s0 = COPY renamable $h0, implicit killed $s0, implicit-def $q0
+ RET_ReallyLR
Index: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -3621,8 +3621,25 @@
return;
}
-#ifndef NDEBUG
const TargetRegisterInfo &TRI = getRegisterInfo();
+ if (AArch64::FPR64RegClass.contains(DestReg) &&
+ AArch64::FPR32RegClass.contains(SrcReg)) {
+ DestReg = TRI.getSubReg(DestReg, AArch64::ssub);
+ BuildMI(MBB, I, DL, get(AArch64::FMOVSr), DestReg)
+ .addReg(SrcReg, getKillRegState(KillSrc));
+ return;
+ }
+
+ if ((AArch64::FPR64RegClass.contains(DestReg) ||
+ AArch64::FPR32RegClass.contains(DestReg)) &&
+ AArch64::FPR16RegClass.contains(SrcReg)) {
+ DestReg = TRI.getSubReg(DestReg, AArch64::hsub);
+ BuildMI(MBB, I, DL, get(AArch64::FMOVHr), DestReg)
+ .addReg(SrcReg, getKillRegState(KillSrc));
+ return;
+ }
+
+#ifndef NDEBUG
errs() << TRI.getRegAsmName(DestReg) << " = COPY "
<< TRI.getRegAsmName(SrcReg) << "\n";
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105860.358107.patch
Type: text/x-patch
Size: 2700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210713/9466606a/attachment.bin>
More information about the llvm-commits
mailing list