[all-commits] [llvm/llvm-project] 84e429: [PowerPC] Fix rounding mode for vec_round in altiv...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Mon Jul 12 04:11:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84e429693fe5f225fe68b9dd54043cddb9c4cd4c
      https://github.com/llvm/llvm-project/commit/84e429693fe5f225fe68b9dd54043cddb9c4cd4c
  Author: Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
  Date:   2021-07-12 (Mon, 12 Jul 2021)

  Changed paths:
    M clang/lib/Headers/altivec.h
    M clang/test/CodeGen/builtins-ppc-vsx.c

  Log Message:
  -----------
  [PowerPC] Fix rounding mode for vec_round in altivec.h

The function is supposed to be the equivalent of rint() (as in
round to nearest, ties to even) rather than round() (round to
nearest, ties away from zero). In fact, the instruction we emit
without VSX is vrfin which is correct. However, with VSX we emit
xvrspi which is the equivalent of round() and therefore incorrect.
Since there is no equivalent VSX instruction, simply use vrfin
regardless of availability of VSX.




More information about the All-commits mailing list