aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2022-08-24 17:28:07 +0100
committerSimon Pilgrim <llvm-dev@redking.me.uk>2022-08-24 17:28:18 +0100
commitf9de13232f9b1e8f35625a3a4af4c529ebc7663d (patch)
tree9994d6d994dafa797fe5c124c5df860dc21f9971 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent172fe1706d83832a330170f43fe52aab1b75e7de (diff)
downloadllvm-f9de13232f9b1e8f35625a3a4af4c529ebc7663d.zip
llvm-f9de13232f9b1e8f35625a3a4af4c529ebc7663d.tar.gz
llvm-f9de13232f9b1e8f35625a3a4af4c529ebc7663d.tar.bz2
[X86] Promote i8/i16 CTTZ (BSF) instructions and remove speculation branch
This patch adds a Type operand to the TLI isCheapToSpeculateCttz/isCheapToSpeculateCtlz callbacks, allowing targets to decide whether branches should occur on a type-by-type/legality basis. For X86, this patch proposes to allow CTTZ speculation for i8/i16 types that will lower to promoted i32 BSF instructions by masking the operand above the msb (we already do something similar for i8/i16 TZCNT). This required a minor tweak to CTTZ lowering - if the src operand is known never zero (i.e. due to the promotion masking) we can remove the CMOV zero src handling. Although BSF isn't very fast, most CPUs from the last 20 years don't do that bad a job with it, although there are some annoying passthrough EFLAGS dependencies. Additionally, now that we emit 'REP BSF' in most cases, we are tending towards assuming this will most likely be executed as a TZCNT instruction on any semi-modern CPU. Differential Revision: https://reviews.llvm.org/D132520
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
0 files changed, 0 insertions, 0 deletions