Bug 27106 - fistw not supported
Summary: fistw not supported
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-22 16:56 UTC by Stas Sergeev
Modified: 2022-06-22 06:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stas Sergeev 2020-12-22 16:56:09 UTC
#include <stdint.h>
int main()
{
    int16_t w;
    asm volatile("fist %0\n" : "=m"(w));
    return 0;
}

fist.c: Assembler messages:
fist.c:6: Warning: no instruction mnemonic suffix given and no register operands; using default for `fist'

And if you change to "fistw" then:

fist.c: Assembler messages:
fist.c:6: Error: invalid instruction suffix for `fist'

According to this:
https://www.felixcloutier.com/x86/fist:fistp
the 16bit variant should work.

"fistl" works fine.
Comment 1 H.J. Lu 2020-12-23 11:44:07 UTC
Please use "fists".
Comment 2 Stas Sergeev 2020-12-23 11:48:06 UTC
Yes, I tried "fists" already and noted
it doesn't cause a warning or an error.
But:
s = single (32-bit floating point).

So why would that be what I ask for?
It doesn't look 16bit to me, or what
am I missing?
Comment 3 Stas Sergeev 2020-12-23 11:56:41 UTC
The description is from here:
https://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax#Operation_Suffixes
Hope its a valid one.
Comment 4 H.J. Lu 2020-12-23 22:22:11 UTC
[hjl@gnu-cfl-1 tmp]$ cat x.s
 fists (%rax)
 fistl (%rax)
[hjl@gnu-cfl-1 tmp]$ objdump -dw x.o     

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:	df 10                	fists  (%rax)
   2:	db 10                	fistl  (%rax)
[hjl@gnu-cfl-1 tmp]$ objdump -Mintel -dw x.o     

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:	df 10                	fist   WORD PTR [rax]
   2:	db 10                	fist   DWORD PTR [rax]
[hjl@gnu-cfl-1 tmp]$
Comment 5 Stas Sergeev 2020-12-23 22:32:12 UTC
OK, thank you.
Would you like to fix the documentation?
Am I right that it should say:
s = single (16-bit integer or 32-bit floating point)?
Comment 6 Sourceware Commits 2020-12-25 14:00:00 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a12f86b9a6529013ba980feee40a84c467641201

commit a12f86b9a6529013ba980feee40a84c467641201
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 25 05:56:36 2020 -0800

    gas: Update 80387 floating point 's' suffix
    
    Update 80387 floating point 's' suffix to read:
    
      * Integer constructors are '.word', '.long' or '.int', and '.quad'
         for the 16-, 32-, and 64-bit integer formats.  The corresponding
         instruction mnemonic suffixes are 's' (short), 'l' (long), and 'q'
         (quad).
    
    instead of 's' (single).
    
            PR gas/27106
            * doc/c-i386.texi: Update 80387 floating point 's' suffix
Comment 7 H.J. Lu 2020-12-25 14:00:26 UTC
Fixed for 2.36.