1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib/Target/AArch64
Jim Grosbach 2f665f1cd7 AArch64: Constant fold converting vector setcc results to float.
Since the result of a SETCC for AArch64 is 0 or -1 in each lane, we can
move unary operations, in this case [su]int_to_fp through the mask
operation and constant fold the operation away. Generally speaking:
  UNARYOP(AND(VECTOR_CMP(x,y), constant))
      --> AND(VECTOR_CMP(x,y), constant2)
where constant2 is UNARYOP(constant).

This implements the transform where UNARYOP is [su]int_to_fp.

For example, consider the simple function:
define <4 x float> @foo(<4 x float> %val, <4 x float> %test) nounwind {
  %cmp = fcmp oeq <4 x float> %val, %test
  %ext = zext <4 x i1> %cmp to <4 x i32>
  %result = sitofp <4 x i32> %ext to <4 x float>
  ret <4 x float> %result
}

Before this change, the code is generated as:
  fcmeq.4s  v0, v0, v1
  movi.4s v1, #0x1        // Integer splat value.
  and.16b v0, v0, v1      // Mask lanes based on the comparison.
  scvtf.4s  v0, v0        // Convert each lane to f32.
  ret

After, the code is improved to:
  fcmeq.4s  v0, v0, v1
  fmov.4s v1, #1.00000000 // f32 splat value.
  and.16b v0, v0, v1      // Mask lanes based on the comparison.
  ret

The svvtf.4s has been constant folded away and the floating point 1.0f
vector lanes are materialized directly via fmov.4s.

Rather than do the folding manually in the target code, teach getNode()
in the generic SelectionDAG to handle folding constant operands of
vector [su]int_to_fp nodes. It is reasonable (as noted in a FIXME) to do
additional constant folding there as well, but I don't have test cases
for those operations, so leaving them for another time when it becomes
appropriate.

rdar://17693791

llvm-svn: 213341
2014-07-18 00:40:52 +00:00
..
AsmParser [AArch64] Cleanup AsmParser: no need to use dyn_cast + assert. cast does it for us. 2014-07-17 19:08:14 +00:00
Disassembler Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert. 2014-06-19 06:10:58 +00:00
InstPrinter Replace some assert(0)'s with llvm_unreachable. 2014-06-18 05:05:13 +00:00
MCTargetDesc Move expression visitation logic up to MCStreamer. 2014-06-25 15:45:33 +00:00
TargetInfo AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
Utils Restore getInvertedCondCode() from the phased-out backend, fixing disassembly for NV 2014-05-29 11:34:50 +00:00
AArch64.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64.td [AArch64] Basic Sched Model for Cortex-A57. 2014-06-11 21:06:56 +00:00
AArch64AddressTypePromotion.cpp AArch64: Re-enable AArch64AddressTypePromotion 2014-07-02 18:17:40 +00:00
AArch64AdvSIMDScalarPass.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64AsmPrinter.cpp Replace some assert(0)'s with llvm_unreachable. 2014-06-18 05:05:13 +00:00
AArch64BranchRelaxation.cpp Replace some assert(0)'s with llvm_unreachable. 2014-06-18 05:05:13 +00:00
AArch64CallingConvention.td ARM: Allow __fp16 as a function arg or return type for AArch64 2014-07-11 13:33:46 +00:00
AArch64CleanupLocalDynamicTLSPass.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64CollectLOH.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64ConditionalCompares.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64DeadRegisterDefinitionsPass.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64ExpandPseudoInsts.cpp AArch64: remove unnecessary pseudo-instruction. 2014-07-14 11:16:02 +00:00
AArch64FastISel.cpp AArch64: correctly fast-isel i8 & i16 multiplies 2014-07-10 14:18:46 +00:00
AArch64FrameLowering.cpp Remove the uses of AArch64TargetMachine and AArch64Subtarget from 2014-06-10 17:33:39 +00:00
AArch64FrameLowering.h Remove the uses of AArch64TargetMachine and AArch64Subtarget from 2014-06-10 17:33:39 +00:00
AArch64InstrAtomics.td AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64InstrFormats.td Port memory barriers intrinsics to AArch64 2014-07-17 10:50:20 +00:00
AArch64InstrInfo.cpp Replace some assert(0)'s with llvm_unreachable. 2014-06-18 05:05:13 +00:00
AArch64InstrInfo.h Remove a method that was just replacing direct access to a member. 2014-06-10 22:57:21 +00:00
AArch64InstrInfo.td CodeGen: extend f16 conversions to permit types > float. 2014-07-17 10:51:23 +00:00
AArch64ISelDAGToDAG.cpp [AArch64] Unsized types don't specify an alignment. 2014-06-30 15:03:00 +00:00
AArch64ISelLowering.cpp AArch64: Constant fold converting vector setcc results to float. 2014-07-18 00:40:52 +00:00
AArch64ISelLowering.h [codegen,aarch64] Add a target hook to the code generator to control 2014-07-03 00:23:43 +00:00
AArch64LoadStoreOptimizer.cpp [AArch64] clang-format the load/store optimizer. 2014-06-04 12:40:35 +00:00
AArch64MachineFunctionInfo.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64MCInstLower.cpp Replace some assert(0)'s with llvm_unreachable. 2014-06-18 05:05:13 +00:00
AArch64MCInstLower.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64PerfectShuffle.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64PromoteConstant.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64RegisterInfo.cpp AArch64: implement copies to/from NZCV as a last ditch effort. 2014-05-27 12:16:02 +00:00
AArch64RegisterInfo.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64RegisterInfo.td AArch64: disallow x30 & x29 as the destination for indirect tail calls 2014-06-10 10:50:24 +00:00
AArch64SchedA53.td Fix typos 2014-05-31 21:26:28 +00:00
AArch64SchedA57.td [AArch64] Basic Sched Model for Cortex-A57. 2014-06-11 21:06:56 +00:00
AArch64SchedA57WriteRes.td [AArch64] Basic Sched Model for Cortex-A57. 2014-06-11 21:06:56 +00:00
AArch64SchedCyclone.td AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64Schedule.td AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64SelectionDAGInfo.cpp [DAG] Pass the argument list to the CallLoweringInfo via move semantics. NFCI. 2014-07-01 22:01:54 +00:00
AArch64SelectionDAGInfo.h Have AArch64SelectionDAGInfo take a DataLayout parameter rather 2014-06-10 18:06:28 +00:00
AArch64StorePairSuppress.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64Subtarget.cpp Move to a private function to initialize the subtarget dependencies 2014-06-11 00:46:34 +00:00
AArch64Subtarget.h Move to a private function to initialize the subtarget dependencies 2014-06-11 00:46:34 +00:00
AArch64TargetMachine.cpp AArch64: Re-enable AArch64AddressTypePromotion 2014-07-02 18:17:40 +00:00
AArch64TargetMachine.h Remove extraneous includes from the target machines. 2014-06-26 19:30:05 +00:00
AArch64TargetObjectFile.cpp AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64TargetObjectFile.h AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
AArch64TargetTransformInfo.cpp AArch64: improve handling & modelling of FP_TO_XINT nodes. 2014-06-15 09:27:15 +00:00
CMakeLists.txt AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
LLVMBuild.txt AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
Makefile AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00