Hello!

>> gcc/testsuite/
>> Changelog for gcc/testsuite/Changelog
>> 2018-08-14  Vlad Lazar  <vlad.la...@arm.com>
>>
>>     * gcc.target/aarch64/imm_choice_comparison.c: New.
>>
>> gcc/
>> Changelog for gcc/Changelog
>> 2018-08-14  Vlad Lazar  <vlad.la...@arm.com>
>>     * expmed.h (canonicalize_comparison): New declaration.
>>     * expmed.c (canonicalize_comparison, equivalent_cmp_code): New.
>>     * expmed.c (emit_store_flag_1): Add call to canonicalize_comparison.
>>     * optabs.c (prepare_cmp_insn): Likewise.
>>     * rtl.h (unsigned_condition_p): New function which checks if a
>> comparison operator is unsigned.
> Thanks.  I fixed up the ChangeLog entry and installed this on the trunk.
>
> Richard S -- thanks for working with Vlad to push this forward.

This patch caused

+FAIL: gcc.target/i386/20040112-1.c scan-assembler testb

on x86 targets, reported in PR86994 [1].

The compiler now expands with:

(insn 12 8 13 4 (set (reg:CCGC 17 flags)
        (compare:CCGC (reg/v:QI 87 [ status ])
            (const_int -1 [0xffffffffffffffff]))) "20040112-1.c":13 9 {*cmpqi_1}
     (nil))

instead of:

(insn 10 8 11 4 (set (reg:CCGOC 17 flags)
        (compare:CCGOC (reg/v:QI 87 [ status ])
            (const_int 0 [0]))) "20040112-1.c":13 5 {*cmpqi_ccno_1}
     (nil))

The canonicalization, introduced in r263591 does not universally
benefit all targets. I wonder why TARGET_CANONICALIZE_COMPARISON
target hook was not used instead.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86994

Uros.

Reply via email to