[PATCH] D45421: [X86] Emit native IR for pmuldq/pmuludq builtins.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 8 18:28:55 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel.
Herald added a subscriber: cfe-commits.

I believe all the pieces are now in place in the backend to make this correctly. We can truncate the vXi64 type to vXi32, extend it back up to the original width and multiply.

In the backend the truncate+extend will becomes sign_extend_inreg/zero_extend_inreg(really an and). Then those will be combined with the mul to PMULDQ/PMULUDQ. Then SimplifyDemandedBits will strip the sign_extend_inreg/zero_extend_inreg out.

The only question I have is whether its ok to emit the v2i32 intermediate type for the 128-bit version. I wasn't sure of any examples where we use an illegal type in our intrinsic/builtin handling. At least not a narrower type. I know pavg uses a wider type.

I think I could probably do this all in the header file using __builtin_convertvector if that's desired.


Repository:
  rC Clang

https://reviews.llvm.org/D45421

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx2-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/sse2-builtins.c
  test/CodeGen/sse41-builtins.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45421.141577.patch
Type: text/x-patch
Size: 12078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180409/c7ec6299/attachment.bin>


More information about the llvm-commits mailing list