<div dir="auto"><div class="gmail_quote" dir="auto"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" lang="EN-GB" link="#0563C1" vlink="#954F72"><div class="m_-7019580378187877429WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt">Hi,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">There are some generic DAGCombine functions which replace an SDNode with a newly created but otherwise equivalent SDNode. Specifically, visit for SINT_TO_FP, UINT_TO_FP, FP_TO_SINT, FP_TO_UINT where the operand is
a constant. This unconditionally prevents target specific dag combines from executing for these nodes.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The `// fold (fp_to_sint c1fp) -> c1` creates a new node which is functionally a copy of the input. I’d like to delete this clause to allow a target specific combine to run.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">SDValue DAGCombiner::visitFP_TO_SINT(<wbr>SDNode *N) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> SDValue N0 = N->getOperand(0);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> EVT VT = N->getValueType(0);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> // fold (fp_to_sint c1fp) -> c1<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> if (<wbr>isConstantFPBuildVectorOrConst<wbr>antFP(N0))<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> return DAG.getNode(ISD::FP_TO_SINT, SDLoc(N), VT, N0);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> return FoldIntToFPToInt(N, DAG);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">However fp128-folding.ll and arm64-fp128-folding.ll codegen tests fail if I do so. Allowing the target specific dag combines to run changes codegen for constants. Unfortunately, I don’t know arm64. Could someone
tell me whether replacing:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .text<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .file "<stdin>"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .section .rodata.cst16,"aM",@progbits,<wbr>16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .p2align 4 // -- Begin function test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.LCPI0_0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .xword 0 // fp128 42<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .xword 4612899879264452608<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .text<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .globl test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .p2align 2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .type test_folding,@function<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">test_folding: <wbr> // @test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_startproc<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">// BB#0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> sub sp, sp, #16 // =16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.Lcfi0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_def_cfa_offset 16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> adrp x8, .LCPI0_0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> ldr q0, [x8, :lo12:.LCPI0_0]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> mov w8, #42<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> str w8, [sp, #12]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> add sp, sp, #16 // =16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> ret<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.Lfunc_end0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .size test_folding, .Lfunc_end0-test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_endproc<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <wbr> // -- End function<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .section ".note.GNU-stack","",@progbits<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">with:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .text<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .file "<stdin>"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .globl test_folding // -- Begin function test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .p2align 2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .type test_folding,@function<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">test_folding: <wbr> // @test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_startproc<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">// BB#0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> str x30, [sp, #-16]! // 8-byte Folded Spill<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.Lcfi0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_def_cfa_offset 16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.Lcfi1:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_offset w30, -16<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> mov w8, #42<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> mov w0, #42<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> str w8, [sp, #12]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> bl __floatsitf<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> ldr x30, [sp], #16 // 8-byte Folded Reload<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> ret<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">.Lfunc_end0:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .size test_folding, .Lfunc_end0-test_folding<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .cfi_endproc<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> <wbr> // -- End function<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> .section ".note.GNU-stack","",@progbits<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Is good, bad, irrelevant? I’m assuming ‘bad’ since __floatsitf looks like a function call. If it is indeed bad, can I tempt anyone from arm to look at this? Failing that, would a patch against your back end
be welcome?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks!<font color="#888888"><u></u><u></u></font></span></p><font color="#888888">
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Jon<u></u><u></u></span></p>
</font></div>
</div>
</blockquote></div><br></div>