Ticket #1 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

[needs review] Core 2 to intel assembly format

Reported by: wbhart Owned by: somebody
Priority: blocker Milestone: mpir-0.8
Component: component1 Version:
Keywords: Cc:

Description

The code in /mpn/x86_64/core2 is currently in gas format. This is basically Jason Martin's core2 patches from  http://www.math.jmu.edu/~martin/ plus three files: lshift.asm, rshift.asm and mode1o.asm from the standard GMP 4.2.1 release.

The ticket is to convert Jason's patches to intel assembly format, in particular to assemble using yasm. This will happen automatically if they are given the extension .as instead of .asm. The example that can be followed is the code in the mpn/x86_64/amd64 directory. The only problem currently is that no macros are used for the global symbol prefix (a leading underscore or not, corresponding to the way functions get named at the binary level by the C compiler on the system). This is particularly important on Core 2, as on Darwin there is a global symbol prefix (leading underscore).

Attachments

add_n.yasm Download (5.3 KB) - added by wbhart 4 years ago.
addmul_1.yasm Download (9.8 KB) - added by wbhart 4 years ago.
sub_n.yasm Download (5.2 KB) - added by wbhart 4 years ago.
submul_1.yasm Download (9.8 KB) - added by wbhart 4 years ago.

Change History

Changed 4 years ago by wbhart

The issue with the global symbol prefix has been fixed.

Changed 4 years ago by wbhart

  • priority changed from major to blocker

Changed 4 years ago by wbhart

Changed 4 years ago by wbhart

Changed 4 years ago by wbhart

Changed 4 years ago by wbhart

Changed 4 years ago by wbhart

Attached are the patches as submitted by Jason Martin.

Changed 4 years ago by wbhart

  • summary changed from Core 2 to intel assembly format to [needs work] Core 2 to intel assembly format

I had a look at Jason's core2 code as submitted.

It certainly doesn't work as yet. The files add_n.as, sub_n.as, addmul_1.as and submul_1.as need reworking.

Specifically:

* Comments in yasm are ; not ;; * Why wouldn't yasm support lahf and sahf?? If it doesn't, that is a bug in yasm and should be reported to the yasm bug tracker. * section .text is missing at the start of each file (see /mpn/x86_64/ add_n.as for an example) * BITS should be lower case * The double underscore is missing off all the exported symbols (see / mpn/x86_64/add_n.as for an example) * All the G_LABEL's are missing at the start of each function entry (see /mpn/x86_64/add_n.as for an example) * Loop labels and references should have a full stop prepended (see / mpn/x86_64/add_n.as for examples) * The delimiter "end" is missing at the end of the section (see /mpn/ x86_64/add_n.as for an example)

make check won't pass until /tests/core2call.asm is converted to intel format (and renamed core2call.as)

The code needs to be tested thoroughly with make check and /tests/ devel/try

On a stylistic note, the macro ADDR should be included in yasm_mac.inc and used consistently in all the yasm code in mpir (including in /mpn/ x86_64, /mpn/x86_86/amd64, /tests and /tune) or the intel format should be used.

I'm not sure we want JWM_Test_Code to appear in the official version of our code.

I eventually decided that having %defines for register usage didn't work too well, since one frequently wants to change the register usage throughout the code. It would be better to have actual registers in the code and tables displaying the meaning of the registers at each point where it changes. I haven't done this for the amd64 code or the generic x86_64 code yet, but will when I get time, unless I get voted down.

Changed 3 years ago by wbhart

  • milestone set to mpir-0.8

Changed 3 years ago by wbhart

  • summary changed from [needs work] Core 2 to intel assembly format to [needs review] Core 2 to intel assembly format

The code is now stable, appears to work and is consistent.

Changed 3 years ago by wbhart

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.