Commit 5f08ae1e by Jakub Jelinek

re PR target/54564 (Broken __builtin_ia32_vfmadds[sd]3)

	PR target/54564
	* config/i386/sse.md (fmai_vmfmadd_<mode>): Use (match_dup 1)
	instead of (match_dup 0) as second argument to vec_merge.
	(*fmai_fmadd_<mode>, *fmai_fmsub_<mode>): Likewise.
	Remove third alternative.
	(*fmai_fnmadd_<mode>, *fmai_fnmsub_<mode>): Likewise.  Negate
	operand 2 instead of operand 1, but put it as first argument
	of fma.

	* config/i386/fmaintrin.h (_mm_fnmadd_sd, _mm_fnmadd_ss,
	_mm_fnmsub_sd, _mm_fnmsub_ss): Negate the second argument instead
	of the first.

From-SVN: r191298
parent aeeede33
/* Copyright (C) 2011 Free Software Foundation, Inc. /* Copyright (C) 2011, 2012 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -164,7 +164,7 @@ extern __inline __m128d ...@@ -164,7 +164,7 @@ extern __inline __m128d
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_fnmadd_sd (__m128d __A, __m128d __B, __m128d __C) _mm_fnmadd_sd (__m128d __A, __m128d __B, __m128d __C)
{ {
return (__m128d)__builtin_ia32_vfmaddsd3 (-(__v2df)__A, (__v2df)__B, return (__m128d)__builtin_ia32_vfmaddsd3 ((__v2df)__A, -(__v2df)__B,
(__v2df)__C); (__v2df)__C);
} }
...@@ -172,7 +172,7 @@ extern __inline __m128 ...@@ -172,7 +172,7 @@ extern __inline __m128
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_fnmadd_ss (__m128 __A, __m128 __B, __m128 __C) _mm_fnmadd_ss (__m128 __A, __m128 __B, __m128 __C)
{ {
return (__m128)__builtin_ia32_vfmaddss3 (-(__v4sf)__A, (__v4sf)__B, return (__m128)__builtin_ia32_vfmaddss3 ((__v4sf)__A, -(__v4sf)__B,
(__v4sf)__C); (__v4sf)__C);
} }
...@@ -212,7 +212,7 @@ extern __inline __m128d ...@@ -212,7 +212,7 @@ extern __inline __m128d
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_fnmsub_sd (__m128d __A, __m128d __B, __m128d __C) _mm_fnmsub_sd (__m128d __A, __m128d __B, __m128d __C)
{ {
return (__m128d)__builtin_ia32_vfmaddsd3 (-(__v2df)__A, (__v2df)__B, return (__m128d)__builtin_ia32_vfmaddsd3 ((__v2df)__A, -(__v2df)__B,
-(__v2df)__C); -(__v2df)__C);
} }
...@@ -220,7 +220,7 @@ extern __inline __m128 ...@@ -220,7 +220,7 @@ extern __inline __m128
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_fnmsub_ss (__m128 __A, __m128 __B, __m128 __C) _mm_fnmsub_ss (__m128 __A, __m128 __B, __m128 __C)
{ {
return (__m128)__builtin_ia32_vfmaddss3 (-(__v4sf)__A, (__v4sf)__B, return (__m128)__builtin_ia32_vfmaddss3 ((__v4sf)__A, -(__v4sf)__B,
-(__v4sf)__C); -(__v4sf)__C);
} }
......
...@@ -2072,79 +2072,75 @@ ...@@ -2072,79 +2072,75 @@
(match_operand:VF_128 1 "nonimmediate_operand") (match_operand:VF_128 1 "nonimmediate_operand")
(match_operand:VF_128 2 "nonimmediate_operand") (match_operand:VF_128 2 "nonimmediate_operand")
(match_operand:VF_128 3 "nonimmediate_operand")) (match_operand:VF_128 3 "nonimmediate_operand"))
(match_dup 0) (match_dup 1)
(const_int 1)))] (const_int 1)))]
"TARGET_FMA") "TARGET_FMA")
(define_insn "*fmai_fmadd_<mode>" (define_insn "*fmai_fmadd_<mode>"
[(set (match_operand:VF_128 0 "register_operand" "=x,x,x") [(set (match_operand:VF_128 0 "register_operand" "=x,x")
(vec_merge:VF_128 (vec_merge:VF_128
(fma:VF_128 (fma:VF_128
(match_operand:VF_128 1 "nonimmediate_operand" "%0, 0,x") (match_operand:VF_128 1 "nonimmediate_operand" " 0, 0")
(match_operand:VF_128 2 "nonimmediate_operand" "xm, x,xm") (match_operand:VF_128 2 "nonimmediate_operand" "xm, x")
(match_operand:VF_128 3 "nonimmediate_operand" " x,xm,0")) (match_operand:VF_128 3 "nonimmediate_operand" " x,xm"))
(match_dup 0) (match_dup 1)
(const_int 1)))] (const_int 1)))]
"TARGET_FMA" "TARGET_FMA"
"@ "@
vfmadd132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2} vfmadd132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2}
vfmadd213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3} vfmadd213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}"
vfmadd231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemuladd") [(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_insn "*fmai_fmsub_<mode>" (define_insn "*fmai_fmsub_<mode>"
[(set (match_operand:VF_128 0 "register_operand" "=x,x,x") [(set (match_operand:VF_128 0 "register_operand" "=x,x")
(vec_merge:VF_128 (vec_merge:VF_128
(fma:VF_128 (fma:VF_128
(match_operand:VF_128 1 "nonimmediate_operand" "%0, 0,x") (match_operand:VF_128 1 "nonimmediate_operand" " 0, 0")
(match_operand:VF_128 2 "nonimmediate_operand" "xm, x,xm") (match_operand:VF_128 2 "nonimmediate_operand" "xm, x")
(neg:VF_128 (neg:VF_128
(match_operand:VF_128 3 "nonimmediate_operand" " x,xm,0"))) (match_operand:VF_128 3 "nonimmediate_operand" " x,xm")))
(match_dup 0) (match_dup 1)
(const_int 1)))] (const_int 1)))]
"TARGET_FMA" "TARGET_FMA"
"@ "@
vfmsub132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2} vfmsub132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2}
vfmsub213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3} vfmsub213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}"
vfmsub231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemuladd") [(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_insn "*fmai_fnmadd_<mode>" (define_insn "*fmai_fnmadd_<mode>"
[(set (match_operand:VF_128 0 "register_operand" "=x,x,x") [(set (match_operand:VF_128 0 "register_operand" "=x,x")
(vec_merge:VF_128 (vec_merge:VF_128
(fma:VF_128 (fma:VF_128
(neg:VF_128 (neg:VF_128
(match_operand:VF_128 1 "nonimmediate_operand" "%0, 0,x")) (match_operand:VF_128 2 "nonimmediate_operand" "xm, x"))
(match_operand:VF_128 2 "nonimmediate_operand" "xm, x,xm") (match_operand:VF_128 1 "nonimmediate_operand" " 0, 0")
(match_operand:VF_128 3 "nonimmediate_operand" " x,xm,0")) (match_operand:VF_128 3 "nonimmediate_operand" " x,xm"))
(match_dup 0) (match_dup 1)
(const_int 1)))] (const_int 1)))]
"TARGET_FMA" "TARGET_FMA"
"@ "@
vfnmadd132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2} vfnmadd132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2}
vfnmadd213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3} vfnmadd213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}"
vfnmadd231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemuladd") [(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_insn "*fmai_fnmsub_<mode>" (define_insn "*fmai_fnmsub_<mode>"
[(set (match_operand:VF_128 0 "register_operand" "=x,x,x") [(set (match_operand:VF_128 0 "register_operand" "=x,x")
(vec_merge:VF_128 (vec_merge:VF_128
(fma:VF_128 (fma:VF_128
(neg:VF_128 (neg:VF_128
(match_operand:VF_128 1 "nonimmediate_operand" "%0, 0,x")) (match_operand:VF_128 2 "nonimmediate_operand" "xm, x"))
(match_operand:VF_128 2 "nonimmediate_operand" "xm, x,xm") (match_operand:VF_128 1 "nonimmediate_operand" " 0, 0")
(neg:VF_128 (neg:VF_128
(match_operand:VF_128 3 "nonimmediate_operand" " x,xm,0"))) (match_operand:VF_128 3 "nonimmediate_operand" " x,xm")))
(match_dup 0) (match_dup 1)
(const_int 1)))] (const_int 1)))]
"TARGET_FMA" "TARGET_FMA"
"@ "@
vfnmsub132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2} vfnmsub132<ssescalarmodesuffix>\t{%2, %3, %0|%0, %3, %2}
vfnmsub213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3} vfnmsub213<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}"
vfnmsub231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "ssemuladd") [(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment