<div dir="ltr">I believe some of the ISDs were introduced to allow for DAG optimizations under the assumption that some of the major architectures directly support these types of instructions. <div><br><div><div><div>-Ryan</div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 2, 2016 at 6:24 PM, Phil Tomson via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>We've recently moved our project from LLVM 3.6 to LLVM 3.9.  I noticed  one of our code generation tests is breaking in 3.9.<br><br></div>The test is:<br><br> ; RUN: llc < %s -march=xstg | FileCheck %s<br><br>define i64 @bclr64(i64 %a, i64 %b) nounwind readnone {<br>entry:<br>; CHECK: bclr     r1, r0, r1, 64<br>  %sub = sub i64 %b, 1<br>  %shl = shl i64 1, %sub<br>  %xor = xor i64 %shl, -1<br>  %and = and i64 %a, %xor<br>  ret i64 %and<br>}<br><br></div>I ran llc with -debug to get a better idea of what's going on and found:<br><br>Initial selection DAG: BB#0 'bclr64:entry'<br>SelectionDAG has 14 nodes:<br>  t0: ch = EntryToken<br>      t2: i64,ch = CopyFromReg t0, Register:i64 %vreg0<br>            t4: i64,ch = CopyFromReg t0, Register:i64 %vreg1<br>          t6: i64 = sub t4, Constant:i64<1><br>        t7: i64 = shl Constant:i64<1>, t6<br>      t9: i64 = xor t7, Constant:i64<-1><br>    t10: i64 = and t2, t9<br>  t12: ch,glue = CopyToReg t0, Register:i64 %R1, t10<br>  t13: ch = XSTGISD::Ret t12, Register:i64 %R1, t12:1<br><br><br><br>Combining: t13: ch = XSTGISD::Ret t12, Register:i64 %R1, t12:1<br><br>Combining: t12: ch,glue = CopyToReg t0, Register:i64 %R1, t10<br><br>Combining: t11: i64 = Register %R1<br><br>Combining: t10: i64 = and t2, t9<br><br>Combining: t9: i64 = xor t7, Constant:i64<-1><br> ... into: t15: i64 = rotl Constant:i64<-2>, t6<br><br>Combining: t10: i64 = and t2, t15<br><br>Combining: t15: i64 = rotl Constant:i64<-2>, t6<br><br>Combining: t14: i64 = Constant<-2><br><br>Combining: t6: i64 = sub t4, Constant:i64<1><br> ... into: t17: i64 = add t4, Constant:i64<-1><br><br>Combining: t15: i64 = rotl Constant:i64<-2>, t17<br><br><br><br></div><div>These rotl instructions weren't showing up when I ran llc 3.6 and that's completely changing the generated code at the end which means the test fails (and it's less optimal than it was in 3.6). <br><br>I've been looking in the LLVM language docs (3.9 version) and I don't see any documentation on 'rotl'. What does it do? Why isn't it in the docs?<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Phil<br></div></font></span></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>