This is the mail archive of the gcc-patches@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]

[PATCH, alpha]: Fix recent gfortran.dg/pr32533.f90 test failure


Hello!

The compilation emitted following sequence for cmove with unsigned
compare, resulting in gfortran.dg/pr32533.f90 runtime failure [1]:

(insn 70 69 71 (set (reg:DI 143)
        (leu:DI (reg:DI 139)
            (const_int 18 [0x12]))) -1
     (nil))

(insn 71 70 72 (set (reg:DF 144)
        (eq:DF (subreg:DF (reg:DI 143) 0)
            (const_double:DF 0.0 [0x0.0p+0]))) -1
     (nil))

(insn 72 71 73 (set (reg:DF 137 [ D.934 ])
        (if_then_else:DF (eq (reg:DF 144)
                (const_double:DF 0.0 [0x0.0p+0]))
            (reg:DF 137 [ D.934 ])
            (reg:DF 140))) -1
     (nil))

where (insn 71) trapped with denormal operand FP exception.

The problem was in alpha_emit_conditional_move, where fixup code
didn't trigger for "code" variable, changed in "if (FLOAT_MODE_P
(cmp_mode) != FLOAT_MODE_P (mode))" part. Since cmove insns don't trap
on compare, the compare of (insn 71) should be put inside cmove
itself.

Attached patch updates "cmp" RTX for "code" changes, resulting in:

(insn 70 69 71 (set (reg:DI 143)
        (leu:DI (reg:DI 139)
            (const_int 18 [0x12]))) -1
     (nil))

(insn 71 70 72 (set (reg:DF 137 [ D.934 ])
        (if_then_else:DF (ne (subreg:DF (reg:DI 143) 0)
                (const_double:DF 0.0 [0x0.0p+0]))
            (reg:DF 137 [ D.934 ])
            (reg:DF 140))) -1
     (nil))

2013-08-31  Uros Bizjak  <ubizjak@gmail.com>

    * config/alpha/alpha.c (alpha_emit_conditional_move): Update
    "cmp" RTX before signed_comparison_operator check to account
    for "code" changes.

Patch was tested on alphaev68-pc-linux-gnu and committed to mainline.

[1] http://gcc.gnu.org/ml/gcc-testresults/2013-08/msg02997.html

Uros.

Attachment: a.diff.txt
Description: Text document


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