#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.
Please use "fists".
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?
The description is from here: https://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax#Operation_Suffixes Hope its a valid one.
[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]$
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)?
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
Fixed for 2.36.