[PATCH] D59405: [PowerPC] Add the support for __builtin_setrnd()

Zhang Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 20:01:37 PDT 2019


ZhangKang created this revision.
ZhangKang added reviewers: nemanjai, jsji, echristo, steven.zhang, hfinkel, hiraditya.
Herald added a project: LLVM.

PowerPC64/PowerPC64le supports the builtin function __builtin_setrnd to set the floating point rounding mode. This function will use the least significant two bits of integer argument to set the floating point rounding mode.

double __builtin_setrnd(int mode);

The effective values for mode are:

0 - round to nearest
1 - round to zero
2 - round to +infinity
3 - round to -infinity

Note that the mode argument will modulo 4, so if the int argument is greater than 3, it will only use the least significant two bits of the mode. Namely, builtin_setrnd(102)) is equal to builtin_setrnd(2).


https://reviews.llvm.org/D59405

Files:
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59405.190774.patch
Type: text/x-patch
Size: 7138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190315/4b72763e/attachment.bin>


More information about the llvm-commits mailing list