Jakub Jelinek cb1758d95c i386: Improve ix86_expand_int_movcc
When working on PR105338, I've noticed that in some cases we emit
unnecessarily long sequence which has then higher seq_cost than necessary.

E.g. when ix86_expand_int_movcc is called with
operands[0] (reg/v:SI 83 [ i ])
operands[1] (eq (reg/v:SI 83 [ i ]) (const_int 0 [0]))
operands[2] (reg/v:SI 83 [ i ])
operands[3] (const_int -2 [0xfffffffffffffffe])
i.e. r83 = r83 == 0 ? r83 : -2 which with my PR105338 patch is equivalent to
r83 = r83 == 0 ? 0 : -2, we emit:
(insn 24 0 25 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 83 [ i ])
            (const_int 1 [0x1]))) 11 {*cmpsi_1}
     (nil))
(insn 25 24 26 (parallel [
            (set (reg:SI 85)
                (if_then_else:SI (ltu:SI (reg:CC 17 flags)
                        (const_int 0 [0]))
                    (const_int -1 [0xffffffffffffffff])
                    (const_int 0 [0])))
            (clobber (reg:CC 17 flags))
        ]) 1192 {*x86_movsicc_0_m1}
     (nil))
(insn 26 25 27 (set (reg:SI 85)
        (not:SI (reg:SI 85))) 683 {*one_cmplsi2_1}
     (nil))
(insn 27 26 28 (parallel [
            (set (reg:SI 85)
                (and:SI (reg:SI 85)
                    (const_int -2 [0xfffffffffffffffe])))
            (clobber (reg:CC 17 flags))
        ]) 533 {*andsi_1}
     (nil))
(insn 28 27 0 (set (reg/v:SI 83 [ i ])
        (reg:SI 85)) 81 {*movsi_internal}
     (nil))
which has seq_cost (seq, true) 24.  But it could have just cost 20
if we didn't decide to use a fresh temporary r85 and used r83 instead
- we could avoid the copy at the end.
The reason for it is in the 2 reg_overlap_mentioned_p calls,
the destination (out) indeed overlaps op0 - it is the same register,
but I don't see why that is a problem, this is in a code path where
we've already called
ix86_expand_carry_flag_compare (code, op0, op1, &compare_op)
earlier, so the fact that we've out overlaps op0 or op1 shouldn't matter
because insn 24 above is already emitted, we should just care if
it overlaps whatever we got from that ix86_expand_carry_flag_compare
call, i.e. compare_op, otherwise we can overwrite out just fine;
we also know at that point that the last 2 operands of ?: are constants.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/i386-expand.cc (ix86_expand_int_movcc): Create a
	temporary only if out overlaps compare_op, not when it overlaps
	op0 or op1.
2022-04-28 17:41:49 +02:00
2022-03-19 00:16:22 +00:00
2022-03-30 00:16:49 +00:00
2022-02-28 00:16:17 +00:00
2022-04-28 17:41:49 +02:00
2021-10-23 00:16:26 +00:00
2022-02-14 00:16:23 +00:00
2022-04-07 00:16:45 +00:00
2021-11-30 00:16:44 +00:00
2022-01-03 10:42:10 +01:00
2022-03-25 00:17:18 +00:00
2022-04-06 00:16:22 +00:00
2022-01-03 10:42:10 +01:00
2022-03-19 00:16:22 +00:00
2022-03-05 00:16:31 +00:00
2022-01-03 10:42:10 +01:00
2021-11-16 00:16:31 +00:00
2022-04-09 00:16:56 +00:00
2022-01-27 00:16:29 +00:00
2022-03-20 00:16:30 +00:00
2022-02-04 00:16:24 +00:00
2022-01-03 10:42:10 +01:00
2021-10-20 00:16:43 +00:00
2022-01-12 00:16:39 +00:00
2022-03-15 00:16:49 +00:00
2022-01-03 10:42:10 +01:00
2022-01-03 10:42:10 +01:00
2022-03-23 00:16:45 +00:00
2021-12-17 00:16:20 +00:00
2021-06-24 16:51:40 +05:30
2022-04-20 00:16:26 +00:00
2021-12-21 09:10:57 +01:00
2022-03-29 17:43:32 +08:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 3.1 GiB
Languages
C 48%
Ada 18.3%
C++ 14.1%
Go 7%
GCC Machine Description 4.6%
Other 7.7%