Thread overview
[Issue 1231] New: GDC std.intrinsic: inline asm for x86 & x86_64
May 14, 2007
d-bugmail
May 14, 2007
d-bugmail
Mar 21, 2011
Iain Buclaw
May 14, 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@users.sf.net
        ReportedBy: fvbommel@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/.


-- 

May 14, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1231





------- Comment #1 from fvbommel@wxs.nl  2007-05-14 13:31 -------
Created an attachment (id=147)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=147&action=view)
the patch for x86 & x86_64


-- 

March 21, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1231


Iain Buclaw <ibuclaw@ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Iain Buclaw <ibuclaw@ubuntu.com> 2011-03-21 13:05:46 PDT ---
The asm implementations you gave were put into gcc.bitmanip for D2 as a temporary stopgap (thanks!), but all functions in std.intrinsic are now compiler-generated.

So no use keeping this bug report around now.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------