https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114907

            Bug ID: 114907
           Summary: Missing __extendhfbf2 in libgcc
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com
  Target Milestone: ---
            Target: x86-64

>From https://sourceware.org/bugzilla/show_bug.cgi?id=31685

$ cat x.cc
#include <stdlib.h>
#include <cstdint>
#include <array>
#include <iostream>

#define SIZE 8

typedef _Float16 T;
//typedef volatile float T;

void fp16tobf16(_Float16 * f) {
        __bf16 * b = reinterpret_cast<__bf16*>(f);
        for(int i=0; i<SIZE; i++){
            T temp = f[i];
            b[i] = (__bf16) temp;
        }
}

int main(){

    std::array<_Float16, SIZE> a{};
    std::fill(a.begin(), a.end(), (_Float16) 1.7653432432424324);
    fp16tobf16(a.data());

    __bf16 * b = reinterpret_cast<__bf16*>(a.data());

    std::cout << "\n";
    for(int i=0; i<SIZE; i++)
        std::cout << ((double) b[i]) << "\n";

    return 0;
}
$ g++ -O0 -std=c++23 x.cc
/usr/local/bin/ld: /tmp/ccWrIm0Z.o: in function `fp16tobf16(_Float16*)':
x.cc:(.text+0x4d): undefined reference to `__extendhfbf2'
collect2: error: ld returned 1 exit status
$

Reply via email to