https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120427
Bug ID: 120427 Summary: [12/13/14/15/16 Regression] "and $0,mem" is generated without -Oz Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: liuhongt at gcc dot gnu.org, roger at nextmovesoftware dot com, ubizjak at gmail dot com Target Milestone: --- commit ef26c151c14a87177d46fd3d725e7f82e040e89f Author: Roger Sayle <ro...@nextmovesoftware.com> Date: Thu Dec 23 12:33:07 2021 +0000 x86: PR target/103773: Fix wrong-code with -Oz from pop to memory. transformed "mov $0,mem" to the shorter and "$0,mem" for -Oz. But (define_insn "*mov<mode>_and" [(set (match_operand:SWI248 0 "memory_operand" "=m") (match_operand:SWI248 1 "const0_operand")) (clobber (reg:CC FLAGS_REG))] "reload_completed" "and{<imodesuffix>}\t{%1, %0|%0, %1}" [(set_attr "type" "alu1") (set_attr "mode" "<MODE>") (set_attr "length_immediate" "1")]) isn't guarded for -Oz. As the result, "and $0,mem" is generated without -Oz.