[PATCH] D151870: [ARM] Increase cost of unaligned double and float loads

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 12:51:29 PDT 2023


efriedma added a comment.

clang generates unaligned load/store for something like the following:

  float f(char* x) { float a; __builtin_memcpy(&a, x, sizeof(a)); return a; }
  float ff(char* x, float f) { __builtin_memcpy(x, &f, sizeof(f)); }
  double d(char* x) { double a; __builtin_memcpy(&a, x, sizeof(a)); return a; }
  double dd(char* x, double f) { __builtin_memcpy(x, &f, sizeof(f)); }

Looking at the generated code for this, not sure how you get a cost of "6" for double; I only count 4 instructions (https://godbolt.org/z/6rodoPMqj)


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

https://reviews.llvm.org/D151870



More information about the llvm-commits mailing list