]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
optabs: Fix can_open_code_p handling of abs and neg master trunk
authorRichard Sandiford <rdsandiford@googlemail.com>
Sat, 6 Jun 2026 12:59:12 +0000 (13:59 +0100)
committerRichard Sandiford <rdsandiford@googlemail.com>
Sat, 6 Jun 2026 12:59:12 +0000 (13:59 +0100)
As noticed by Jakub in the discussion about yesterday's bswap changes.

The change should be a no-op in practice since AND and XOR don't have
libgcc2 functions; we'd always split into word-mode operations instead.
Even so, it doesn't make conceptual sense for can_open_code_p to call
can_implement_p.

The fact that this seems to be a recurring blind spot for me suggests
that I didn't choose good names...

gcc/
* optabs-query.cc (can_open_code_p): Use can_open_code_p rather
than can_implement_p when testing for AND and XOR.

gcc/optabs-query.cc

index 8226356c7d40c3193b9e57681f56e3e8535a0184..58842e40ed6b1e3b43e71501b4ff9556e33c9309 100644 (file)
@@ -837,7 +837,7 @@ can_open_code_p (optab op, machine_mode mode)
   if ((op == neg_optab || op == abs_optab)
       && is_a<scalar_float_mode> (GET_MODE_INNER (mode), &fmode)
       && get_absneg_bit_mode (op, mode, fmode, &bitpos).exists (&new_mode)
-      && can_implement_p (op == neg_optab ? xor_optab : and_optab, new_mode))
+      && can_open_code_p (op == neg_optab ? xor_optab : and_optab, new_mode))
     return true;
 
   scalar_int_mode int_mode;