[PATCH] D88396: [X86] Replace movaps with movups when avx is enabled.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 02:00:23 PDT 2020


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

In D88396#2297554 <https://reviews.llvm.org/D88396#2297554>, @LuoYuanke wrote:

> In D88396#2297525 <https://reviews.llvm.org/D88396#2297525>, @lebedev.ri wrote:
>
>> What issue is this fixing?
>>
>>> However if the address is not aligned, movaps raise exception while movups can still run.
>>
>> That sounds like either a miscompile happened along the way, or the original source code had UB to begin with.
>
> It can avoid segment fault when unaligned pointer is casted.
>
>   #include <immintrin.h>
>   
>   extern __m128 value;
>   
>   void add(void* pointer) {
>       value = _mm_add_ps(value,*(__m128*)pointer);
>   }

That is undefined behaviour:
https://godbolt.org/z/xdWKje


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88396



More information about the llvm-commits mailing list