llvm / llvm-project

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

X86: Delete MMX types/intrinsics from LLVM IR/backends #98272

Open jyknight opened 3 weeks ago

jyknight commented 3 weeks ago

This issue is about removing IR and SelectionDAG/Codegen support. Assembler support should remain.

Previous discussion on discourse Proposal to remove MMX support

The idea is, at the LLVM level, to keep only minimal support for the inlineasm "y" constraints, and remove as much of the rest as possible.

Overall plan:

  1. [x] Delete all support for 3dNow! (PR #96246)
  2. [x] Delete the x86_mmx type from IR. Can be done by using (at the IR level only) a standard vector type, <1 x i64>, instead. Notably, Clang already uses <1 x i64> for everything except where required to interface with mmx intrinsics and inline-asm. The conversion for those interfaces can be pushed down into SelectionDAG instead. (PR #98505) (PR #100646)
  3. [x] Migrate Clang-side MMX builtins to be backed by SSE2 instead of MMX so they can continue to work without requiring the MMX intrinsic functions in IR (and as a bonus, they'll likely get faster, too). (bug #41665, PR #96540)
  4. [ ] Delete the IR-side MMX intrinsic functions.
    • Open question: how to deal with bitcode backwards compatibility for these? Maybe simplest to convert the intrinsics to inline-asm in autoupgrade.
  5. [ ] Delete as much of the remaining X86 backend code related to MMX as possible, without breaking inline asm "y" constraints.
  6. [ ] Decide whether to do anything about inserting EMMS instructions (bug #41664). At this point, it'd be only relevant to inline-asm. So we could potentially insert such an instruction directly after all inline-asm which have MMX register inputs/outputs/clobbers. Or we could also (continue to) not bother.

@efriedma-quic @phoebewang @topperc @RKSimon

llvmbot commented 3 weeks ago

@llvm/issue-subscribers-backend-x86

Author: James Y Knight (jyknight)

This issue is about removing IR and SelectionDAG/Codegen support. Assembler support should remain. Previous discussion on discourse [Proposal to remove MMX support](https://discourse.llvm.org/t/proposal-to-remove-mmx-support/56304) The idea is, at the LLVM level, to keep only minimal support for the inlineasm "y" constraints, and remove as much of the rest as possible. Overall plan: 1. Delete all support for 3dNow! (PR #96246) 2. Delete the `x86_mmx` type from IR. Can be done by using (at the IR level only) a standard vector type, `<1 x i64>`, instead. Notably, Clang already uses `<1 x i64>` for everything except where required to interface with mmx intrinsics and inline-asm. The conversion for those interfaces can be pushed down into SelectionDAG instead. (PR for this pending) 3. Migrate Clang-side MMX builtins to be backed by SSE2 instead of MMX (bug #41665, PR #96540), so they can continue to work without requiring the MMX intrinsic functions in IR (and as a bonus, they'll likely get faster, too). 4. Delete the IR-side MMX intrinsic functions. - Open question: how to deal with bitcode backwards compatibility for these? Maybe simplest to convert the intrinsics to inline-asm in autoupgrade. 5. Delete as much of the remaining X86 backend code related to MMX as possible, without breaking inline asm "y" constraints. 6. Decide whether to do anything about inserting EMMS instructions (bug #41664). At this point, it'd be only relevant to inline-asm. So we could potentially insert such an instruction directly after all inline-asm which have MMX register inputs/outputs/clobbers. Or we could also (continue to) not bother. @efriedma-quic @phoebewang @topperc @RKSimon
frobtech commented 2 weeks ago

The current state of things seems to be that the -mno-3dnow switch is still accepted by the Clang driver, but using it causes these messages:

'-3dnow' is not a recognized feature for this target (ignoring feature)
'-3dnowa' is not a recognized feature for this target (ignoring feature)
RKSimon commented 2 weeks ago

@frobtech #99352 should address this