[PATCH] D11393: [X86] Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.
Cong Hou via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 16:07:38 PST 2016
congh added inline comments.
================
Comment at: lib/Target/X86/X86InstrInfo.cpp:4055
@@ +4054,3 @@
+ // is named COND_P_AND_NE.
+ BranchCode = X86::COND_P_AND_NE;
+ } else if ((OldBranchCode == X86::COND_NP && BranchCode == X86::COND_NE) ||
----------------
davidxl wrote:
> For B1, the condition is NP_OR_E, so why not using COND_NP_OR_E as the branch code? Is the new code needed? (after swapping TBB and FBB)
This is actually why this patch is created: COND_NP_OR_E is equivalent to COND_P_AND_NE, but the latter has the second condition reversed based on the former. COND_NP_OR_E has a JNP and JE, while COND_P_AND_NE has a JNP and JNE, or JE and JP. COND_NP_OR_E always has two identical targets, but COND_P_AND_NE doesn't. So they are different patterns. We use different names so that in X86::GetOppositeBranchCondition() we can get the reverse condition code for each other.
================
Comment at: lib/Target/X86/X86InstrInfo.cpp:4059
@@ +4058,3 @@
+ // See comments above for X86::COND_P_AND_NE.
+ BranchCode = X86::COND_E_AND_NP;
+ } else
----------------
davidxl wrote:
> To make sure the pattern is fully checked, I think NewTBB != TBB is also needed.
>
>
But there is nothing wrong when NewTBB == TBB. This pattern doesn't care if they are the same or different basic blocks.
http://reviews.llvm.org/D11393
More information about the llvm-commits
mailing list