Joerg Sonnenberger
2011-Feb-26 21:36 UTC
[LLVMdev] TableGen syntax for matching a constant load
On Sat, Feb 26, 2011 at 01:07:39PM -0800, Jakob Stoklund Olesen wrote:> > On Feb 25, 2011, at 7:27 PM, Joerg Sonnenberger wrote: > > > I'm trying to add a X86 pattern to turn > > movl $-1, %eax > > into > > orl $-1, $eax > > Please make sure to measure the performance impact of doing this. You > are creating a false dependency on the last instruction to write %eax, > and the CPU won't be able to execute the following instructions in > parallel.I am primarily interested in size here, not speed.> You may want to consider using xorl+decl instead. It is also three > bytes, and there are no false dependencies. The xor idiom is recognized > by processors as old as Pentium 4 as having no dependencies.Any examples of how to create more than one instructions for a given pattern? There are some other cases I could use this for. Joerg
Jakob Stoklund Olesen
2011-Feb-26 22:04 UTC
[LLVMdev] TableGen syntax for matching a constant load
On Feb 26, 2011, at 1:36 PM, Joerg Sonnenberger wrote:> On Sat, Feb 26, 2011 at 01:07:39PM -0800, Jakob Stoklund Olesen wrote: >> >> You may want to consider using xorl+decl instead. It is also three >> bytes, and there are no false dependencies. The xor idiom is recognized >> by processors as old as Pentium 4 as having no dependencies. > > Any examples of how to create more than one instructions for a given > pattern? There are some other cases I could use this for.def : Pat<(i32 -1), (DEC32r (MOV32r0))>; /jakob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110226/2301e286/attachment.html>
Joerg Sonnenberger
2011-Feb-27 00:29 UTC
[LLVMdev] TableGen syntax for matching a constant load
On Sat, Feb 26, 2011 at 02:04:54PM -0800, Jakob Stoklund Olesen wrote:> > On Feb 26, 2011, at 1:36 PM, Joerg Sonnenberger wrote: > > > On Sat, Feb 26, 2011 at 01:07:39PM -0800, Jakob Stoklund Olesen wrote: > >> > >> You may want to consider using xorl+decl instead. It is also three > >> bytes, and there are no false dependencies. The xor idiom is recognized > >> by processors as old as Pentium 4 as having no dependencies. > > > > Any examples of how to create more than one instructions for a given > > pattern? There are some other cases I could use this for. > > def : Pat<(i32 -1), (DEC32r (MOV32r0))>;Hm. Right. This gives the me first set of size peep hole optmisations as attached. I didn't add the above rule for 64bit builds, since it is larger than the to-be-figured out OR32rmi8 / OR64rmi8. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: X86InstrCompiler.td.diff Type: text/x-diff Size: 876 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110227/94a8caea/attachment.diff>