diff options
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 2a1b5ec..28482e3 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5358,7 +5358,7 @@ (set (match_dup 4) (neg:SFDF (abs:SFDF (match_dup 1)))) (set (match_operand:SFDF 0 "gpc_reg_operand") - (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand") + (if_then_else:SFDF (ge (match_operand:SFDF 2 "any_operand") (match_dup 5)) (match_dup 3) (match_dup 4)))] @@ -5369,6 +5369,24 @@ || TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))" { + /* Middle-end canonicalizes -fabs (x) to copysign (x, -1), + but PowerPC prefers -fabs (x). */ + if (CONST_DOUBLE_AS_FLOAT_P (operands[2])) + { + if (real_isneg (CONST_DOUBLE_REAL_VALUE (operands[2]))) + { + operands[3] = gen_reg_rtx (<MODE>mode); + emit_insn (gen_abs<mode>2 (operands[3], operands[1])); + emit_insn (gen_neg<mode>2 (operands[0], operands[3])); + } + else + emit_insn (gen_abs<mode>2 (operands[0], operands[1])); + DONE; + } + + if (!gpc_reg_operand (operands[2], <MODE>mode)) + operands[2] = copy_to_mode_reg (<MODE>mode, operands[2]); + if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode)) { emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1], |