This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Implement dummy x87/MMX FPU mode switching


On Wed, Jun 15, 2005 at 07:58:02AM +0200, Uros Bizjak wrote:
> +	  for (link = CALL_INSN_FUNCTION_USAGE (insn);
> +	       link;
> +	       link = XEXP (link, 1))
> +	    {
> +	      if (GET_CODE (XEXP (link, 0)) == USE)
> +		{
> +		  reg = XEXP (XEXP (link, 0), 0);
> +
> +		  if (reg)
> +		    {
> +		      if (MMX_REG_P (reg))
> +			mmx = 1;
> +
> +		      if (FP_REG_P (reg))
> +			x87 = 1;
> +		    }
> +		}
> +	    }
> +
> +	  if (mmx && x87)
> +	    error ("Mixing x87 and MMX registers in function call "
> +		   "is not allowed.");

This error ought to be caught earilier so that proper line number
information can be emitted.

You can change function_arg to encode whether mmx registers are
needed (without scanning CALL_INSN_FUNCTION_USAGE), here:

  /* Handle a hidden AL argument containing number of registers for varargs
     x86-64 functions.  For i386 ABI just return constm1_rtx to avoid
     any AL settings.  */
  if (mode == VOIDmode)
    {
      if (TARGET_64BIT)
        return GEN_INT (cum->maybe_vaarg
                        ? (cum->sse_nregs < 0
                           ? SSE_REGPARM_MAX
                           : cum->sse_regno)
                        : -1);
      else
        return constm1_rtx;
    }

> +	  && (asm_noperands (PATTERN (insn)) >= 0
> +	      || GET_CODE (PATTERN (insn)) == ASM_INPUT))
> +      return TARGET_80387

One can have mmx inputs and outputs in an asm.  Here you'll need
to do the mmx vs fpu check.  The line number information is buried
in the asm rtl, which you can pull out for the error message.

>  }
>  
> +int
> +ix86_mode_after (int entity, int mode, rtx insn)

Missing function comments.

> +	  return TARGET_80387
> +	    ? FPU_MODE_X87 : FPU_MODE_MMX;

I don't see the value in this.  I think it just makes the code 
more complex for no reason.  I think default_mode should equal
x87 mode all the time.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]