diff mbox

[GIMPLE,FE] add fma_expr

Message ID CAAgBjMkiiBK=z-+jA1F96fDV0A9oh6H_yYmQ7aHG43DO49Vyig@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni Feb. 16, 2017, 12:47 p.m. UTC
Hi Richard,
The attached patch handles fma_expr in gimple-fe.
Does it look OK ?

Thanks,
Prathamesh

Comments

Richard Biener Feb. 16, 2017, 1:40 p.m. UTC | #1
On Thu, 16 Feb 2017, Prathamesh Kulkarni wrote:

> Hi Richard,

> The attached patch handles fma_expr in gimple-fe.

> Does it look OK ?


+             tree arg0_type = TREE_TYPE (args[0]);
+             if (!SCALAR_FLOAT_TYPE_P (arg0_type))
+               {
+                 error_at (loc, "operands to __FMA should have"
+                                " floating point type");
+                 expr.value = error_mark_node;
+                 return expr;
+               }
+
+             for (int pass = 1; pass < 3; ++pass)
+               {
+                 tree type = TREE_TYPE (args[pass]);
+                 if (arg0_type != type
+                     || element_precision (arg0_type) != 
element_precision
(type))
+                   {
+                     error_at (loc, "operands to __FMA should have same
type");
+                     expr.value = error_mark_node;
+                     return expr;
+                   }
+               }

please omit this, other types are ok and type verification is
done by the GIMPLE verifier in tree-cfg.c.

Ok with that change.

Thanks,
Richard.
Kyrill Tkachov Feb. 20, 2017, 2:44 p.m. UTC | #2
Hi Prathamesh,

On 16/02/17 12:47, Prathamesh Kulkarni wrote:
> Hi Richard,

> The attached patch handles fma_expr in gimple-fe.

> Does it look OK ?

>

> Thanks,

> Prathamesh


I see the new test ICEing on aarch64-none-elf.

Thanks,
Kyrill

------------------------------------------

$DIR/build-aarch64/obj/gcc2/gcc/xgcc -B$DIR/build-aarch64/obj/gcc2/gcc/ $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos
tics-show-caret -fdiagnostics-color=never -O -fgimple -fdump-tree-ssa-gimple -S -specs=aem-ve.specs -o gimplefe-26.s
$DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':
$DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler error: in expand_expr_real_2, at expr.c:8705
$DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion of macro 'foo'
0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
         $DIR/gcc/gcc/expr.c:8705
0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
         $DIR/gcc/gcc/expr.c:9730
0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
         $DIR/gcc/gcc/expr.c:8072
0x73ab2f expand_expr
         $DIR/gcc/gcc/expr.h:276
0x73ab2f expand_return
         $DIR/gcc/gcc/cfgexpand.c:3526
0x73ab2f expand_gimple_stmt_1
         $DIR/gcc/gcc/cfgexpand.c:3610
0x73ab2f expand_gimple_stmt
         $DIR/gcc/gcc/cfgexpand.c:3737
0x73d55b expand_gimple_basic_block
         $DIR/gcc/gcc/cfgexpand.c:5744
0x740b14 execute
         $DIR/gcc/gcc/cfgexpand.c:6357
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Richard Biener Feb. 21, 2017, 8:43 a.m. UTC | #3
On Mon, 20 Feb 2017, Kyrill Tkachov wrote:

> Hi Prathamesh,

> 

> On 16/02/17 12:47, Prathamesh Kulkarni wrote:

> > Hi Richard,

> > The attached patch handles fma_expr in gimple-fe.

> > Does it look OK ?

> > 

> > Thanks,

> > Prathamesh

> 

> I see the new test ICEing on aarch64-none-elf.


FMA_EXPR relies on either target support or library support so the 
testcase should be appropriately limited to targets supporting that.
{ target c99_runtime } maybe.

Richard.

> Thanks,

> Kyrill

> 

> ------------------------------------------

> 

> $DIR/build-aarch64/obj/gcc2/gcc/xgcc -B$DIR/build-aarch64/obj/gcc2/gcc/

> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos

> tics-show-caret -fdiagnostics-color=never -O -fgimple -fdump-tree-ssa-gimple

> -S -specs=aem-ve.specs -o gimplefe-26.s

> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':

> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler error: in

> expand_expr_real_2, at expr.c:8705

> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion of macro

> 'foo'

> 0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,

> expand_modifier)

>         $DIR/gcc/gcc/expr.c:8705

> 0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

> expand_modifier, rtx_def**, bool)

>         $DIR/gcc/gcc/expr.c:9730

> 0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,

