[llvm-bugs] [Bug 49762] New: fptoui double to i16 produces fcvtzs (signed) instead of fcvtzu (unsigned)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 29 13:13:19 PDT 2021


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

            Bug ID: 49762
           Summary: fptoui double to i16 produces fcvtzs (signed) instead
                    of fcvtzu (unsigned)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

$ cat test.c
unsigned short func1(double d) {
    return d;
};

unsigned int func2(double d) {
    return d;
};
$ clang -target aarch64-linux-gnu test.c -S -o - -O2 
func1:                                  // @func1
        .cfi_startproc
        fcvtzs  w0, d0
        ret
func2:                                  // @func2
        .cfi_startproc
        fcvtzu  w0, d0
        ret


When doing fptoui to i32, this selects a fcvtzu instruction, while it selects
fcvtzs when converting to i16. (I'm not sure if this is a bug per se, or if the
C/IR specs allows this, but if nothing else, it feels rather inconsistent.)

-- 
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/20210329/aeb77a94/attachment.html>


More information about the llvm-bugs mailing list