[Issue 1231] New: GDC std.intrinsic: inline asm for x86 & x86_64

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 14 11:30:13 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1231

           Summary: GDC std.intrinsic: inline asm for x86 & x86_64
           Product: DGCC aka GDC
           Version: 0.23
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: fvbommel at wxs.nl


In the current version of std.intrinsic distributed with GDC the functions
don't take advantage of the assembly instructions after which they're named.
While reimplementation in D is more portable, it rather detracts from its value
on platforms where such instructions are available.

Additionally, the inp* and outp* functions simply don't do anything as
implemented (except return 0 or the value passed in, respectively).

I'm attaching a patch that fixes this for x86 and x86_64 by supplying simple
assembler functions (using extended assembler syntax for optimizability).

The functions for bs* and bt* are generated by mixins since these are
"families" of similar instructions. The template for bt* can also generate
locked versions but is not instantiated that way since std.intrinsic doesn't
currently provide locked versions, and I just wanted to fix the functions
already present.

I also changed the port parameter of inp* and outp* from uint to ushort, since
port numbers are 16 bits on x86 variants (for which these functions were
designed). If this is undesirable, this can easily be undone by s/ushort p/uint
p/ and s/[port] "Nd" p/[port] "Nd" cast(ushort)p/.


-- 



More information about the D.gnu mailing list