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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-07-01
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
        testl   $2139095040, %edx
        je      .L10
        vmovss  .LC6(%rip), %xmm0      //0x0.8p-24
        vcvtps2ph       $4, %xmm0, %xmm0
        cmpl    $-1043857408, %ebx
        ja      .L1
        vmovd   %ebx, %xmm3
        vmovss  .LC7(%rip), %xmm0
        vcvtps2ph       $4, %xmm0, %xmm0
        vcomiss .LC2(%rip), %xmm3
        ja      .L1

ce3 does the move.

IF-CASE-1 found, start 6, then 7
rescanning insn with uid = 37.
changing bb of uid 39
changing bb of uid 107
  from 7 to 6
changing bb of uid 42
  from 7 to 6
deleting insn with uid = 91.
deleting block 7
Conversion succeeded on pass 1.


Confirmed.

I suspect the problem is

(insn 42 107 36 6 (set (reg:V8HI 20 xmm0 [117])
        (vec_concat:V8HI (unspec:V4HI [
                    (reg:V4SF 20 xmm0 [118])
                    (const_int 4 [0x4])
                ] UNSPEC_VCVTPS2PH)
            (const_vector:V4HI [
                    (const_int 0 [0]) repeated x4
                ]))) "t56.c":15:40 discrim 1 9621 {*vcvtps2ph}
     (nil))

is not detected as being able to trap with -ftrapping-math.

Note with -fno-trapping-math, this transformation is correct as trapping in
this case deals with floating exceptions. So clang not producing any underflow
is just pure accident as their setting is off there. And since you are tracking
floating exceptions, you need -ftrapping-math.

Reply via email to