llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.25k stars 12.08k forks source link

[AMDGPU][MC] Inconsistent behavior of "no*" modifiers #48187

Open dpreobra opened 3 years ago

dpreobra commented 3 years ago
Bugzilla Link 48843
Version trunk
OS All

Extended Description

These modifiers are supported for the sake of compatibility with sp3. However use of "no*" modifiers in llvm results in invalid code or counterintuitive behavior.

Examples:

  1. GFX8 buffer_store_lds_dword requires "lds" modifier:

    buffer_store_lds_dword s[4:7], s0 offset:4095 lds // ok buffer_store_lds_dword s[4:7], s0 offset:4095 // error

However "nolds" is also accepted and results in the same code as "lds" variant.

buffer_store_lds_dword s[4:7], s0 offset:4095 nolds  // ok?

There is a similar issue with bufferload* opcodes which support "lds" as an optional modifier. These instruction accept "nolds" but handle it as if it were "lds".

  1. exp "done" modifier is optional:

    exp mrt0 v0, v0, v0, v0 done // ok exp mrt0 v0, v0, v0, v0 // ok

However "nodone" is not supported.

  1. dsgws* opcodes accept both "gds" and "nogds" but produce the same code. Actually these opcodes have no lds variants so "nogds" should be illegal.

  2. Most modifiers which affect operand size ("offen", "idxen", "glc", etc) can be omitted, but "no*" variants trigger an error.

    buffer_load_format_x v5, off, s[8:11], s3 // ok buffer_load_format_x v5, off, s[8:11], s3 noidxen // error

dpreobra commented 3 years ago

assigned to @dpreobra