> rtx_def**, bool)

>         $DIR/gcc/gcc/expr.c:8072

> 0x73ab2f expand_expr

>         $DIR/gcc/gcc/expr.h:276

> 0x73ab2f expand_return

>         $DIR/gcc/gcc/cfgexpand.c:3526

> 0x73ab2f expand_gimple_stmt_1

>         $DIR/gcc/gcc/cfgexpand.c:3610

> 0x73ab2f expand_gimple_stmt

>         $DIR/gcc/gcc/cfgexpand.c:3737

> 0x73d55b expand_gimple_basic_block

>         $DIR/gcc/gcc/cfgexpand.c:5744

> 0x740b14 execute

>         $DIR/gcc/gcc/cfgexpand.c:6357

> Please submit a full bug report,

> with preprocessed source if appropriate.

> Please include the complete backtrace with any bug report.

> See <https://gcc.gnu.org/bugs/> for instructions.

> 

> 


-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
Kyrill Tkachov Feb. 21, 2017, 8:53 a.m. UTC | #4
On 21/02/17 08:43, Richard Biener wrote:
> On Mon, 20 Feb 2017, Kyrill Tkachov wrote:

>

>> Hi Prathamesh,

>>

>> On 16/02/17 12:47, Prathamesh Kulkarni wrote:

>>> Hi Richard,

>>> The attached patch handles fma_expr in gimple-fe.

>>> Does it look OK ?

>>>

>>> Thanks,

>>> Prathamesh

>> I see the new test ICEing on aarch64-none-elf.

> FMA_EXPR relies on either target support or library support so the

> testcase should be appropriately limited to targets supporting that.

> { target c99_runtime } maybe.


That does skip it on aarch64-none-elf, but is ICEing the expected behaviour in this case?
Shouldn't the frontend give an error message of some kind?
Or is the gimple frontend considered an internal feature and any errors in input are expected
to cause an ICE?

Thanks,
Kyrill

> Richard.

>

>> Thanks,

>> Kyrill

>>

>> ------------------------------------------

>>

>> $DIR/build-aarch64/obj/gcc2/gcc/xgcc -B$DIR/build-aarch64/obj/gcc2/gcc/

>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos

>> tics-show-caret -fdiagnostics-color=never -O -fgimple -fdump-tree-ssa-gimple

>> -S -specs=aem-ve.specs -o gimplefe-26.s

>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':

>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler error: in

>> expand_expr_real_2, at expr.c:8705

>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion of macro

>> 'foo'

>> 0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,

>> expand_modifier)

>>          $DIR/gcc/gcc/expr.c:8705

>> 0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

>> expand_modifier, rtx_def**, bool)

>>          $DIR/gcc/gcc/expr.c:9730

>> 0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,

>> rtx_def**, bool)

>>          $DIR/gcc/gcc/expr.c:8072

>> 0x73ab2f expand_expr

>>          $DIR/gcc/gcc/expr.h:276

>> 0x73ab2f expand_return

>>          $DIR/gcc/gcc/cfgexpand.c:3526

>> 0x73ab2f expand_gimple_stmt_1

>>          $DIR/gcc/gcc/cfgexpand.c:3610

>> 0x73ab2f expand_gimple_stmt

>>          $DIR/gcc/gcc/cfgexpand.c:3737

>> 0x73d55b expand_gimple_basic_block

>>          $DIR/gcc/gcc/cfgexpand.c:5744

>> 0x740b14 execute

>>          $DIR/gcc/gcc/cfgexpand.c:6357

>> Please submit a full bug report,

>> with preprocessed source if appropriate.

>> Please include the complete backtrace with any bug report.

>> See <https://gcc.gnu.org/bugs/> for instructions.

>>

>>
Richard Biener Feb. 21, 2017, 8:56 a.m. UTC | #5
On Tue, 21 Feb 2017, Kyrill Tkachov wrote:

> 

> On 21/02/17 08:43, Richard Biener wrote:

> > On Mon, 20 Feb 2017, Kyrill Tkachov wrote:

> > 

> > > Hi Prathamesh,

> > > 

> > > On 16/02/17 12:47, Prathamesh Kulkarni wrote:

> > > > Hi Richard,

> > > > The attached patch handles fma_expr in gimple-fe.

> > > > Does it look OK ?

> > > > 

> > > > Thanks,

> > > > Prathamesh

> > > I see the new test ICEing on aarch64-none-elf.

> > FMA_EXPR relies on either target support or library support so the

> > testcase should be appropriately limited to targets supporting that.

> > { target c99_runtime } maybe.

> 

