[flang-commits] [PATCH] D129316: Shift intrinsics

vdonaldson via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jul 7 20:02:17 PDT 2022


vdonaldson added a comment.

> If SHIFT < 0, the intrinsics will always return 0
> If SHIFT >= BIT_SIZE(I), the intrinsics will always return 0

A call to one of these intrinsics is nonconformant if it violates these program requirements.  (Except the SHIFT == BIT_SIZE(I) boundary case is conformant.)  The language standard describes what the processor/compiler must do for conformant programs.  It does not specify the result of a nonconformant call, so the processor/compiler may generate any result.  See F18 <https://reviews.llvm.org/F18> Clause 1, paragraph 3, and paragraph 4 point 4.  Compare the discussion of constraints in Clause 4.1.2, and conformance in Clause 4.2.  Unless there is some justification for generating specific nonstandard results, it is typically best to favor faster code.

Is it necessary to return 0 for nonconformant calls, or would it be more efficient to omit the SelectOp's and just do a simple shift, where "whatever happens, happens" for nonconformant calls?  Otherwise, code for nonconformant calls penalizes conformant calls.


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

https://reviews.llvm.org/D129316



More information about the flang-commits mailing list