Issue 97522
Summary [x86-64] Assembly Issue on Intel AMX instruction
Labels new issue
Assignees
Reporter witbring
    I found that Clang allows some AMX (Advanced Matrix Extension) instructions that GAS disallows. 
Specifically, GAS enforces tdpbf16ps, tdpbssd, tdpbusd, tdpbsud, tdpduud, and tdpfp16ps to have distinct registers, whereas Clang permits them to have non-distinct registers. 
Additionally, when using the GAS disassembler (objdump), it prints the binary code with a 'bad' alarm.

Here is an example code snippet:
```asm
.intel_syntax noprefix
    tdpbf16ps TMM0, TMM0, TMM0
    tdpbssd TMM0, TMM0, TMM0
    tdpbusd TMM0, TMM0, TMM0
 tdpbsud TMM0, TMM0, TMM0
    tdpbuud TMM0, TMM0, TMM0
    tdpfp16ps TMM0, TMM0, TMM0
```

Clang successfully assembles these instructions. The disassembly of the Clang-compiled code is shown below:
```bash
 tdpbf16ps tmm0/(bad),tmm0/(bad),tmm0/(bad)
 tdpbssd tmm0/(bad),tmm0/(bad),tmm0/(bad)
 tdpbusd tmm0/(bad),tmm0/(bad),tmm0/(bad)
 tdpbsud tmm0/(bad),tmm0/(bad),tmm0/(bad)
 tdpbuud tmm0/(bad),tmm0/(bad),tmm0/(bad)
 tdpfp16ps tmm0/(bad),tmm0/(bad),tmm0/(bad)
```

In contrast, GAS emits error messages for the same code:
```bash
<source>: Assembler messages:
<source>: Warning: end of file not at end of a line; newline inserted
<source>:2: Error: all tmm registers must be distinct for `tdpbf16ps'
<source>:3: Error: all tmm registers must be distinct for `tdpbssd'
<source>:4: Error: all tmm registers must be distinct for `tdpbusd'
<source>:5: Error: all tmm registers must be distinct for `tdpbsud'
<source>:6: Error: all tmm registers must be distinct for `tdpbuud'
<source>:7: Error: all tmm registers must be distinct for `tdpfp16ps'
Compiler returned: 1
```

You can reproduce these result on godbolt:
https://godbolt.org/z/n99Tf3vdj
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to