aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-05-10 09:44:34 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-05-10 09:44:34 +0100
commit5b7a9751f55bcdb7d9a69345e02f62aaa7035d6b (patch)
treed09f6d7423de293ca33821a440e5b0663f6b1406 /libgcc
parentdd3c7873a61019e993ee8b79e3695722b13cf945 (diff)
downloadgcc-5b7a9751f55bcdb7d9a69345e02f62aaa7035d6b.zip
gcc-5b7a9751f55bcdb7d9a69345e02f62aaa7035d6b.tar.gz
gcc-5b7a9751f55bcdb7d9a69345e02f62aaa7035d6b.tar.bz2
Avoid andb %dil when optimizing for size.
The simple test case below has the unfortunate property that on x86_64, it is larger when compiled with -Os than when compiled with -O2. int foo(char x) { return (x & 123) != 0; } The issue is x86's complex instruction encoding, where andb $XX,%dil requires more bytes than andl $XX,%edi. This patch adds logic to i386.md's *testqi_1_maybe_si and *andqi_2_maybe_si define_insn patterns to prefer the shorter SImode alternative when optimizing for size. 2022-05-10 Uroš Bizjak <ubizjak@gmail.com> Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/i386/i386.md (*testqi_1_maybe_si): Prefer shorter SImode alternative when optimizing for size and the immediate operand is const_0_to_127_operand. (*andqi_2_maybe_si): Likewise. * config/i386/predicates.md (const_0_to_127_operand): New predicate. gcc/testsuite/ChangeLog * gcc.target/i386/and-1.c: New test case.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions