https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120886

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2025-06-30
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

I see this in gimple-match-exports.cc in:
```
bool
commutative_ternary_op_p (code_helper code, tree type)
{
  if (code.is_tree_code ())
    return commutative_ternary_tree_code (tree_code (code));
  auto cfn = combined_fn (code);
  return commutative_ternary_fn_p (associated_internal_fn (cfn, type));
}
```

I wonder if we just do:
```
internal_fn fn = IFN_LAST;
if (gimple_call_internal_p (call))
  fn = gimple_call_internal_fn (call);
else if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)
  fn = associated_internal_fn (as_combined_fn (DECL_FUNCTION_CODE
(gimple_call_fndecl (call)), type);
```

where type here is the lhs type.

Reply via email to