llvm/llvm-project

[X86] Add support for X86ISD float2int constant folding

Open

#37,146 建立於 2018年6月14日

在 GitHub 查看
 (7 留言) (0 反應) (1 負責人)C++ (10,782 fork)batch import
backend:X86bugzillagood first issue

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

Bugzilla Link 37798
Version trunk
OS Windows NT
Depends On llvm/llvm-project#37099
CC @adibiagio,@topperc,@filcab,@gregbedwell,@LebedevRI,@rotateright

Extended Description

Split off from [Bug #​37751].

Now that we've standardised to using X86ISD opcodes for float2int conversions:

  // Vector float/double to signed/unsigned integer.
  CVTP2SI, CVTP2UI, CVTP2SI_RND, CVTP2UI_RND,
  // Scalar float/double to signed/unsigned integer.
  CVTS2SI_RND, CVTS2UI_RND,

  // Vector float/double to signed/unsigned integer with truncation.
  CVTTP2SI, CVTTP2UI, CVTTP2SI_RND, CVTTP2UI_RND,
  // Scalar float/double to signed/unsigned integer with truncation.
  CVTTS2SI_RND, CVTTS2UI_RND,

We should investigate adding safe constant folding support to these. We could at least support exact conversions (these should be rounding mode independent for non-truncation instructions?).

For truncation instructions we can probably accept inexact conversions as well, as long as no underflow/overflow occurs - this would need to be tested to confirm.

貢獻者指南