[PATCH] D22105: [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 7 11:50:29 PDT 2016


RKSimon created this revision.
RKSimon added reviewers: eli.friedman, mkuper, craig.topper, spatel, andreadb.
RKSimon added a subscriber: cfe-commits.
RKSimon set the repository for this revision to rL LLVM.

D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead. 

It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match).

This patch changes both scalar and packed versions back to using x86-specific builtins.

It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding.

A companion llvm patch will be submitted shortly.

Repository:
  rL LLVM

http://reviews.llvm.org/D22105

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/avxintrin.h
  lib/Headers/emmintrin.h
  lib/Headers/xmmintrin.h
  test/CodeGen/avx-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/builtins-x86.c
  test/CodeGen/sse-builtins.c
  test/CodeGen/sse2-builtins.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22105.63108.patch
Type: text/x-patch
Size: 13187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160707/c30aca13/attachment.bin>


More information about the cfe-commits mailing list