]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix miscompilation of Ada runtime on 64-bit SPARC
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Mar 2021 11:02:14 +0000 (12:02 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Mar 2021 11:32:03 +0000 (12:32 +0100)
Returning a REGMODE_NATURAL_SIZE of 4 for DFmode in 64-bit mode is
just asking for trouble because sub-word SUBREGs are always treated
differently than the others, in particular by the register allocator.

gcc/
* config/sparc/sparc.c (sparc_regmode_natural_size): Return 4 for
float and vector integer modes only if the mode is not larger.

gcc/config/sparc/sparc.c

index f35579361142280fe2adaa286376fde46400ce79..f15041720223285a7e2183d1f5bdbaf2ee9bc82e 100644 (file)
@@ -13585,23 +13585,18 @@ sparc_expand_vcond (machine_mode mode, rtx *operands, int ccode, int fcode)
   emit_insn (gen_rtx_SET (operands[0], bshuf));
 }
 
-/* On sparc, any mode which naturally allocates into the float
+/* On the SPARC, any mode which naturally allocates into the single float
    registers should return 4 here.  */
 
 unsigned int
 sparc_regmode_natural_size (machine_mode mode)
 {
-  int size = UNITS_PER_WORD;
+  const enum mode_class cl = GET_MODE_CLASS (mode);
 
-  if (TARGET_ARCH64)
-    {
-      enum mode_class mclass = GET_MODE_CLASS (mode);
-
-      if (mclass == MODE_FLOAT || mclass == MODE_VECTOR_INT)
-       size = 4;
-    }
+  if ((cl == MODE_FLOAT || cl == MODE_VECTOR_INT) && GET_MODE_SIZE (mode) <= 4)
+    return 4;
 
-  return size;
+  return UNITS_PER_WORD;
 }
 
 /* Implement TARGET_HARD_REGNO_NREGS.