This is the mail archive of the gcc-patches@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] |
int fct1 (void); int fct2 (void);
int fct (unsigned nb) { if ((nb >> 5) != 0) return fct1 (); else return fct2 (); }
fct: movl 4(%esp), %eax shrl $5, %eax testl %eax, %eax je .L2 jmp fct1 .p2align 4,,7 .L2: jmp fct2
The problem is in combiner, which rejects PARALLEL combination of arithmetic and CC setting instruction when the result of arithmetic operation is unused. This is kind of strange, as the combination _always_ results in smaller code, by avoiding explicit CC setting insn.
The proposed solution is to force generation of PARALLEL of CC setting and arith insn even when the result of arithmetic operation is unused. Resulting asm code is then:
fct: movl 4(%esp), %eax shrl $5, %eax je .L2 jmp fct1 .p2align 4,,7 .L2: jmp fct2
PR target/28946 * combine.c (try_combine): Force PARALLEL of comparison and arithmetic insn even if arithmetic result is not used.
PR target/28946 * gcc.target/i386/pr28946.c: New test.
Attachment:
pr28946.diff
Description: Binary data
Attachment:
pr28946.c
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |