]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/34959 (23_containers/bitset/ext/15361.cc fails for MIPS n64)
authorRichard Sandiford <rsandifo@nildram.co.uk>
Sat, 26 Jan 2008 11:34:41 +0000 (11:34 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 26 Jan 2008 11:34:41 +0000 (11:34 +0000)
gcc/
PR rtl-optimization/34959
* optabs.c (expand_unop): In libcall notes, give ffs, clz, ctz,
popcount and parity rtxes the same mode as their operand.
Truncate or extend the result to the return value's mode
if necessary.

From-SVN: r131863

gcc/ChangeLog
gcc/optabs.c

index f6b8fe561d48a5c1ea4a429be3ce192eb01bb56e..b36bdcf817aba2a68db15ba8149dd25ad571cb5e 100644 (file)
@@ -1,3 +1,11 @@
+2008-01-26  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR rtl-optimization/34959
+       * optabs.c (expand_unop): In libcall notes, give ffs, clz, ctz,
+       popcount and parity rtxes the same mode as their operand.
+       Truncate or extend the result to the return value's mode
+       if necessary.
+
 2008-01-26  Richard Sandiford  <rsandifo@nildram.co.uk>
 
        PR target/34981
index 089fcccc993ed9569a4a742654acbeeaaf0fe751..448b799cb091a8866a59c875a6a7961534a25bbc 100644 (file)
@@ -3273,6 +3273,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
     {
       rtx insns;
       rtx value;
+      rtx eq_value;
       enum machine_mode outmode = mode;
 
       /* All of these functions return small values.  Thus we choose to
@@ -3292,8 +3293,12 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
       end_sequence ();
 
       target = gen_reg_rtx (outmode);
-      emit_libcall_block (insns, target, value,
-                         gen_rtx_fmt_e (unoptab->code, outmode, op0));
+      eq_value = gen_rtx_fmt_e (unoptab->code, mode, op0);
+      if (GET_MODE_SIZE (outmode) < GET_MODE_SIZE (mode))
+       eq_value = simplify_gen_unary (TRUNCATE, outmode, eq_value, mode);
+      else if (GET_MODE_SIZE (outmode) > GET_MODE_SIZE (mode))
+       eq_value = simplify_gen_unary (ZERO_EXTEND, outmode, eq_value, mode);
+      emit_libcall_block (insns, target, value, eq_value);
 
       return target;
     }