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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to