[PATCH] D13467: [mips] Handle undef when extracting subregs from FP64 registers.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 05:44:14 PDT 2015
dsanders created this revision.
dsanders added a reviewer: vkalintiris.
dsanders added subscribers: petarj, zoran.jovanovic, llvm-commits.
This removes unnecessary instructions when extracting from an undefined register
and also fixes a crash for O32 when passing undef to a double argument in
held in integer registers.
http://reviews.llvm.org/D13467
Files:
lib/Target/Mips/MipsSEFrameLowering.cpp
test/CodeGen/Mips/llvm-ir/call.ll
Index: test/CodeGen/Mips/llvm-ir/call.ll
===================================================================
--- test/CodeGen/Mips/llvm-ir/call.ll
+++ test/CodeGen/Mips/llvm-ir/call.ll
@@ -6,6 +6,7 @@
; RUN: llc -march=mips -mcpu=mips32r3 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=O32
; RUN: llc -march=mips -mcpu=mips32r5 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=O32
; RUN: llc -march=mips -mcpu=mips32r6 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=O32
+; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+fp64,+nooddspreg -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=O32
; RUN: llc -march=mips64 -mcpu=mips4 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=N64
; RUN: llc -march=mips64 -mcpu=mips64 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=N64
; RUN: llc -march=mips64 -mcpu=mips64r2 -enable-mips-tail-calls < %s | FileCheck %s -check-prefix=ALL -check-prefix=N64
@@ -168,3 +169,16 @@
%1 = tail call float %addr()
ret float %1
}
+
+; Check that passing undef as a double value doesn't cause machine code errors
+; for FP64.
+declare hidden void @undef_double(i32 %this, double %volume) unnamed_addr align 2
+
+define hidden void @thunk_undef_double(i32 %this, double %volume) unnamed_addr align 2 {
+; ALL-LABEL: thunk_undef_double:
+; O32: # implicit-def: A2
+; O32: # implicit-def: A3
+; ALL: jr $25
+ tail call void @undef_double(i32 undef, double undef) #8
+ ret void
+}
Index: lib/Target/Mips/MipsSEFrameLowering.cpp
===================================================================
--- lib/Target/Mips/MipsSEFrameLowering.cpp
+++ lib/Target/Mips/MipsSEFrameLowering.cpp
@@ -319,6 +319,12 @@
bool ExpandPseudo::expandExtractElementF64(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
bool FP64) const {
+ if (I->getOperand(1).isUndef() || I->getOperand(2).isUndef()) {
+ unsigned DstReg = I->getOperand(0).getReg();
+ BuildMI(MBB, I, DebugLoc(), TII.get(Mips::IMPLICIT_DEF), DstReg);
+ return true;
+ }
+
// For fpxx and when mfhc1 is not available, use:
// spill + reload via ldc1
//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13467.36612.patch
Type: text/x-patch
Size: 2327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151006/5aa5e20d/attachment.bin>
More information about the llvm-commits
mailing list