On Wed, Apr 13, 2011 at 5:48 PM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Wed, Apr 13, 2011 at 5:45 PM, Feng LI <nemoking...@gmail.com> wrote: >> On Wed, Apr 13, 2011 at 5:32 PM, Ian Lance Taylor <i...@google.com> wrote: >>> Feng LI <nemoking...@gmail.com> writes: >>> >>>> I use unspec_volatile for a function with void arguments and >>>> void return value for some initialization work. But it didn't generate >>>> code in this case. I think probably I need to add more restrictions >>>> some where but I don't know why and how. The code looks like: >>>> >>>> extern __inline void __attribute__((__gnu_inline__, __always_inline__, >>>> __artificial__)) >>>> __TEnd (void) >>>> { >>>> __builtin_ia32_tend (); >>>> } >>>> >>>> (define_expand "dta_tend" >>>> [(unspec_volatile [(const_int 0)] UNSPEC_TEND)] >>>> "" >>>> "") >>>> >>>> (define_insn "*dta_tend" >>>> [(unspec_volatile [(const_int 0)] UNSPEC_TEND)] >>>> "" >>>> "tend" >>>> [(set_attr "length" "3") >>>> (set_attr "mode" "none")]) >>> >>> In the RTL dumps generated by -da, where does the insn appear and where >>> does it disappear? >> >> It seems that it disappear at the ffork.c.143r.expand at the very beginning. >> I suppose there should be some thing like >> (call_insn ....) generated for __builtin_ia32_tend (); But there isn't. >> instead, it generated: >> >> ;; Generating RTL for gimple basic block 2 >> ;; __builtin_ia32_tend (); >> (nil) > > You need to expand builtins yourself, a "named" expander doesn't do > that for you.
I'm not sure I understand this, I use define_expand to expand the builtin function to RTX, and then define_insn * to match the RTX and generate code. It seems it didn't generate the asm code. > Do you have any const or pure attributes on the tend builtin? Do you mean (set_attr "" "") in the define_insn? Feng > > Richard. > >> Feng >>> >>> Ian >>> >> >