[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
Fri Jan 22 16:10:51 PST 2016
congh added inline comments.
================
Comment at: lib/Target/X86/X86InstrInfo.cpp:4062
@@ -4039,3 +4061,3 @@
return true;
// Update the MachineOperand.
----------------
davidxl wrote:
> Should these two JCCs be eliminated?
This is just an intermediate state, when AnalyzeBranch() is called. I believe they will be eliminated later.
================
Comment at: test/CodeGen/X86/fp-une-cmp.ll:49
@@ +48,3 @@
+; CHECK-NEXT: jp [[LABEL]]
+; CHECK: jmp
+;
----------------
davidxl wrote:
> The branch sequence does imply BB2 is reordered before BB1. Is it better to explicit test the label order?
>
> Also why is the jump sequence not the optimal one:
>
> jne bb2
> jnp bb1
> bb2:
> bb1:
OK, I will test the BB orders.
The generated assembly is shown below, which should be optimal.
```
func2: # @func2
# BB#0: # %entry
pushl %eax
cvtss2sd 8(%esp), %xmm1
cvtss2sd 12(%esp), %xmm0
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne .LBB1_1
jp .LBB1_1
.LBB1_2: # %bb2
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%esp)
flds (%esp)
popl %eax
retl
.LBB1_1: # %bb1
addsd .LCPI1_0, %xmm0
jmp .LBB1_2
.Lfunc_end1:
.size func2, .Lfunc_end1-func2
```
http://reviews.llvm.org/D11393
More information about the llvm-commits
mailing list