[PATCH] D132987: [PPC] Add RM as call preserved register

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 22:04:10 PST 2022


pengfei added a comment.

In D132987#3821120 <https://reviews.llvm.org/D132987#3821120>, @Carrot wrote:

> If RM is not preserved by a function call, then in the following example
>
>   void foo(double a, double b, double *p) {
>     *p++ = a + b;
>     bar();
>     *p = a + b;
>   }
>
> The expression a+b can not be CSEd, right?

The answer is yes and no. It depends on whether the user cares about the rounding mode or not. If user has strict expectation to it, they should use option like `-frounding-math`. It definitely be CSEd if user uses it in fast FP mode. For the default mode, it still should be CSEd according to C language standard.

It makes no sense to just take care of calling conversion given a lot of middle end optimization don't respect rounding mode. That's why we need to introduce strcit FP.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132987



More information about the llvm-commits mailing list