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

[i386] Question about Constraint Modifier character in smaxdf3 pattern.

Hi all,

Sphinx3 benchmark segmented when built and ran with -Ofast and -fprefecth-loop-arrays.

When I debugged the benchmark executable, found that it is caused due to register swapping happening 
at reload  for the smaxdf3 pattern.

(insn 457 456 458 28 (set (reg:DF 687)
        (smax:DF (reg/v:DF 367 [ dval1 ])
            (reg/v:DF 154 [ dval1 ]))) eval.c:58 914 {smaxdf3}
     (expr_list:REG_DEAD (reg/v:DF 367 [ dval1 ])
        (expr_list:REG_DEAD (reg/v:DF 154 [ dval1 ])
(insn 457 456 458 28 (set (reg:DF 21 xmm0 [687])
        (smax:DF (reg/v:DF 21 xmm0 [orig:154 dval1 ] [154])
            (reg/v:DF 51 xmm14 [orig:367 dval1 ] [367]))) eval.c:58 914 {smaxdf3}

In my case the register 367 is sNAN. 

MAXSD instruction is sensitive to sNAN and is not commutative.

DEST[63-0]  IF (DEST[63-0] == SNaN) THEN SRC[63-0];
ELSE IF SRC[63-0] == SNaN) THEN SRC[63-0];
ELSE IF (DEST[63-0] > SRC[63-0]) 
THEN DEST[63-0] 
ELSE SRC[63-0]; 

So I think the commutative % should be removed from the pattern when -Ofast (fastmath) is set.

Index: gcc/config/i386/
--- gcc/config/i386/     (revision 184372)
+++ gcc/config/i386/     (working copy)
@@ -16507,7 +16507,7 @@
 (define_insn "<code><mode>3"
   [(set (match_operand:MODEF 0 "register_operand" "=x,x")
-         (match_operand:MODEF 1 "nonimmediate_operand" "%0,x")
+         (match_operand:MODEF 1 "nonimmediate_operand" "0,x")
          (match_operand:MODEF 2 "nonimmediate_operand" "xm,xm")))]

This solved the sphinx segmentation.  But the comments on says the commutative % mark is correct.
Please provide your opinion.


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