On Thu, Sep 13, 2012 at 07:42:17PM +0200, Uros Bizjak wrote:
> Can we introduce additional "*fmai_fmadd_<mode>_1" pattern (and
> others) that would cover missing 231 alternative?

Here is the patch for that.  But, I don't see how it would ever match
(unless perhaps x is equal to z, but then the other insns could do the right
job too).

2012-09-13  Jakub Jelinek  <ja...@redhat.com>

        PR target/54564
        * config/i386/sse.md (*fmai_fmadd_<mode>_1, *fmai_fmsub_<mode>_1,
        *fmai_fnmadd_<mode>_1, *fmai_fnmsub_<mode>_1): New patterns.

--- gcc/config/i386/sse.md.jj   2012-09-13 19:58:42.000000000 +0200
+++ gcc/config/i386/sse.md      2012-09-13 20:07:15.181214004 +0200
@@ -2092,6 +2092,20 @@ (define_insn "*fmai_fmadd_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
+(define_insn "*fmai_fmadd_<mode>_1"
+  [(set (match_operand:VF_128 0 "register_operand" "=x")
+        (vec_merge:VF_128
+         (fma:VF_128
+           (match_operand:VF_128 1 "nonimmediate_operand" "%x")
+           (match_operand:VF_128 2 "nonimmediate_operand" "xm")
+           (match_operand:VF_128 3 "nonimmediate_operand" " 0"))
+         (match_dup 3)
+         (const_int 1)))]
+  "TARGET_FMA"
+  "vfmadd231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "type" "ssemuladd")
+   (set_attr "mode" "<MODE>")])
+
 (define_insn "*fmai_fmsub_<mode>"
   [(set (match_operand:VF_128 0 "register_operand" "=x,x")
         (vec_merge:VF_128
@@ -2109,6 +2123,21 @@ (define_insn "*fmai_fmsub_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
+(define_insn "*fmai_fmsub_<mode>_1"
+  [(set (match_operand:VF_128 0 "register_operand" "=x")
+        (vec_merge:VF_128
+         (fma:VF_128
+           (match_operand:VF_128   1 "nonimmediate_operand" "%x")
+           (match_operand:VF_128   2 "nonimmediate_operand" "xm")
+           (neg:VF_128
+             (match_operand:VF_128 3 "nonimmediate_operand" " 0")))
+         (match_dup 3)
+         (const_int 1)))]
+  "TARGET_FMA"
+  "vfmsub231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "type" "ssemuladd")
+   (set_attr "mode" "<MODE>")])
+
 (define_insn "*fmai_fnmadd_<mode>"
   [(set (match_operand:VF_128 0 "register_operand" "=x,x")
         (vec_merge:VF_128
@@ -2126,6 +2155,21 @@ (define_insn "*fmai_fnmadd_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
+(define_insn "*fmai_fnmadd_<mode>_1"
+  [(set (match_operand:VF_128 0 "register_operand" "=x")
+        (vec_merge:VF_128
+         (fma:VF_128
+           (neg:VF_128
+             (match_operand:VF_128 1 "nonimmediate_operand" "%x"))
+           (match_operand:VF_128   2 "nonimmediate_operand" "xm")
+           (match_operand:VF_128   3 "nonimmediate_operand" " 0"))
+         (match_dup 3)
+         (const_int 1)))]
+  "TARGET_FMA"
+  "vfnmadd231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "type" "ssemuladd")
+   (set_attr "mode" "<MODE>")])
+
 (define_insn "*fmai_fnmsub_<mode>"
   [(set (match_operand:VF_128 0 "register_operand" "=x,x")
         (vec_merge:VF_128
@@ -2144,6 +2188,22 @@ (define_insn "*fmai_fnmsub_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
+(define_insn "*fmai_fnmsub_<mode>_1"
+  [(set (match_operand:VF_128 0 "register_operand" "=x")
+        (vec_merge:VF_128
+         (fma:VF_128
+           (neg:VF_128
+             (match_operand:VF_128 1 "nonimmediate_operand" "%x"))
+           (match_operand:VF_128   2 "nonimmediate_operand" "xm")
+           (neg:VF_128
+             (match_operand:VF_128 3 "nonimmediate_operand" " 0")))
+         (match_dup 3)
+         (const_int 1)))]
+  "TARGET_FMA"
+  "vfnmsub231<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "type" "ssemuladd")
+   (set_attr "mode" "<MODE>")])
+
 ;; FMA4 floating point scalar intrinsics.  These write the
 ;; entire destination register, with the high-order elements zeroed.
 


        Jakub

Reply via email to