llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.11k stars 11.1k forks source link

undefined reference to `__truncsfbf2' when compiling ir with clang #97896

Open DigOrDog opened 2 weeks ago

DigOrDog commented 2 weeks ago

Description

When I was compiling this IR with clang, I encountered this error. It seems to be right from a syntactic perspective, which is quite strange. From half-precision-floating-point document, _bf16 is supported on X86 (when SSE2 is available)(For X86, SSE2 is available on 64-bit and all recent 32-bit processors.)

define i64 @f(bfloat %CastFPTrunc, ptr %x) {
BB:
  store bfloat %CastFPTrunc, ptr %x, align 2
  ret i64 0
}

define i32 @main() {
entry:

  ret i32 0
}

https://godbolt.org/z/MbcMvcWe6

tschuett commented 2 weeks ago

You stated no CPU version or a request for SSE2 in godbolt.

DigOrDog commented 2 weeks ago

You stated no CPU version or a request for SSE2 in godbolt.

In the configuration below, I have specified the CPU and enabled SSE, but why am I still getting an error? I would appreciate it if you could help me.

--target=x86_64-unknown-linux-gnu -mcpu=x86-64  -march=native -msse -msse2 -mfpmath=sse 

https://godbolt.org/z/ajEsKExd3