[llvm-bugs] [Bug 45399] New: Invalid lowering of llvm.*.f128 intrinsics

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 2 02:18:54 PDT 2020


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

            Bug ID: 45399
           Summary: Invalid lowering of llvm.*.f128 intrinsics
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: clement.courbet at gmail.com
                CC: llvm-bugs at lists.llvm.org

llvm.sin.f128 is incorrectly lowered to a call to sinl, which takes a f80:
https://godbolt.org/z/M9fjLW

```
define fp128 @bad_lowering(fp128 %a) {
  %s = call fp128 @llvm.sin.f128(fp128 %a)
  ret fp128 %s
}
```

generates:

```
bad_lowering:
  jmp sinl
```

which is missing conversions from and to x86_fp80.

I expect a correct lowering to be:

```
define fp128 @manual_correct_lowering(fp128 %a) {
  %t = fptrunc fp128 %a to x86_fp80
  %s = call x86_fp80 @llvm.sin.f80(x86_fp80 %t)
  %e = fpext x86_fp80 %s to fp128
  ret fp128 %e
}
```

```
manual_correct_lowering:
  subq $24, %rsp
  callq __trunctfxf2
  fstpt (%rsp)
  callq sinl
  fstpt (%rsp)
  callq __extendxftf2
  addq $24, %rsp
  retq
```

-- 
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/20200402/f645c6a5/attachment.html>


More information about the llvm-bugs mailing list