This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/65871] bzhi builtin/intrinsic wrongly assumes bzhi instruction doesn't set the ZF flag


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

--- Comment #10 from UroÅ Bizjak <ubizjak at gmail dot com> ---
(In reply to James Almer from comment #9)
> Created attachment 35804 [details]
> Preprocessed code where a test instruction is still generated
> 
> Please look at the attachment.
> 
> [jamrial@archVM ~]$ gcc -std=c99 -march=haswell -O3 -c hevc_ps.i
> 
> [jamrial@archVM ~]$ objdump --disassemble hevc_ps.o | grep -B2 -A2 bzhi
>     5854:       c4 62 22 f7 d6          sarx   %r11d,%esi,%r10d
>     5859:       c4 62 22 f7 da          sarx   %r11d,%edx,%r11d
>     585e:       c4 e2 70 f5 f6          bzhi   %ecx,%esi,%esi
>     5863:       45 89 9e 68 33 00 00    mov    %r11d,0x3368(%r14)
>     586a:       41 89 c3                mov    %eax,%r11d
> --
>     589d:       85 f6                   test   %esi,%esi
>     589f:       75 0d                   jne    58ae
> <ff_hevc_decode_nal_sps+0x1a6e>
>     58a1:       c4 e2 70 f5 d2          bzhi   %ecx,%edx,%edx
>     58a6:       85 d2                   test   %edx,%edx
>     58a8:       0f 84 5a 03 00 00       je     5c08
> <ff_hevc_decode_nal_sps+0x1dc8>

[...]

> Not sure why the new model is not working here.

Because of the cost model. Combine pass says:

Trying 2631 -> 2633:
Successfully matched this instruction:
(set (reg:CCZ 17 flags)
    (compare:CCZ (zero_extract:SI (reg:SI 2360 [ D.14992 ])
            (umin:SI (zero_extend:SI (subreg:QI (reg:SI 301 [ D.14999 ]) 0))
                (const_int 32 [0x20]))
            (const_int 0 [0]))
        (const_int 0 [0])))
rejecting combination of insns 2631 and 2633
original costs 12 + 4 = 16
replacement cost 18

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]