summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-06-16 23:58:24 +0000
committerJuergen Ributzka <juergen@apple.com>2014-06-16 23:58:24 +0000
commit408691f9673fb69b5ed45326f6ded4f3b6f19c50 (patch)
tree215ebd23bb95a3f5b16741f9da31deef80865f84 /lib/Target/X86/X86InstrInfo.cpp
parent4046db0cdb53b5383b2234f29d0ff478f5293b4b (diff)
downloadllvm-408691f9673fb69b5ed45326f6ded4f3b6f19c50.tar.gz
llvm-408691f9673fb69b5ed45326f6ded4f3b6f19c50.tar.bz2
llvm-408691f9673fb69b5ed45326f6ded4f3b6f19c50.tar.xz
[FastISel][X86] Refactor the code to get the X86 condition from a helper function. NFC.
Make use of helper functions to simplify the branch and compare instruction selection in FastISel. Also add test cases for compare and conditonal branch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index b9f1ed0124..bfc8e2759d 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -2670,8 +2670,7 @@ static X86::CondCode getSwappedCondition(X86::CondCode CC) {
/// getSETFromCond - Return a set opcode for the given condition and
/// whether it has memory operand.
-static unsigned getSETFromCond(X86::CondCode CC,
- bool HasMemoryOperand) {
+unsigned X86::getSETFromCond(CondCode CC, bool HasMemoryOperand) {
static const uint16_t Opc[16][2] = {
{ X86::SETAr, X86::SETAm },
{ X86::SETAEr, X86::SETAEm },
@@ -2691,7 +2690,7 @@ static unsigned getSETFromCond(X86::CondCode CC,
{ X86::SETSr, X86::SETSm }
};
- assert(CC < 16 && "Can only handle standard cond codes");
+ assert(CC <= LAST_VALID_COND && "Can only handle standard cond codes");
return Opc[CC][HasMemoryOperand ? 1 : 0];
}