Skip to contentSkip to conversation

should we teach gcc some new tricks?

parisc-linux Joel Soete 2 participants 2 messages Jun 23, 2005

lore
Share & tools
lore

Joel Soete

author
#0 lore raw

...

Quoted 9 lines

/* Parse the -mfixed-range=3D option string. */

static void
fix_range (const char *const_str)
{
int i, first, last;
char *str, *dash, *comma;

Quoted 7 lines

/* str must be of the form REG1'-'REG2{,REG1'-'REG} where REG1 and REG2 are either register names or register numbers. The effect of this option is to mark the registers in the range from REG1 to REG2 as ``fixed'' so they won't be used by the compiler. This is used, e.g., to ensure that kernel mode code doesn't use f32-f127. */=

That confirms well the gcc info description:
`-mfixed-range=3DREGISTER-RANGE'
Generate code treating the given register range as fixed registers.=

A fixed register is one that the register allocator can not use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma.
;-)

Quoted 1 line

You are probably best to use register names.

I would prefer too.

Quoted 5 lines

There are 28 fp registers
starting at fr4. The number for fr4 is 32. I see there is a typo in the comment regarding the range, "f32-f127". This is a cut and paste error.

Nice add on (tx),

Quoted 8 lines

The millicode routines don't use the fp regs. However, libgcc does and the kernel is linked against libgcc. Thus, for this to work, you will need to build both a kernel build version of gcc and the kernel with the -mfixed-range option. You probably want to leave about four fp registers unfixed for integer multiplcation. This is essential on hppa64 as we don't have millicode support for 64-bit integer multiplication. This support is provided by libgcc routines.

my main interest is still 32bit kernel for the moment(the most of my sys= tems
b180, c110, d380 ;-)):
2.6.8 ans 2.6.9-rc2-pa1 works fine when compiled with -mdisable-fpregs op= tion
but panicing quickly whitout?

And effectively with -mdisable-fpregs option a function like <do_setitime= r>
(amoung others) used __muldi3 as in:
[...]
1012b630: e8 4b 01 61 b,l 101016e8 <__muldi3>,rp
[...]

1012b650:       e8 4b 01 21     b,l 101016e8 <__muldi3>,rp
1012b654:       08 03 02 5a     copy r3,r26

[...]

while without it obviously compile something like:
[...]

1012ba00:       27 88 10 16     fldw 4(,ret0),fr22
1012ba04:       30 00 40 16     fcpy,sgl fr0,fr22
1012ba08:       37 b6 1c 29     ldo -11ec(ret1),r22
1012ba0c:       22 bc 8d 1a     ldil 68db8000,r21
1012ba10:       27 c1 12 16     fstw fr22,-10(,sp)
1012ba14:       36 b8 17 5a     ldo bad(r21),r24
1012ba18:       34 01 1f fe     ldi fff,r1
1012ba1c:       34 02 3f ff     ldi -1,rp
1012ba20:       22 a6 22 06     ldil 1030d000,r21
1012ba24:       0f c1 10 93     ldw -10(,sp),r19
1012ba28:       36 b5 09 a0     ldo 4d0(r21),r21
1012ba2c:       2e a0 10 17     fldd 0(,r21),fr23
1012ba30:       d2 77 1c 1f     extrw,s r19,0,1,r23
1012ba34:       3a d7 57 17     xmpyu fr22,fr23R,fr23
1012ba38:       0b 17 02 17     and r23,r24,r23
1012ba3c:       2f c1 12 17     fstd fr23,-10(,sp)

[...]

But that doesn't make me yet understand what it could make as side effect=

versus
the 64bit twin kernel??

I still have to learn more ;-)

Thanks a lot,
Joel

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#1 lore raw
Quoted 8 lines

And effectively with -mdisable-fpregs option a function like <do_setitimer> (amoung others) used __muldi3 as in:
[...]
1012b630: e8 4b 01 61 b,l 101016e8 <__muldi3>,rp
[...]

1012b650:       e8 4b 01 21     b,l 101016e8 <__muldi3>,rp
1012b654:       08 03 02 5a     copy r3,r26

[...]

The same issue that I mentioned previously applies to -mdisable-fpregs. __muldi3 and similar routines in libgcc use fp regs and the xmpyu for 64-bit multiplation. It takes two 32-bit values and produces a 64-bit result. In millicode, we can multiple to 32 bit values and produce a 32-bit result. This isn't sufficient to implement __muldi3. GCC needs a pattern to duplicate xmpyu using millicode. This could be done by "long" multiplication. Break the 32-bit values into two 16-bit chunks and use the millicode multiply.

HPUX has millicode routines to do larger multiplication but these routines weren't released.

I'm a bit surprised that 32-bit kernels needs 64-bit multiplication. Anyway, xmpyu is much more efficient for multiplication than software. Possibly, I should look at using the -mfixed-range option when building libgcc as a first step. Looking at libgcc, I think it needs fr4, fr5 and fr22-fr26. __mulvdi3 needs the most registers. The argument registers are needed for some floating point conversion routines. I doubt the kernel uses these.

Dave

Signature · 6 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux