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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:2e4688a7202d73baeb4de18ca4591e6b0985f4a4

commit r16-1400-g2e4688a7202d73baeb4de18ca4591e6b0985f4a4
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jun 10 20:06:14 2025 +0200

    expand: Use less costly from sign and zero extensions for values where
value range says they don't have MSB set [PR120434]

    On top of the just posted patch, the following patch attempts to
    use value range to see if MSB is known to be false and for scalar integral
    extension in that case tries to expand both sign and zero extension and
    chooses based on RTX costs the cheaper one (if the costs are the same
    uses what it used before, TYPE_UNSIGNED (TREE_TYPE (treeop0)) based.

    The patch regresses the gcc.target/i386/pr78103-3.c test, will post
    a separate patch for that momentarily (with the intent that if all 3
    patches are approved, I'll commit the PR78103 related one before this one).

    2025-06-10  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/120434
            * expr.cc (expand_expr_real_2) <CASE_CONVERT>: If get_range_pos_neg
            at -O2 for scalar integer extension suggests the most significant
            bit of op0 is not set, try both unsigned and signed conversion and
            choose the cheaper one.  If both are the same cost, choose one
            based on TYPE_UNSIGNED (TREE_TYPE (treeop0)).

            * gcc.target/i386/pr120434-2.c: New test.

Reply via email to