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

            Bug ID: 119467
           Summary: Missed optimization on wrapping builtin function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mserdarsanli at gmail dot com
  Target Milestone: ---

Compiling below wrapper function

```
double powi(double a, int x)
{
    return __builtin_powi(a, x);
}
```

generates assembly below:

```
powi(double, int):
        sub     rsp, 8
        call    __powidf2
        add     rsp, 8
        ret
```

while if I replace calleee with any other function, it generates better code
with single jmp instruction:

```
extern double another_func(double a, int x);

double powi(double a, int x)
{
    return another_func(a, x);
}
```

generates:


```
powi(double, int):
        jmp     another_func(double, int)
```
  • [Bug c++/119467] New: Missed op... mserdarsanli at gmail dot com via Gcc-bugs

Reply via email to