[PATCH] D111529: Specify Clang vector builtins.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 12 06:10:47 PDT 2021


fhahn marked 4 inline comments as done.
fhahn added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:538
+ T __builtin_elementwise_rint(T x)      return the integral value nearest to x (according to the          floating point types
+                                        prevailing rounding mode) in floating-point format
+ T __builtin_elementwise_round(T x)     return the integral value nearest to x rounding half-way cases    floating point types
----------------
scanon wrote:
> "Prevailing rounding mode" is not super-useful, other than as a spelling for round-to-nearest-ties-to-even (IEEE 754 default rounding). Outside of a `FENV_ACCESS ON` context, there's not even really a notion of "prevailing rounding mode" to appeal to. I assume the intent is for this to lower to e.g. x86 ROUND* with the dynamic rounding-mode immediate.
> 
> I would recommend adding `__builtin_elementwise_roundeven(T x)` instead, which would statically bind IEEE default rounding (following TS 18661-1 naming) without having to appeal to prevailing rounding mode, and can still lower to ROUND* on x86 outside of FENV_ACCESS ON contexts, which is the norm for vector code  (and FRINTN unconditionally on armv8). I think we can punt on rint/nearbyint for now, and add them in the future if there's a need.
I removed `rint` and `round` for now and add` _roundeven` with the wording from TS 18661-1


================
Comment at: clang/docs/LanguageExtensions.rst:552
+operation(x, y) as pairwise tree reduction to the input. The pairs are formed
+by concatenating both inputs and pairing adjacent elements.
+
----------------
craig.topper wrote:
> I'm not sure I understand what is being concatenated here.
I tried to spell it out more clearly. I'm still not sure if that spells it out as clearly as possibly and I'd appreciate any suggestions on how to improve the wording.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111529/new/

https://reviews.llvm.org/D111529



More information about the cfe-commits mailing list