Re: c/5707: i386 compiler can't build libgcc2.c with -msoft-float

2002-03-05 Thread Richard Henderson

On Tue, Mar 05, 2002 at 06:15:19AM -0600, Joel Sherrill wrote:
> Richard/Jan could you try this out and take a stab at fixing it?  This
> is a real pain for the embedded community using i386dx/ex and 486sx 
> derived CPUs.  

See if this is all you need.


r~



Index: config/i386/i386.md
===
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.339
diff -c -p -d -u -r1.339 i386.md
--- i386.md 2002/02/21 21:16:18 1.339
+++ i386.md 2002/03/05 22:26:35
@@ -5136,7 +5136,7 @@
 (define_expand "floatsidf2"
   [(set (match_operand:DF 0 "register_operand" "")
(float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
-  ""
+  "TARGET_80387 || TARGET_SSE2"
   "")
 
 (define_insn "*floatsidf2_i387"



Re: gcc3.1 now sign-extends unsigned integer function arguments on alpha

2002-05-16 Thread Richard Henderson

On Thu, May 16, 2002 at 11:06:50PM -0400, John Baldwin wrote:
> With gcc 2.95, when a register was passed to this function, the value
> was zero-extended using the zapnot instruction.

If so, that was incorrect.

The Alpha OSF/1 ABI specifies that all 32-bit arguments and return values 
are to be sign-extended in their registers, regardless of the signedness 
of the type involved.

This is done because manipulating sign-extended values is much more
efficient on the architecture.  Not that gcc always takes advantage...

However, in this case I don't think that has anything to do with it.

Your inline assembly is wrong.  You passed a 32-bit type to the asm,
and got a correct 32-bit value.  Except that you then use it as a
64-bit value.  You can expect, in general, for gcc to give you garbage
in the high-order bits.  Why?  Because you've not given the compiler
any reason to think that it matters.  Certainly you wouldn't want the
compiler to extend the value if you were only going to store the
low N bits.

So you're going to have to change this to either 

"r" ((long)(int)cmpval)
or
"r" ((unsigned long)cmpval)

as you choose.  Naturally, the first is more efficient, since you
don't have to have the zap in the inline assembly.


r~



Re: GCC C bug: sizeof a union of structs returns zero value

2004-12-17 Thread Richard Henderson
On Thu, Dec 16, 2004 at 06:52:35PM -0800, Hugh Daniel wrote:
> char ccc[ sizeof( union{ struct aaa; struct bbb; })];

In ISO Standard C, this doesn't do what you think it does.

What you are attempting to use is an ill-conceived Microsoft
extension.  You can enable *some* amount of support for this
in gcc by using -fms-extensions.


r~