> That does skip it on aarch64-none-elf, but is ICEing the expected behaviour in

> this case?

> Shouldn't the frontend give an error message of some kind?


Well, IMHO it's not the purpose of the FE to reject all invalid IL.  We
have verifiers for this.

> Or is the gimple frontend considered an internal feature and any errors in

> input are expected

> to cause an ICE?


Yes, mostly.  The FE itself shouldn't ICE.

Richard.

> Thanks,

> Kyrill

> 

> > Richard.

> > 

> > > Thanks,

> > > Kyrill

> > > 

> > > ------------------------------------------

> > > 

> > > $DIR/build-aarch64/obj/gcc2/gcc/xgcc -B$DIR/build-aarch64/obj/gcc2/gcc/

> > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos

> > > tics-show-caret -fdiagnostics-color=never -O -fgimple

> > > -fdump-tree-ssa-gimple

> > > -S -specs=aem-ve.specs -o gimplefe-26.s

> > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':

> > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler error:

> > > in

> > > expand_expr_real_2, at expr.c:8705

> > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion of

> > > macro

> > > 'foo'

> > > 0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,

> > > expand_modifier)

> > >          $DIR/gcc/gcc/expr.c:8705

> > > 0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

> > > expand_modifier, rtx_def**, bool)

> > >          $DIR/gcc/gcc/expr.c:9730

> > > 0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode,

> > > expand_modifier,

> > > rtx_def**, bool)

> > >          $DIR/gcc/gcc/expr.c:8072

> > > 0x73ab2f expand_expr

> > >          $DIR/gcc/gcc/expr.h:276

> > > 0x73ab2f expand_return

> > >          $DIR/gcc/gcc/cfgexpand.c:3526

> > > 0x73ab2f expand_gimple_stmt_1

> > >          $DIR/gcc/gcc/cfgexpand.c:3610

> > > 0x73ab2f expand_gimple_stmt

> > >          $DIR/gcc/gcc/cfgexpand.c:3737

> > > 0x73d55b expand_gimple_basic_block

> > >          $DIR/gcc/gcc/cfgexpand.c:5744

> > > 0x740b14 execute

> > >          $DIR/gcc/gcc/cfgexpand.c:6357

> > > Please submit a full bug report,

> > > with preprocessed source if appropriate.

> > > Please include the complete backtrace with any bug report.

> > > See <https://gcc.gnu.org/bugs/> for instructions.

> > > 

> > > 

> 

> 


-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
Kyrill Tkachov Feb. 21, 2017, 9:57 a.m. UTC | #6
On 21/02/17 08:56, Richard Biener wrote:
> On Tue, 21 Feb 2017, Kyrill Tkachov wrote:

>

>> On 21/02/17 08:43, Richard Biener wrote:

>>> On Mon, 20 Feb 2017, Kyrill Tkachov wrote:

>>>

>>>> Hi Prathamesh,

>>>>

>>>> On 16/02/17 12:47, Prathamesh Kulkarni wrote:

>>>>> Hi Richard,

>>>>> The attached patch handles fma_expr in gimple-fe.

>>>>> Does it look OK ?

>>>>>

>>>>> Thanks,

>>>>> Prathamesh

>>>> I see the new test ICEing on aarch64-none-elf.

>>> FMA_EXPR relies on either target support or library support so the

>>> testcase should be appropriately limited to targets supporting that.

>>> { target c99_runtime } maybe.

>> That does skip it on aarch64-none-elf, but is ICEing the expected behaviour in

>> this case?

>> Shouldn't the frontend give an error message of some kind?

> Well, IMHO it's not the purpose of the FE to reject all invalid IL.  We

> have verifiers for this.


Ok, here's the patch to add the target selector.
Newlib doesn't implement fmal for long double I guess (it's the long double fma that fails here).
Is this ok?

Thanks,
Kyrill

2016-02-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.dg/gimplefe-26.c: Require c99_runtime.


>> Or is the gimple frontend considered an internal feature and any errors in

>> input are expected

>> to cause an ICE?

> Yes, mostly.  The FE itself shouldn't ICE.

>

> Richard.

>

>> Thanks,

>> Kyrill

>>

>>> Richard.

>>>

>>>> Thanks,

>>>> Kyrill

>>>>

>>>> ------------------------------------------

>>>>

>>>> $DIR/build-aarch64/obj/gcc2/gcc/xgcc -B$DIR/build-aarch64/obj/gcc2/gcc/

>>>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos

>>>> tics-show-caret -fdiagnostics-color=never -O -fgimple

>>>> -fdump-tree-ssa-gimple

