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

[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.

197r.ira
---------
(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 ])
            (nil))))
198.reload
-----------
(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}
     (nil))

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]; 
FI;

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

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

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

Regards,
Venkat


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