Skip to content

Commit 0f9f0b3

Browse files
committed
Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obk
Remove MMX from Rust Follow-up to rust-lang/stdarch#890 This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.
2 parents 7467d17 + 5de2c95 commit 0f9f0b3

File tree

12 files changed

+6
-60
lines changed

12 files changed

+6
-60
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ extern "C" {
948948

949949
// Operations on other types
950950
pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
951-
pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
952951
pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
953952

954953
// Operations on all values

compiler/rustc_codegen_llvm/src/llvm_util.rs

-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
203203
("fma", None),
204204
("fxsr", None),
205205
("lzcnt", None),
206-
("mmx", Some(sym::mmx_target_feature)),
207206
("movbe", Some(sym::movbe_target_feature)),
208207
("pclmulqdq", None),
209208
("popcnt", None),

compiler/rustc_codegen_llvm/src/type_.rs

-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ impl CodegenCx<'ll, 'tcx> {
6262
unsafe { llvm::LLVMIntTypeInContext(self.llcx, num_bits as c_uint) }
6363
}
6464

65-
crate fn type_x86_mmx(&self) -> &'ll Type {
66-
unsafe { llvm::LLVMX86MMXTypeInContext(self.llcx) }
67-
}
68-
6965
crate fn type_vector(&self, ty: &'ll Type, len: u64) -> &'ll Type {
7066
unsafe { llvm::LLVMVectorType(ty, len as c_uint) }
7167
}

compiler/rustc_codegen_llvm/src/type_of.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,8 @@ fn uncached_llvm_type<'a, 'tcx>(
2121
match layout.abi {
2222
Abi::Scalar(_) => bug!("handled elsewhere"),
2323
Abi::Vector { ref element, count } => {
24-
// LLVM has a separate type for 64-bit SIMD vectors on X86 called
25-
// `x86_mmx` which is needed for some SIMD operations. As a bit of a
26-
// hack (all SIMD definitions are super unstable anyway) we
27-
// recognize any one-element SIMD vector as "this should be an
28-
// x86_mmx" type. In general there shouldn't be a need for other
29-
// one-element SIMD vectors, so it's assumed this won't clash with
30-
// much else.
31-
let use_x86_mmx = count == 1
32-
&& layout.size.bits() == 64
33-
&& (cx.sess().target.target.arch == "x86"
34-
|| cx.sess().target.target.arch == "x86_64");
35-
if use_x86_mmx {
36-
return cx.type_x86_mmx();
37-
} else {
38-
let element = layout.scalar_llvm_type_at(cx, element, Size::ZERO);
39-
return cx.type_vector(element, count);
40-
}
24+
let element = layout.scalar_llvm_type_at(cx, element, Size::ZERO);
25+
return cx.type_vector(element, count);
4126
}
4227
Abi::ScalarPair(..) => {
4328
return cx.type_struct(

compiler/rustc_feature/src/active.rs

-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ declare_features! (
229229
(active, powerpc_target_feature, "1.27.0", Some(44839), None),
230230
(active, mips_target_feature, "1.27.0", Some(44839), None),
231231
(active, avx512_target_feature, "1.27.0", Some(44839), None),
232-
(active, mmx_target_feature, "1.27.0", Some(44839), None),
233232
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
234233
(active, tbm_target_feature, "1.27.0", Some(44839), None),
235234
(active, wasm_target_feature, "1.30.0", Some(44839), None),

compiler/rustc_span/src/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ symbols! {
679679
minnumf32,
680680
minnumf64,
681681
mips_target_feature,
682-
mmx_target_feature,
683682
module,
684683
module_path,
685684
more_struct_aliases,

compiler/rustc_typeck/src/collect.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,6 @@ fn from_target_feature(
23632363
Some(sym::mips_target_feature) => rust_features.mips_target_feature,
23642364
Some(sym::riscv_target_feature) => rust_features.riscv_target_feature,
23652365
Some(sym::avx512_target_feature) => rust_features.avx512_target_feature,
2366-
Some(sym::mmx_target_feature) => rust_features.mmx_target_feature,
23672366
Some(sym::sse4a_target_feature) => rust_features.sse4a_target_feature,
23682367
Some(sym::tbm_target_feature) => rust_features.tbm_target_feature,
23692368
Some(sym::wasm_target_feature) => rust_features.wasm_target_feature,

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
#![feature(unwind_attributes)]
127127
#![feature(variant_count)]
128128
#![cfg_attr(bootstrap, feature(doc_alias))]
129-
#![feature(mmx_target_feature)]
130129
#![feature(tbm_target_feature)]
131130
#![feature(sse4a_target_feature)]
132131
#![feature(arm_target_feature)]

src/test/codegen/x86_mmx.rs

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![feature(mmx_target_feature)]
1+
#![feature(avx512_target_feature)]
22

33
#[inline]
4-
#[target_feature(enable = "mmx")]
4+
#[target_feature(enable = "avx512ifma")]
55
pub unsafe fn foo() {}

src/test/ui/target-feature/gate.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
// gate-test-aarch64_target_feature
2020
// gate-test-hexagon_target_feature
2121
// gate-test-mips_target_feature
22-
// gate-test-mmx_target_feature
2322
// gate-test-wasm_target_feature
2423
// gate-test-adx_target_feature
2524
// gate-test-cmpxchg16b_target_feature
@@ -30,7 +29,6 @@
3029

3130
#[target_feature(enable = "avx512bw")]
3231
//~^ ERROR: currently unstable
33-
unsafe fn foo() {
34-
}
32+
unsafe fn foo() {}
3533

3634
fn main() {}

src/test/ui/target-feature/gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the target feature `avx512bw` is currently unstable
2-
--> $DIR/gate.rs:31:18
2+
--> $DIR/gate.rs:30:18
33
|
44
LL | #[target_feature(enable = "avx512bw")]
55
| ^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)