[PATCH] D56998: [X86] Custom codegen 512 integer to fp conversion intrinsics.

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 20 22:32:29 PST 2019


craig.topper created this revision.
craig.topper added a reviewer: RKSimon.
Herald added a subscriber: cfe-commits.

The 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics all have the possibility of taking an explicit rounding mode argument. If the rounding mode is CUR_DIRECTION we'd like to emit a sitofp/uitofp instruction and a select like we do for 256-bit intrinsics.

For cvt(u)qqtopd and cvt(u)dqtops we do this when the form of the software intrinsics that doesn't take a rounding mode argument is used. This is done by using convertvector in the header with the select builtin. But if the explicit rounding mode form of the intrinsic is used and CUR_DIRECTION is passed, we don't do this. We shouldn't have this inconsistency.

For cvt(u)qqtops nothing is done because we can't use the select builtin in the header without avx512vl. So we need to use custom codegen for this.

Even when the rounding mode isn't CUR_DIRECTION we should also use select in IR for consistency. And it will remove another scalar integer mask from our intrinsics.

To accomplish all of these goals I've taken a slightly unusual approach. I've added two new X86 specific intrinsics for sitofp/uitofp with rounding. These intrinsics are variadic on the input and output type so we only need 2 instead of 6. This avoids the need for a switch to map them in CGBuiltin.cpp. We just need to check signed vs unsigned. I believe other targets also use variadic intrinsics like this.

So if the rounding mode is CUR_DIRECTION we'll use an sitofp/uitofp instruction. Otherwise we'll use one of the new intrinsics. After that we'll emit a select instruction if needed.


Repository:
  rC Clang

https://reviews.llvm.org/D56998

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx512dq-builtins.c
  test/CodeGen/avx512f-builtins.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56998.182745.patch
Type: text/x-patch
Size: 10840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190121/947776cd/attachment-0001.bin>


More information about the cfe-commits mailing list