public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, alpha]: Fix recent gfortran.dg/pr32533.f90 test failure
@ 2013-08-31 13:34 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2013-08-31 13:34 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]

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 #2: a.diff.txt --]
[-- Type: text/plain, Size: 479 bytes --]

Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 202125)
+++ config/alpha/alpha.c	(working copy)
@@ -2659,6 +2659,7 @@ alpha_emit_conditional_move (rtx cmp, enum machine
       cmp_mode = cmp_mode == DImode ? DFmode : DImode;
       op0 = gen_lowpart (cmp_mode, tem);
       op1 = CONST0_RTX (cmp_mode);
+      cmp = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
       local_fast_math = 1;
     }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-31 13:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-31 13:34 [PATCH, alpha]: Fix recent gfortran.dg/pr32533.f90 test failure Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).