Richard Henderson <r...@redhat.com> writes:
> @@ -10808,6 +10808,13 @@ mips_cannot_change_mode_class (enum machine_mode 
> from ATTRIBUTE_UNUSED,
>         format.
>  
>       We therefore disallow all mode changes involving FPRs.  */
> +
> +  /* Except for Loongson and its integral vectors.  We need to be able
> +     to change between those modes easily.  */
> +  if (GET_MODE_SIZE (from) == 8 && GET_MODE_SIZE (to) == 8
> +      && INTEGRAL_MODE_P (from) && INTEGRAL_MODE_P (to))
> +    return false;
> +
>    return reg_classes_intersect_p (FP_REGS, rclass);
>  }

I'm lumbering you with a private hobby horse, but would you mind using
the attached instead?  I just want to avoid the "Here's a long explanation
of why we must do X.  Oh, but don't do X in this one case." style of comment.

Richard


Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c      2011-12-22 18:29:39.000000000 +0000
+++ gcc/config/mips/mips.c      2011-12-22 18:31:24.000000000 +0000
@@ -10782,12 +10782,18 @@ mips_class_max_nregs (enum reg_class rcl
 /* Implement CANNOT_CHANGE_MODE_CLASS.  */
 
 bool
-mips_cannot_change_mode_class (enum machine_mode from ATTRIBUTE_UNUSED,
-                              enum machine_mode to ATTRIBUTE_UNUSED,
+mips_cannot_change_mode_class (enum machine_mode from,
+                              enum machine_mode to,
                               enum reg_class rclass)
 {
-  /* There are several problems with changing the modes of values in
-     floating-point registers:
+  /* Allow conversions between different Loongson integer vectors,
+     and between those vectors and DImode.  */
+  if (GET_MODE_SIZE (from) == 8 && GET_MODE_SIZE (to) == 8
+      && INTEGRAL_MODE_P (from) && INTEGRAL_MODE_P (to))
+    return false;
+
+  /* Otherwise, there are several problems with changing the modes of
+     values in floating-point registers:
 
      - When a multi-word value is stored in paired floating-point
        registers, the first register always holds the low word.  We

Reply via email to