This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79487] Invalid _Decimal32 comparison on s390x


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

--- Comment #2 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
Ah, no, the first Rtl pass that produces an incorrect expression is Cse1.

Before:

--
(insn 22 21 23 3 (set (reg:SD 75)
        (const_double:SD -9223372036854775808 [N/A])) "decimal32.c":23 1121
{movsd}
(insn 23 22 24 3 (set (reg:DD 74)
        (float_extend:DD (reg:SD 75))) "decimal32.c":23 1330 {extendsddd2}
(insn 24 23 25 3 (set (reg:CCZ 33 %cc)
        (compare:CCZ (reg:DD 73)
            (reg:DD 74))) "decimal32.c":23 1081 {*cmpdd_ccs}
--

The 32 bit constant is float_extended to 64 bits and the result is used in the
comparison (remember that only a 64 bit comparison pattern is available
anyway).  Cse1 removes the extension and directly places the constant in the
comparison, changing its mode:

--
(insn 22 21 23 3 (set (reg:SD 75)
        (const_double:SD -9223372036854775808 [N/A])) "decimal32.c":23 1121
{movsd}
(insn 23 22 24 3 (set (reg:DD 74)
        (const_double:DD -9223372036854775808 [N/A])) "decimal32.c":23 1115
{*movdd_64dfp}
(insn 24 23 25 3 (set (reg:CCZ 33 %cc)
        (compare:CCZ (reg:DD 73)
            (const_double:DD -9223372036854775808 [N/A]))) "decimal32.c":23
1081 {*cmpdd_ccs}
                         ^^^^
                      64 bit mode
--

And eventually Reload puts a 64 bit constant in the pool:

--
(insn 86 21 24 3 (set (reg:DD 17 %f2 [81])
        (mem/u/c:DD (symbol_ref/u:DI ("*.LC3") [flags 0x2]) [2  S8 A64]))
"decimal32.c":23 1115 {*movdd_64dfp}
(insn 24 86 25 3 (set (reg:CCZ 33 %cc)
        (compare:CCZ (reg:DD 16 %f0 [73])
            (reg:DD 17 %f2 [81]))) "decimal32.c":23 1081 {*cmpdd_ccs}
--

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]