From 32b44f6a34ffbcf3f429527c2f9a9a993211ab18 Mon Sep 17 00:00:00 2001 From: Haicheng Wu Date: Tue, 12 Jul 2016 15:31:41 +0000 Subject: [PATCH] [AArch64] Set FMOVS0 and FMOVD0 as isAsCheapAsAMove when needed. If a subtarget has both ZCZeroing and CustomCheapAsMoveHandling features (now only Kryo has both), set FMOVS0 and FMOVD0 isAsCheapAsAMove. Differential Revision: http://reviews.llvm.org/D22256 llvm-svn: 275178 --- lib/Target/AArch64/AArch64InstrInfo.cpp | 6 ++++++ test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Target/AArch64/AArch64InstrInfo.cpp b/lib/Target/AArch64/AArch64InstrInfo.cpp index f5a5dd5894a..de881e75ce4 100644 --- a/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -620,6 +620,12 @@ bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr &MI) const { return canBeExpandedToORR(MI, 32); case AArch64::MOVi64imm: return canBeExpandedToORR(MI, 64); + + // It is cheap to move #0 to float registers if the subtarget has + // ZeroCycleZeroing feature. + case AArch64::FMOVS0: + case AArch64::FMOVD0: + return Subtarget.hasZeroCycleZeroing(); } llvm_unreachable("Unknown opcode to check as cheap as a move!"); diff --git a/test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll b/test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll index 8946466b18d..ae77f7e099d 100644 --- a/test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll +++ b/test/CodeGen/AArch64/arm64-zero-cycle-zeroing.ll @@ -13,9 +13,9 @@ entry: ; CYCLONE: movi.2d v2, #0000000000000000 ; CYCLONE: movi.2d v3, #0000000000000000 ; KRYO: movi v0.2d, #0000000000000000 -; KRYO: mov v1.16b, v0.16b -; KRYO: mov v2.16b, v0.16b -; KRYO: mov v3.16b, v0.16b +; KRYO: movi v1.2d, #0000000000000000 +; KRYO: movi v2.2d, #0000000000000000 +; KRYO: movi v3.2d, #0000000000000000 tail call void @bar(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00) nounwind ret void } @@ -46,7 +46,7 @@ define void @t4() nounwind ssp { ; CYCLONE: movi.2d v0, #0000000000000000 ; CYCLONE: movi.2d v1, #0000000000000000 ; KRYO: movi v0.2d, #0000000000000000 -; KRYO: mov v1.16b, v0.16b +; KRYO: movi v1.2d, #0000000000000000 tail call void @barf(float 0.000000e+00, float 0.000000e+00) nounwind ret void }