PATCH: (hppa) Fixes for height-reduction pattern problem.
Jason Eckhardt
jle@cygnus.com
Mon Nov 1 14:00:00 GMT 1999
There are a number of height-reduction patterns and associated splits which
can cause incorrect assembly language to be emitted. One such failure is
execute/ieee/980619-1 at -O2 -mpa-risc-2-0.
One of the pairs of patterns in question is:
(define_insn ""
[(set (match_operand:DF 0 "register_operand" "=f")
(plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
(match_operand:DF 2 "register_operand" "f"))
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
"! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
(define_split
[(set (match_operand:DF 0 "register_operand" "=f")
(plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
(match_operand:DF 2 "register_operand" "f"))
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
"! TARGET_SOFT_FLOAT && TARGET_PA_20"
[(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
(set (match_dup 0) (plus:DF (mult:DF (match_dup 1) (match_dup 2))
(match_dup 3)))]
"")
When the pattern is split before reload the semantics of the PARALLEL are
lost. ie in the PARALLEL all side effects occur after the inputs have been
read. But the define_split creates two component insns and the
side effect of the first component insn occurs before the inputs for the
second component insn have been read.
I added checks for overlapping operands to avoid creating the PARALLEL
when it would change the semantics after being split.
Mon Nov 1 14:53:38 1999 Jason Eckhardt <jle@cygnus.com>
* config/pa/pa.md (height reduction patterns): Add checks for
overlapping operands to avoid semantic-destroying splits for
height reduction patterns.
Index: pa.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/pa/pa.md,v
retrieving revision 1.56
diff -c -3 -p -r1.56 pa.md
*** pa.md 1999/10/20 05:45:09 1.56
--- pa.md 1999/11/01 21:40:09
***************
*** 3899,3905 ****
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 3899,3907 ----
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 3926,3932 ****
(match_operand:SF 3 "register_operand" "f")))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 3928,3936 ----
(match_operand:SF 3 "register_operand" "f")))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 3972,3978 ****
(match_operand:DF 2 "register_operand" "f"))))
(set (match_operand:DF 3 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 3976,3984 ----
(match_operand:DF 2 "register_operand" "f"))))
(set (match_operand:DF 3 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[3], operands[1])
! || reg_overlap_mentioned_p (operands[3], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 3994,4000 ****
(match_operand:SF 2 "register_operand" "f"))))
(set (match_operand:SF 3 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 4000,4008 ----
(match_operand:SF 2 "register_operand" "f"))))
(set (match_operand:SF 3 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[3], operands[1])
! || reg_overlap_mentioned_p (operands[3], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 4038,4044 ****
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 4046,4054 ----
(match_operand:DF 3 "register_operand" "f")))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 4063,4069 ****
(match_operand:SF 3 "register_operand" "f")))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 4073,4081 ----
(match_operand:SF 3 "register_operand" "f")))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 4088,4094 ****
(match_operand:DF 2 "register_operand" "f"))))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 4100,4108 ----
(match_operand:DF 2 "register_operand" "f"))))
(set (match_operand:DF 4 "register_operand" "=&f")
(mult:DF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 4113,4119 ****
(match_operand:SF 2 "register_operand" "f"))))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
--- 4127,4135 ----
(match_operand:SF 2 "register_operand" "f"))))
(set (match_operand:SF 4 "register_operand" "=&f")
(mult:SF (match_dup 1) (match_dup 2)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! (reg_overlap_mentioned_p (operands[4], operands[1])
! || reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "fpmuldbl")
(set_attr "length" "8")])
***************
*** 4135,4141 ****
[(set (match_operand:DF 0 "register_operand" "=f")
(neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
(set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpalu")
(set_attr "length" "8")])
--- 4151,4158 ----
[(set (match_operand:DF 0 "register_operand" "=f")
(neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
(set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
"#"
[(set_attr "type" "fpalu")
(set_attr "length" "8")])
***************
*** 4153,4159 ****
[(set (match_operand:SF 0 "register_operand" "=f")
(neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
(set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
! "! TARGET_SOFT_FLOAT && TARGET_PA_20"
"#"
[(set_attr "type" "fpalu")
(set_attr "length" "8")])
--- 4170,4177 ----
[(set (match_operand:SF 0 "register_operand" "=f")
(neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
(set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
! "(! TARGET_SOFT_FLOAT && TARGET_PA_20
! && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
"#"
[(set_attr "type" "fpalu")
(set_attr "length" "8")])
***************
*** 4241,4247 ****
(set (match_operand:SI 4 "register_operand" "=&r")
(ashift:SI (match_dup 2)
(match_operand:SI 5 "const_int_operand" "i")))]
! "INTVAL (operands[5]) == exact_log2 (INTVAL (operands[3]))"
"#"
[(set_attr "type" "binary")
(set_attr "length" "8")])
--- 4259,4266 ----
(set (match_operand:SI 4 "register_operand" "=&r")
(ashift:SI (match_dup 2)
(match_operand:SI 5 "const_int_operand" "i")))]
! "(INTVAL (operands[5]) == exact_log2 (INTVAL (operands[3]))
! && ! (reg_overlap_mentioned_p (operands[4], operands[2])))"
"#"
[(set_attr "type" "binary")
(set_attr "length" "8")])
More information about the Gcc-patches
mailing list