February 09, 2006 Inlining asm functions | ||||
---|---|---|---|---|
| ||||
I've noticed that the current behavior is to never inline functions containing asm blocks, and I was wondering if it might be practical to loosen this restriction a bit. Would it be feasible to allow such functions to be inlined so long as the asm code doesn't explicitly reference stack (and possibly register) locations? For example: real sin(real x) { asm { fld x; fsin; } } Since the above function refers to all data by name, it should be possible to inline. I grant that this may be a good bit of work for little return, but it should allow for some intrinsics to be defined completely in library code which seems potentially useful. Sean |
February 09, 2006 Re: Inlining asm functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | "Sean Kelly" <sean@f4.ca> wrote in message news:dse1mg$2h76$1@digitaldaemon.com... > I've noticed that the current behavior is to never inline functions containing asm blocks, and I was wondering if it might be practical to loosen this restriction a bit. Would it be feasible to allow such functions to be inlined so long as the asm code doesn't explicitly reference stack (and possibly register) locations? For example: > > real sin(real x) > { > asm > { > fld x; > fsin; > } > } > > Since the above function refers to all data by name, it should be possible to inline. I grant that this may be a good bit of work for little return, but it should allow for some intrinsics to be defined completely in library code which seems potentially useful. Yes, it would be useful, but there are technical problems. The worst is that writing inline assembler to be used as an expression can be very different from that is used as a function. Inlineable functions have to work, without source modification, both ways. |
Copyright © 1999-2021 by the D Language Foundation