[all-commits] [llvm/llvm-project] 15f15a: [x86][MC] Fix movdir64b addressing

Akshay Khadse via All-commits all-commits at lists.llvm.org
Thu Jun 8 07:41:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 15f15ab2c895545da70c14a72289fa7c00ed3f94
      https://github.com/llvm/llvm-project/commit/15f15ab2c895545da70c14a72289fa7c00ed3f94
  Author: Akshay Khadse <akshayskhadse at gmail.com>
  Date:   2023-06-08 (Thu, 08 Jun 2023)

  Changed paths:
    M clang/test/CodeGen/ms-inline-asm-64.c
    M clang/test/CodeGen/ms-inline-asm.c
    M llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
    A llvm/test/CodeGen/X86/inline-asm-movdir64b-x86_64.ll
    A llvm/test/CodeGen/X86/inline-asm-movdir64b.ll

  Log Message:
  -----------
  [x86][MC] Fix movdir64b addressing

This patch is to fix the [[ https://github.com/llvm/llvm-project/issues/63045 | issue 63045]].

Look at the following code:
```
int main(int argc, char *argv[]) {
    int arr[1000];
    __asm movdir64b rax, ZMMWORD PTR [arr]
    return 0;
}
```
Compiling this code using `clang -O0 -fasm-blocks bug.c` gives the a linker error.

The problem seems to be in the generated assembly. Following is the out put of `clang -S -O0 -fasm-blocks bug.c`:
```
movq %rsi, -16(%rbp)
#APP

movdir64b arr, %rax

#NO_APP
xorl %eax, %eax
```
The symbol `arr` should be replaced with some address like `-4(%rbp)`.

This makes me believe that issue is not in the linker, but with the ASM parser.

This issue originates with patch [D145893](https://reviews.llvm.org/D145893). And that's why reverting it fixes the issue. More specifically, the function [isMem512_GR64()](https://github.com/llvm/llvm-project/blob/ff471dcf7669b1ad7903a44d0773bef4eb175eb9/llvm/lib/Target/X86/AsmParser/X86Operand.h#L404) within the [llvm/lib/Target/X86/AsmParser/X86Operand.h](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/AsmParser/X86Operand.h) file.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D151863




More information about the All-commits mailing list