public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46187] New: Invalid instruction suffix generated by %z
@ 2010-10-26 15:01 us15 at os dot inf.tu-dresden.de
  2010-10-26 15:03 ` [Bug target/46187] " us15 at os dot inf.tu-dresden.de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: us15 at os dot inf.tu-dresden.de @ 2010-10-26 15:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46187

           Summary: Invalid instruction suffix generated by %z
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: us15@os.inf.tu-dresden.de


Created attachment 22163
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22163
Testcase

The testcase compiled with -Os should produce something like the following:
  4004cc:       f0 80 6c 24 ff 01       lock subb $0x1,-0x1(%rsp)
  4004d5:       f0 66 83 6c 24 fc 02    lock subw $0x2,-0x4(%rsp)
  4004df:       f0 48 83 6c 24 f0 03    lock subq $0x3,-0x10(%rsp)

This works correctly on 4.5.1 and 4.6.0. Older compilers fail as shown below.

The code is supposed to emit the correct instruction suffix for SUB using %z
when n is an immediate value that does not give the operand size away. Is there
another way to achieve the same effect?

g++-gcc-4.1.2 -Os testcase.cc -o testcase
testcase.cc: In function 'int main()':
testcase.cc:20: internal compiler error: in print_operand, at
config/i386/i386.c:7226
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

g++-gcc-4.2.4 -Os testcase.cc -o testcase
testcase.cc: In function 'int main()':
testcase.cc:20: internal compiler error: in print_operand, at
config/i386/i386.c:7791
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

g++-gcc-4.3.5 -Os testcase.cc -o testcase
testcase.cc: Assembler messages:
testcase.cc:5: Error: invalid instruction suffix for `sub'
testcase.cc:5: Error: no such instruction: `subll $3,-16(%rsp)'

g++-gcc-4.4.5 -Os testcase.cc -o testcase
testcase.cc: Assembler messages:
testcase.cc:5: Error: invalid instruction suffix for `sub'
testcase.cc:5: Error: no such instruction: `subll $3,-16(%rsp)'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/46187] Invalid instruction suffix generated by %z
  2010-10-26 15:01 [Bug target/46187] New: Invalid instruction suffix generated by %z us15 at os dot inf.tu-dresden.de
@ 2010-10-26 15:03 ` us15 at os dot inf.tu-dresden.de
  2010-10-26 19:28 ` ubizjak at gmail dot com
  2021-08-09  7:28 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: us15 at os dot inf.tu-dresden.de @ 2010-10-26 15:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46187

--- Comment #1 from Udo Steinberg <us15 at os dot inf.tu-dresden.de> 2010-10-26 15:03:01 UTC ---
Bug #31768 is probably related.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/46187] Invalid instruction suffix generated by %z
  2010-10-26 15:01 [Bug target/46187] New: Invalid instruction suffix generated by %z us15 at os dot inf.tu-dresden.de
  2010-10-26 15:03 ` [Bug target/46187] " us15 at os dot inf.tu-dresden.de
@ 2010-10-26 19:28 ` ubizjak at gmail dot com
  2021-08-09  7:28 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2010-10-26 19:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46187

--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2010-10-26 19:28:34 UTC ---
(In reply to comment #0)

> The code is supposed to emit the correct instruction suffix for SUB using %z
> when n is an immediate value that does not give the operand size away. Is there
> another way to achieve the same effect?

In your particular case, you can use __sync_fetch_and_sub, please see GCC docs.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/46187] Invalid instruction suffix generated by %z
  2010-10-26 15:01 [Bug target/46187] New: Invalid instruction suffix generated by %z us15 at os dot inf.tu-dresden.de
  2010-10-26 15:03 ` [Bug target/46187] " us15 at os dot inf.tu-dresden.de
  2010-10-26 19:28 ` ubizjak at gmail dot com
@ 2021-08-09  7:28 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09  7:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46187

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |4.5.0

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-09  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26 15:01 [Bug target/46187] New: Invalid instruction suffix generated by %z us15 at os dot inf.tu-dresden.de
2010-10-26 15:03 ` [Bug target/46187] " us15 at os dot inf.tu-dresden.de
2010-10-26 19:28 ` ubizjak at gmail dot com
2021-08-09  7:28 ` pinskia at gcc dot gnu.org

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).