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

            Bug ID: 118541
           Summary: Incorrect transformation to xscmpgtdp for Unordered
                    Operations
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeevitha at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc-*-linux-gnu

Gcc trunk generates xscmpgtdp for Unordered Operations. This issue was from
power9/power10 with O2

jeevitha@ltcd97-lp3:~$ cat bug.c
extern double __ieee754_acos (double);
double
__acospi (double x)
{

  double ret = __ieee754_acos (x) / 3.14;


  return __builtin_isgreater(ret, 1.0) ? 1.0 : ret;
}
jeevitha@ltcd97-lp3:~$ gcc bug.c  -O2 -mcpu=power9 -S -o bug.s
jeevitha@ltcd97-lp3:~$ cat bug.s
        .file   "bug.c"
        .machine power9
        .machine altivec
        .abiversion 2
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl __acospi
        .type   __acospi, @function
__acospi:
.LFB0:
        .cfi_startproc
.LCF0:
0:      addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        .localentry     __acospi,.-__acospi
        mflr 0
        std 0,16(1)
        stdu 1,-32(1)
        .cfi_def_cfa_offset 32
        .cfi_offset 65, 16
        bl __ieee754_acos
        nop
        addis 9,2,.LC2@toc@ha
        addi 1,1,32
        .cfi_def_cfa_offset 0
        lfd 0,.LC2@toc@l(9)
        addis 9,2,.LC0@toc@ha
        ld 0,16(1)
        lfd 12,.LC0@toc@l(9)
        fdiv 0,1,0
        mtlr 0
        .cfi_restore 65
        xscmpgtdp 1,0,12
        xxsel 1,0,12,1
        blr

Reply via email to