[llvm-commits] Initial patch for FMA4 support

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Wed Nov 23 12:39:53 PST 2011


Hi Jan,

On Tue, Nov 22, 2011 at 8:47 PM, Jan Sjodin <jan_sjodin at yahoo.com> wrote:
> This patch contains support for encoding FMA4 instructions and tablegen
> patterns for scalar FMA4 operations and an intrinsic and tests for vfmaddsd.

Cool! Some comments:

There's no specific reason in this case to have the "Int" forms:

+multiclass fma4s_Int<bits<8> opc, string OpcodeStr, Intrinsic Int,
+	    PatFrag ld_frag> {
...
+defm Int_VFMADDSD4  : fma4s_Int<0x6B, "vfmaddsd",
int_x86_fma4_vfmadd_sd, alignedloadv2f64>;

Instead, just write patterns to match the intrinsics with the
previously defined FMA4 instructions.

       if (HasVEX_4V)
         ++FirstMemOp;// Skip the register source (which is encoded in
VEX_VVVV).
+      if (HasXOP_W)
+        ++FirstMemOp;// Skip the register source (which is encoded in I8IMM).

Use " if (HasVEX_4V || HasXOP_W)" and update the comment properly.

+#include "llvm/Support/Debug.h"

Are you sure you need this?

+    } else {
+      CurOp += AddrOperands + 1;
+      if (HasVEX_4VOp3)
+	++CurOp;
+    }

"++CurOp" lacks proper indentation!

Otherwise looks great!

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc



More information about the llvm-commits mailing list