[llvm-bugs] [Bug 48665] New: [ConstantFold] llvm generate invalid assemble for type conversion between __fp16 and char

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 06:09:12 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48665

            Bug ID: 48665
           Summary: [ConstantFold] llvm generate invalid assemble for type
                    conversion between __fp16 and char
           Product: libraries
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: zhongyunde at tom.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

Created attachment 24352
  --> https://bugs.llvm.org/attachment.cgi?id=24352&action=edit
clang test_x86.cpp -S -O2 -o test.s

base on the case test_x86.cpp attached and llvm10, compile on the x86 machine
with commands similar as: clang test_x86.cpp -S -O2 -o test.s

#define half __fp16

void host_expect(char * arrDst)
{
    half arrSrc[8] = {(half)0xecee, (half)0xf330, (half)0x698a, (half)0x2583,
(half)0xb45d, (half)0xfc66, (half)0x3587, (half)0x2607};

    for(int i = 0; i < 8; i++)
    {
        arrDst[i] = arrSrc[i];
    }
}


we'll get an empty define of the function host_expect, which is unexpected.

        .globl  _Z11host_expectPc       # -- Begin function _Z11host_expectPc
        .p2align        4, 0x90
        .type   _Z11host_expectPc, at function
_Z11host_expectPc:                      # @_Z11host_expectPc
        .cfi_startproc
# %bb.0:                                # %entry
        retq
.Lfunc_end0:
        .size   _Z11host_expectPc, .Lfunc_end0-_Z11host_expectPc
        .cfi_endproc
                                        # -- End function
        .ident  "clang version 10.0.0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210105/301fbda4/attachment.html>


More information about the llvm-bugs mailing list