@@ -585,21 +585,46 @@
""
"ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
-(define_insn_and_split "*absneg<mode>2"
- [(set (match_operand:VEC_FLOAT_MODE 0 "register_operand" "=x,x")
- (match_operator:VEC_FLOAT_MODE 3 "absneg_operator"
- [(match_operand:VEC_FLOAT_MODE 1 "nonimmediate_operand" "0,xm")]))
- (use (match_operand:VEC_FLOAT_MODE 2 "nonimmediate_operand" "xm,0"))]
- "SSE_VEC_FLOAT_MODE_P (<MODE>mode) || AVX256_VEC_FLOAT_MODE_P (<MODE>mode)"
+(define_insn_and_split "*avx_absneg<mode>2"
+ [(set (match_operand:AVXMODEF2P 0 "register_operand" "=x,x")
+ (match_operator:AVXMODEF2P 3 "absneg_operator"
+ [(match_operand:AVXMODEF2P 1 "nonimmediate_operand" "x,m")]))
+ (use (match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm,x"))]
+ "AVX_VEC_FLOAT_MODE_P (<MODE>mode)"
"#"
"&& reload_completed"
[(const_int 0)]
{
- rtx set;
- set = gen_rtx_fmt_ee (GET_CODE (operands[3]) == NEG ? XOR : AND,
+ rtx t;
+
+ if (MEM_P (operands[1]))
+ t = gen_rtx_fmt_ee (GET_CODE (operands[3]) == NEG ? XOR : AND,
+ <MODE>mode, operands[2], operands[1]);
+ else
+ t = gen_rtx_fmt_ee (GET_CODE (operands[3]) == NEG ? XOR : AND,
<MODE>mode, operands[1], operands[2]);
- set = gen_rtx_SET (VOIDmode, operands[0], set);
- emit_insn (set);
+ t = gen_rtx_SET (VOIDmode, operands[0], t);
+ emit_insn (t);
+ DONE;
+})
+
+(define_insn_and_split "*sse_absneg<mode>2"
+ [(set (match_operand:SSEMODEF2P 0 "register_operand" "=x,x")
+ (match_operator:SSEMODEF2P 3 "absneg_operator"
+ [(match_operand:SSEMODEF2P 1 "nonimmediate_operand" "0,xm")]))
+ (use (match_operand:SSEMODEF2P 2 "nonimmediate_operand" "xm,0"))]
+ "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx t;
+
+ t = operands[rtx_equal_p (operands[0], operands[1]) ? 2 : 1];
+ t = gen_rtx_fmt_ee (GET_CODE (operands[3]) == NEG ? XOR : AND,
+ <MODE>mode, operands[0], t);
+ t = gen_rtx_SET (VOIDmode, operands[0], t);
+ emit_insn (t);
DONE;
})