>>>> -S -specs=aem-ve.specs -o gimplefe-26.s

>>>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':

>>>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler error:

>>>> in

>>>> expand_expr_real_2, at expr.c:8705

>>>> $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion of

>>>> macro

>>>> 'foo'

>>>> 0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,

>>>> expand_modifier)

>>>>           $DIR/gcc/gcc/expr.c:8705

>>>> 0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

>>>> expand_modifier, rtx_def**, bool)

>>>>           $DIR/gcc/gcc/expr.c:9730

>>>> 0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode,

>>>> expand_modifier,

>>>> rtx_def**, bool)

>>>>           $DIR/gcc/gcc/expr.c:8072

>>>> 0x73ab2f expand_expr

>>>>           $DIR/gcc/gcc/expr.h:276

>>>> 0x73ab2f expand_return

>>>>           $DIR/gcc/gcc/cfgexpand.c:3526

>>>> 0x73ab2f expand_gimple_stmt_1

>>>>           $DIR/gcc/gcc/cfgexpand.c:3610

>>>> 0x73ab2f expand_gimple_stmt

>>>>           $DIR/gcc/gcc/cfgexpand.c:3737

>>>> 0x73d55b expand_gimple_basic_block

>>>>           $DIR/gcc/gcc/cfgexpand.c:5744

>>>> 0x740b14 execute

>>>>           $DIR/gcc/gcc/cfgexpand.c:6357

>>>> Please submit a full bug report,

>>>> with preprocessed source if appropriate.

>>>> Please include the complete backtrace with any bug report.

>>>> See <https://gcc.gnu.org/bugs/> for instructions.

>>>>

>>>>

>>diff --git a/gcc/testsuite/gcc.dg/gimplefe-26.c b/gcc/testsuite/gcc.dg/gimplefe-26.c

index 55a4624..bc2f3b1 100644
--- a/gcc/testsuite/gcc.dg/gimplefe-26.c
+++ b/gcc/testsuite/gcc.dg/gimplefe-26.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target c99_runtime } } */
 /* { dg-options "-O -fgimple -fdump-tree-ssa-gimple" } */
 
 #define foo(type, num) \

Richard Biener Feb. 21, 2017, 10:04 a.m. UTC | #7
On Tue, 21 Feb 2017, Kyrill Tkachov wrote:

> 

> On 21/02/17 08:56, Richard Biener wrote:

> > On Tue, 21 Feb 2017, Kyrill Tkachov wrote:

> > 

> > > On 21/02/17 08:43, Richard Biener wrote:

> > > > On Mon, 20 Feb 2017, Kyrill Tkachov wrote:

> > > > 

> > > > > Hi Prathamesh,

> > > > > 

> > > > > On 16/02/17 12:47, Prathamesh Kulkarni wrote:

> > > > > > Hi Richard,

> > > > > > The attached patch handles fma_expr in gimple-fe.

> > > > > > Does it look OK ?

> > > > > > 

> > > > > > Thanks,

> > > > > > Prathamesh

> > > > > I see the new test ICEing on aarch64-none-elf.

> > > > FMA_EXPR relies on either target support or library support so the

> > > > testcase should be appropriately limited to targets supporting that.

> > > > { target c99_runtime } maybe.

> > > That does skip it on aarch64-none-elf, but is ICEing the expected

> > > behaviour in

> > > this case?

> > > Shouldn't the frontend give an error message of some kind?

> > Well, IMHO it's not the purpose of the FE to reject all invalid IL.  We

> > have verifiers for this.

> 

> Ok, here's the patch to add the target selector.

> Newlib doesn't implement fmal for long double I guess (it's the long double

> fma that fails here).

> Is this ok?


Yes.

Thanks,
Richard.

> Thanks,

> Kyrill

> 

> 2016-02-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

> 

>     * gcc.dg/gimplefe-26.c: Require c99_runtime.

> 

> 

> > > Or is the gimple frontend considered an internal feature and any errors in

> > > input are expected

> > > to cause an ICE?

> > Yes, mostly.  The FE itself shouldn't ICE.

> > 

> > Richard.

> > 

> > > Thanks,

> > > Kyrill

> > > 

> > > > Richard.

> > > > 

> > > > > Thanks,

> > > > > Kyrill

> > > > > 

> > > > > ------------------------------------------

> > > > > 

> > > > > $DIR/build-aarch64/obj/gcc2/gcc/xgcc

> > > > > -B$DIR/build-aarch64/obj/gcc2/gcc/

> > > > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c -fno-diagnos

> > > > > tics-show-caret -fdiagnostics-color=never -O -fgimple

