[PATCH] D102238: [TableGen] [Clang] Clean up arm_mve.td file

Paul C. Anagnostopoulos via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 11 07:25:23 PDT 2021


Paul-C-Anagnostopoulos created this revision.
Paul-C-Anagnostopoulos added reviewers: lattner, jansvoboda11, craig.topper, dblaikie.
Herald added subscribers: dmgreen, kristof.beyls.
Paul-C-Anagnostopoulos requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch does a little cleanup on the arm_mve.td TableGen file.

Could someone give me suggestions on how to test this? It builds fine, but I'm not sure how to test it. Of course, I will make sure that the resulting .inc files don't change. Anything else?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102238

Files:
  clang/include/clang/Basic/arm_mve.td


Index: clang/include/clang/Basic/arm_mve.td
===================================================================
--- clang/include/clang/Basic/arm_mve.td
+++ clang/include/clang/Basic/arm_mve.td
@@ -575,7 +575,8 @@
 }
 
 foreach half = [ "b", "t" ] in {
-  defvar halfconst = !if(!eq(half, "b"), 0, 1);
+  defvar halfconst = !ne(half, "b");
+////  defvar halfconst = !if(!eq(half, "b"), 0, 1);
 
   let params = [f32], pnt = PNT_None in {
     def vcvt#half#q_f16: Intrinsic<
@@ -1153,8 +1154,9 @@
 
 multiclass DyadicImmShift<Type outtype, Immediate imm, string intname = NAME,
                           dag extraargs = (?)> {
-  defvar intparams = !if(!eq(!cast<string>(outtype), !cast<string>(Vector)),
-                         [Vector], [outtype, Vector]);
+  defvar intparams = !if(!eq(outtype, Vector), [Vector], [outtype, Vector]);
+////  defvar intparams = !if(!eq(!cast<string>(outtype), !cast<string>(Vector)),
+////                         [Vector], [outtype, Vector]);
 
   def q_n: Intrinsic<
       outtype, (args outtype:$a, Vector:$b, imm:$sh),
@@ -1532,9 +1534,10 @@
   //
   // So this foldl expression implements what you'd write in Python as
   // [srctype for srctype in T.All if srctype != desttype]
-  let params = !foldl([]<Type>, T.All, tlist, srctype, !listconcat(tlist,
-      !if(!eq(!cast<string>(desttype),!cast<string>(srctype)),[],[srctype])))
-  in {
+  let params = !filter(srctype, T.All, !ne(srctype, desttype)) in {
+////  let params = !foldl([]<Type>, T.All, tlist, srctype, !listconcat(tlist,
+////      !if(!eq(!cast<string>(desttype),!cast<string>(srctype)),[],[srctype])))
+////  in {
     def "vreinterpretq_" # desttype: Intrinsic<
         VecOf<desttype>, (args Vector:$x), (vreinterpret $x, VecOf<desttype>)>;
   }
@@ -1576,8 +1579,11 @@
   defvar is_dest_float = !eq(desttype.kind, "f");
   defvar is_dest_unsigned = !eq(desttype.kind, "u");
   // First immediate operand of the LLVM intrinsic
-  defvar unsigned_flag = !if(is_dest_float, (unsignedflag Scalar),
-                             !if(is_dest_unsigned, V.True, V.False));
+  defvar unsigned_flag = !cond(is_dest_float : (unsignedflag Scalar),
+                               is_dest_unsigned : V.True,
+                               true : V.False);
+////  defvar unsigned_flag = !if(is_dest_float, (unsignedflag Scalar),
+////                             !if(is_dest_unsigned, V.True, V.False));
   // For float->int conversions _n and _x_n intrinsics are not polymorphic
   // because the signedness of the destination type cannot be inferred.
   defvar pnt_nx = !if(is_dest_float, PNT_2Type, PNT_None);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102238.344391.patch
Type: text/x-patch
Size: 2617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210511/2dfe0484/attachment-0001.bin>


More information about the cfe-commits mailing list