[PATCH] D45616: [X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR

Gabor Buella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 13 04:12:28 PDT 2018


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

The fcmp opcode has no defined behavior with NaN operands
in the comparisions handled in this patch. Thus, these
intrinsics can only be safe lowered to fcmp opcodes
when fast-math is enabled.

This also partially reverses the commit
259aee973f1df2cba62cc3d32847dced739e9202 :
"[X86] Use native IR for immediate values 0-7 of packed fp cmp builtins."

That commit lowered 4 SSE cmp builtins to fcmp opcodes, but with
this patch, that lowering is also dependent on the -ffast-math flag.

Affected AVX512 builtins (were not lowered to fcmp before):

__builtin_ia32_cmpps128_mask
__builtin_ia32_cmpps256_mask
__builtin_ia32_cmpps512_mask
__builtin_ia32_cmppd128_mask
__builtin_ia32_cmppd256_mask
__builtin_ia32_cmppd512_mask

Affected SSE builtins (were unconditionally lowered before):

__builtin_ia32_cmpps
__builtin_ia32_cmpps256
__builtin_ia32_cmppd
__builtin_ia32_cmppd256

At the same time, recognize predicates that result in
constants with all of the above intrinsics, that was only
handled in the case of the __builtin_ia32_cmpp[s|d]256 intrinsics.


Repository:
  rC Clang

https://reviews.llvm.org/D45616

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx-builtins.c
  test/CodeGen/avx2-builtins-fast-math.c
  test/CodeGen/avx2-builtins.c
  test/CodeGen/avx512f-builtins-fast-math.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins-fast-math.c
  test/CodeGen/avx512vl-builtins.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45616.142375.patch
Type: text/x-patch
Size: 27352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180413/3c221226/attachment-0001.bin>


More information about the cfe-commits mailing list