> > > > > -fdump-tree-ssa-gimple

> > > > > -S -specs=aem-ve.specs -o gimplefe-26.s

> > > > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c: In function 'foo_3':

> > > > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:5:18: internal compiler

> > > > > error:

> > > > > in

> > > > > expand_expr_real_2, at expr.c:8705

> > > > > $DIR/gcc/gcc/testsuite/gcc.dg/gimplefe-26.c:14:1: note: in expansion

> > > > > of

> > > > > macro

> > > > > 'foo'

> > > > > 0x84e7a3 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,

> > > > > expand_modifier)

> > > > >           $DIR/gcc/gcc/expr.c:8705

> > > > > 0x838bd6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,

> > > > > expand_modifier, rtx_def**, bool)

> > > > >           $DIR/gcc/gcc/expr.c:9730

> > > > > 0x83f0f5 expand_expr_real(tree_node*, rtx_def*, machine_mode,

> > > > > expand_modifier,

> > > > > rtx_def**, bool)

> > > > >           $DIR/gcc/gcc/expr.c:8072

> > > > > 0x73ab2f expand_expr

> > > > >           $DIR/gcc/gcc/expr.h:276

> > > > > 0x73ab2f expand_return

> > > > >           $DIR/gcc/gcc/cfgexpand.c:3526

> > > > > 0x73ab2f expand_gimple_stmt_1

> > > > >           $DIR/gcc/gcc/cfgexpand.c:3610

> > > > > 0x73ab2f expand_gimple_stmt

> > > > >           $DIR/gcc/gcc/cfgexpand.c:3737

> > > > > 0x73d55b expand_gimple_basic_block

> > > > >           $DIR/gcc/gcc/cfgexpand.c:5744

> > > > > 0x740b14 execute

> > > > >           $DIR/gcc/gcc/cfgexpand.c:6357

> > > > > Please submit a full bug report,

> > > > > with preprocessed source if appropriate.

> > > > > Please include the complete backtrace with any bug report.

> > > > > See <https://gcc.gnu.org/bugs/> for instructions.

> > > > > 

> > > > > 

> > > 

> 

> 


-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
diff mbox

Patch

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index d959877..fbd4c8c 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -856,6 +856,50 @@  c_parser_gimple_postfix_expression (c_parser *parser)
 	      expr.value = fold_convert (type, val);
 	      return expr;
 	    }
+	  else if (strcmp (IDENTIFIER_POINTER (id), "__FMA") == 0)
+	    {
+	      c_parser_consume_token (parser);
+	      auto_vec<tree> args;
+
+	      if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+		{
+		  c_parser_gimple_expr_list (parser, &args);
+		  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
+					     "expected %<)%>");
+		}
+	      if (args.length () != 3)
+		{
+		  error_at (loc, "invalid number of operands to __FMA");
+		  expr.value = error_mark_node;
+		  return expr;
+		}
+
+	      tree arg0_type = TREE_TYPE (args[0]);
+	      if (!SCALAR_FLOAT_TYPE_P (arg0_type))
+		{
+		  error_at (loc, "operands to __FMA should have"
+				 " floating point type");
+		  expr.value = error_mark_node;
+		  return expr;
+		}
+
+	      for (int pass = 1; pass < 3; ++pass)
+		{
+		  tree type = TREE_TYPE (args[pass]);
+		  if (arg0_type != type
+		      || element_precision (arg0_type) != element_precision (type))
+		    {
+		      error_at (loc, "operands to __FMA should have same type");
+		      expr.value = error_mark_node;
+		      return expr;
+		    }
+		}
+
+	      expr.value = build3_loc (loc, FMA_EXPR, TREE_TYPE (args[0]),
+				       args[0], args[1], args[2]);
+	      return expr;
+	    }
+
 	  /* SSA name.  */
 	  unsigned version, ver_offset;
 	  if (! lookup_name (id)
diff --git a/gcc/testsuite/gcc.dg/gimplefe-26.c b/gcc/testsuite/gcc.dg/gimplefe-26.c
new file mode 100644
index 0000000..fa5877e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-26.c
@@ -0,0 +1,16 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -fgimple -fdump-tree-ssa-gimple-raw" } */
+
+#define foo(type, num) \
+type __GIMPLE () foo_##num (type a, type b, type c) \
+{ \
+  type t0; \
+  t0_1 = __FMA (a, b, c); \
+  return t0_1; \
+}
+
+foo(float, 1)
+foo(double, 2)
+foo(long double, 3)
+
+/* { dg-final { scan-tree-dump-times "fma_expr" 3 "ssa" } } */