[PATCH] D127982: [X86][FP16] Enable vector support for FP16 emulation
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 19:33:48 PDT 2022
pengfei added a comment.
In D127982#3687605 <https://reviews.llvm.org/D127982#3687605>, @alexfh wrote:
> Hi @pengfei, this patch is causing clang to crash with a "fatal error: error in backend" when compiling some code with `-mno-avx2`. A (mostly automatically) reduced test case (thanks @joanahalili for preparing it) is below. I imagine it may already be a not perfectly valid C++, but the original code was a quite hairy template beast to be a good example. I hope, this helps fixing the issue soon.
>
> $ cat input.cc
> typedef long __m128i __attribute__((__vector_size__(16)));
> struct half {
> short x;
> };
> __m128i pset1(half from) {
> short __w7, __w6, __w5, __w4, __w3, __w2;
> return (__attribute__((__vector_size__(8 * sizeof(short)))) short){
> from.x, from.x, __w2, __w3, __w4, __w5, __w6, __w7};
> }
> __attribute__((__vector_size__(8 * sizeof(float)))) float pmul___trans_tmp_8;
> void g(int *);
> struct S {
> S() { g(&n); }
> virtual void c() {
> pmul___trans_tmp_8 = __builtin_ia32_vcvtph2ps256(pset1(m_value));
> }
> half m_value;
> int n;
> };
> void f() { S(); }
> $ ./clang-good -std=gnu++17 -O3 --target=x86_64--linux-gnu -m64 -march=haswell -maes -mprefer-vector-width=128 -mno-avx2 -c input.cc
> $ ./clang-good --version
> clang version trunk (e97b2d413849d3dbc8b49740ce5a07ed0382309c)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: ...
> $ ./clang -std=gnu++17 -O3 --target=x86_64--linux-gnu -m64 -march=haswell -maes -mprefer-vector-width=128 -c input.cc
> $ ./clang -std=gnu++17 -O3 --target=x86_64--linux-gnu -m64 -march=haswell -maes -mprefer-vector-width=128 -mno-avx2 -c input.cc
> fatal error: error in backend: Cannot select: 0x55233f9ad270: v8f16,ch = X86ISD::VBROADCAST_LOAD<(dereferenceable load (s16) from %ir.0 + 8, align 8)> 0x55233f922068, 0x55233f9ad4e0
> 0x55233f9ad4e0: i64 = add 0x55233f9ad750, Constant:i64<8>
> 0x55233f9ad750: i64,ch = CopyFromReg 0x55233f922068, Register:i64 %0
> 0x55233f9ad478: i64 = Register %0
> 0x55233f9ad680: i64 = Constant<8>
> In function: _ZN1S1cEv
> clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
> clang version trunk (f18794816270244f9942e9217b96e23a94a7f32c)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: ...
> clang: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang: note: diagnostic msg: /tmp/input-188997.cpp
> clang: note: diagnostic msg: /tmp/input-188997.sh
> clang: note: diagnostic msg:
>
> ********************
Thanks @alexfh ! The test case is good enough. I'll investigate it. Thanks again!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127982/new/
https://reviews.llvm.org/D127982
More information about the llvm-commits
mailing list