public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "admin@tho-otto.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115010] New: m68k: invalid subl instruction generated Date: Thu, 09 May 2024 12:21:12 +0000 [thread overview] Message-ID: <bug-115010-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115010 Bug ID: 115010 Summary: m68k: invalid subl instruction generated Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: admin@tho-otto.de Target Milestone: --- While configuring a cross-compiler for m68k, and then trying to use that cross-compiler to build a native compiler, a wrong subl instruction gets generated: Assembler messages: /tmp/ccpLXgrk.s:16664: Error: operands mismatch -- statement sub.l -402(%fp),-446(%fp)' ignored /tmp/ccpLXgrk.s:16813: Error: operands mismatch -- statement sub.l -274(%fp),-302(%fp)' ignored make[1]: *** [Makefile:1202: tree-data-ref.o] Error 1 That instruction is invalid, because atleast one of the operands must be a data register. Unfortunately the steps to reproduce are a bit complicated, using a bare m68k-elf target not work, because for the 2nd step you will also need a working c-library. And of course you also need binutils for that target. I should also mention that the same bug already happened in gcc 11.4.0, but strangely not in gcc 13.2.0 or gcc 12.3.0 (but maybe this was just by incident). The problem also disappears when compiling tree-data-ref.c using -Os instead of -O2. I'm not that really familiar with the machine description files, but to me (define_insn "subsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "=md,ma,m,d,a") (minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0,0") (match_operand:SI 2 "general_src_operand" "I,I,dT,mSrT,mSrs")))] "" "@ subq%.l %2, %0 subq%.l %2, %0 sub%.l %2,%0 sub%.l %2,%0 sub%.l %2,%0" [(set_attr "type" "aluq_l,aluq_l,alu_l,alu_l,alu_l") (set_attr "opy" "2") (set_attr "flags_valid" "noov,unchanged,noov,noov,unchanged")]) Looks suspicious. If i'm not wrong, that pattern is used to turn something like "x = x - y" into "x -= y". But alternative 3 can match a memory operand for operand 0, and constraint 'T' for operand 2 is defined as (define_constraint "T" "Used for operands that satisfy 's' when -mpcrel is not in effect." (and (match_code "symbol_ref,label_ref,const") (match_test "!TARGET_PCREL") (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)"))) so it can match a symbol_ref. Could that be the cause?
next reply other threads:[~2024-05-09 12:21 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-09 12:21 admin@tho-otto.de [this message] 2024-05-09 14:50 ` [Bug target/115010] " schwab@linux-m68k.org 2024-05-09 15:13 ` admin@tho-otto.de 2024-05-09 16:11 ` pinskia at gcc dot gnu.org 2024-05-09 16:32 ` admin@tho-otto.de 2024-05-09 16:33 ` pinskia at gcc dot gnu.org 2024-05-09 16:34 ` sjames at gcc dot gnu.org 2024-05-09 16:46 ` admin@tho-otto.de 2024-05-09 17:15 ` admin@tho-otto.de 2024-05-09 17:17 ` admin@tho-otto.de 2024-05-09 18:51 ` admin@tho-otto.de 2024-05-12 15:24 ` mikpelinux at gmail dot com 2024-05-13 3:20 ` admin@tho-otto.de 2024-05-13 9:52 ` admin@tho-otto.de 2024-05-13 10:01 ` admin@tho-otto.de 2024-05-13 11:35 ` admin@tho-otto.de 2024-05-23 5:03 ` pinskia at gcc dot gnu.org 2024-05-23 5:17 ` admin@tho-otto.de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-115010-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).