Page MenuHomePhabricator

[PowerPC] Add the support for __builtin_setrnd() in clang
ClosedPublic

Authored by ZhangKang on Mar 14 2019, 7:30 PM.

Details

Summary

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).

Diff Detail

Repository
rL LLVM

Event Timeline

ZhangKang created this revision.Mar 14 2019, 7:30 PM
jsji requested changes to this revision.Mar 14 2019, 7:59 PM

Apparently missing some files.

This revision now requires changes to proceed.Mar 14 2019, 7:59 PM
jsji added a comment.Mar 14 2019, 8:15 PM

Apparently missing some files.

OK, added dependent revision https://reviews.llvm.org/D59405.

ZhangKang updated this revision to Diff 190780.Mar 14 2019, 8:39 PM

Have checked the missing files.

ZhangKang updated this revision to Diff 190782.Mar 14 2019, 8:46 PM

Update the patch.

ZhangKang removed a reviewer: jsji.Mar 14 2019, 8:48 PM
ZhangKang added a reviewer: jsji.
jsji accepted this revision.Mar 28 2019, 12:18 PM

LGTM.

This revision is now accepted and ready to land.Mar 28 2019, 12:18 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2019, 2:10 AM