[PATCH] D69618: NeonEmitter: clean up prototype modifiers

Tim Northover via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 08:43:26 PDT 2019


t.p.northover created this revision.
t.p.northover added reviewers: jmolloy, efriedma.
Herald added subscribers: arphaman, kristof.beyls, mcrosier.

What does the modifier 'j' do on a vector type in arm_neon.td? I don't know; I don't think I ever knew; and I wouldn't be surprised if no-one knows.

So when implementing new intrinsics everyone just has to keep the magic table of modifiers open in a side-panel. Additionally, we're rapidly running out of letters that we can add when intrinsics with new and strange prototypes come along (I'm looking at you, dot product!). So unless we adopt the mathematicians' trick of starting on Greek and Hebrew alphabets once the Latin letters run out (is TableGen UTF-8 safe?), a solution is needed.

So, the main point of this patch is to allow multiple modifiers per type, and strip the list of modifiers down to something much more orthogonal, and hopefully intuitive. Some things I had to make a choice on to write the patch, and might warrant debate:

- Using '1' for scalar is inconsistent with '2, '3', '4', but '0' seems weird to me.
- Parens to group is a different system from the typespec it's next to (where modifiers precede a canonical base type).
- Switching default from 'd' to '.' might be egregious, but I prefer it and we're rewriting the whole file anyway.

I've included a script which I used to automatically port our .td files, and should be equally useful for any downstream users with changes to these files (I suggest running it on the last downstream version before this change hit).


https://reviews.llvm.org/D69618

Files:
  clang/include/clang/Basic/arm_fp16.td
  clang/include/clang/Basic/arm_neon.td
  clang/include/clang/Basic/arm_neon_incl.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-neon-2velem.c
  clang/test/CodeGen/aarch64-neon-intrinsics.c
  clang/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  clang/test/CodeGen/arm_neon_intrinsics.c
  clang/utils/TableGen/NeonEmitter.cpp
  clang/utils/convert_arm_neon.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69618.227106.patch
Type: text/x-patch
Size: 214081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191030/2667cda7/attachment-0001.bin>


More information about the cfe-commits mailing list