[libc-commits] [PATCH] D95999: [libc] Add aarch64 flavors of floor, round, sqrt and trunc.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Feb 4 21:45:19 PST 2021


sivachandra added inline comments.


================
Comment at: libc/src/math/aarch64/floor.cpp:16
+  double y;
+  __asm__ __volatile__("ldr d0, %1\n"
+                       "frintm d0, d0\n"
----------------
sdesmalen wrote:
> Hi @sivachandra sorry for the drive-by comment on your patch, I just happened notice the use of ldr/str here. Is there a specific reason for that? I think this can simply use the register values instead, e.g:
> ```  double result;
>   __asm__ __volatile__("frintm %d0, %d1\n"
>                        : "=w"(result) : "w"(x) : );
>   return result;
> ```
> That way, it will just create a `frintm d0, d0` instruction directly.
Thanks a lot for you comment. I wasn't aware that one could use `%d` and `%s` modifiers. I have applied your suggestion everywhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95999



More information about the libc-commits mailing list