Skip to content

Commit c594c39

Browse files
committed
Merge commit '8de4afd39ba48f25be98684cdb7a96ec6da89d10' into sync_cg_clif-2025-12-18
2 parents ed0006a + 8de4afd commit c594c39

File tree

10 files changed

+84
-22
lines changed

10 files changed

+84
-22
lines changed

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Avoid installing rustc-dev
3030
run: |
31-
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain
31+
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain.toml
3232
rustfmt -v
3333
3434
- name: Rustfmt
@@ -88,7 +88,7 @@ jobs:
8888
uses: actions/cache@v4
8989
with:
9090
path: build/cg_clif
91-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
91+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
9292

9393
- name: Set MinGW as the default toolchain
9494
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
@@ -158,7 +158,7 @@ jobs:
158158
uses: actions/cache@v4
159159
with:
160160
path: build/cg_clif
161-
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
161+
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
162162

163163
- name: Install hyperfine
164164
run: |
@@ -207,7 +207,7 @@ jobs:
207207
uses: actions/cache@v4
208208
with:
209209
path: build/cg_clif
210-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
210+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
211211

212212
- name: Set MinGW as the default toolchain
213213
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'

compiler/rustc_codegen_cranelift/.github/workflows/rustc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/cache@v4
2121
with:
2222
path: build/cg_clif
23-
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }}
23+
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
2424

2525
- name: Test
2626
run: ./scripts/test_bootstrap.sh
@@ -40,7 +40,7 @@ jobs:
4040
uses: actions/cache@v4
4141
with:
4242
path: build/cg_clif
43-
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }}
43+
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
4444

4545
- name: Install ripgrep
4646
run: |

compiler/rustc_codegen_cranelift/example/std_example.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ unsafe fn test_simd() {
259259
test_mm_cvttps_epi32();
260260
test_mm_cvtsi128_si64();
261261

262+
#[cfg(not(jit))]
263+
test_mm_cvtps_ph();
264+
262265
test_mm_extract_epi8();
263266
test_mm_insert_epi16();
264267
test_mm_shuffle_epi8();
@@ -558,6 +561,21 @@ unsafe fn test_mm_cvttps_epi32() {
558561
}
559562
}
560563

564+
#[cfg(target_arch = "x86_64")]
565+
#[target_feature(enable = "f16c")]
566+
#[cfg(not(jit))]
567+
unsafe fn test_mm_cvtps_ph() {
568+
const F16_ONE: i16 = 0x3c00;
569+
const F16_TWO: i16 = 0x4000;
570+
const F16_THREE: i16 = 0x4200;
571+
const F16_FOUR: i16 = 0x4400;
572+
573+
let a = _mm_set_ps(1.0, 2.0, 3.0, 4.0);
574+
let r = _mm_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(a);
575+
let e = _mm_set_epi16(0, 0, 0, 0, F16_ONE, F16_TWO, F16_THREE, F16_FOUR);
576+
assert_eq_m128i(r, e);
577+
}
578+
561579
fn test_checked_mul() {
562580
let u: Option<u8> = u8::from_str_radix("1000", 10).ok();
563581
assert_eq!(u, None);

compiler/rustc_codegen_cranelift/rust-toolchain

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2025-12-18"
3+
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
4+
profile = "minimal"

compiler/rustc_codegen_cranelift/scripts/rustup.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ case $1 in
2222
"prepare")
2323
echo "=> Installing new nightly"
2424
rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
25-
sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain
26-
rustup component add rustfmt || true
25+
sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain.toml
2726

2827
echo "=> Uninstalling all old nightlies"
2928
for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do
@@ -35,7 +34,7 @@ case $1 in
3534
./y.sh prepare
3635
;;
3736
"commit")
38-
git add rust-toolchain
37+
git add rust-toolchain.toml
3938
git commit -m "Rustup to $(rustc -V)"
4039
;;
4140
"push")

compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ git checkout -- tests/ui/entry-point/auxiliary/bad_main_functions.rs
3535
rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic
3636
rm tests/ui/simd/dont-invalid-bitcast-x86_64.rs # unimplemented llvm.x86.sse41.round.ps
3737
rm tests/ui/simd/intrinsic/generic-arithmetic-pass.rs # unimplemented simd_funnel_{shl,shr}
38+
rm -r tests/ui/scalable-vectors # scalable vectors are unsupported
3839

3940
# exotic linkages
4041
rm tests/incremental/hashes/function_interfaces.rs
@@ -53,23 +54,29 @@ rm tests/ui/sanitizer/kcfi-c-variadic.rs # same
5354
rm tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs # variadics for calling conventions other than C unsupported
5455
rm tests/ui/delegation/fn-header.rs
5556

57+
# inline assembly features
58+
rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly
59+
rm tests/ui/asm/global-asm-mono-sym-fn.rs # same
60+
rm tests/ui/asm/naked-asm-mono-sym-fn.rs # same
61+
rm tests/ui/asm/x86_64/goto.rs # inline asm labels not supported
62+
rm tests/ui/asm/label-operand.rs # same
63+
rm tests/ui/asm/may_unwind.rs # asm unwinding not supported
64+
rm tests/ui/asm/aarch64/may_unwind.rs # same
65+
5666
# misc unimplemented things
5767
rm tests/ui/target-feature/missing-plusminus.rs # error not implemented
5868
rm -r tests/run-make/repr128-dwarf # debuginfo test
5969
rm -r tests/run-make/split-debuginfo # same
6070
rm -r tests/run-make/target-specs # i686 not supported by Cranelift
6171
rm -r tests/run-make/mismatching-target-triples # same
62-
rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly
63-
rm tests/ui/asm/global-asm-mono-sym-fn.rs # same
64-
rm tests/ui/asm/naked-asm-mono-sym-fn.rs # same
65-
rm tests/ui/asm/x86_64/goto.rs # inline asm labels not supported
66-
rm tests/ui/asm/label-operand.rs # same
6772
rm tests/ui/simd/simd-bitmask-notpow2.rs # non-pow-of-2 simd vector sizes
6873
rm -r tests/run-make/used-proc-macro # used(linker) isn't supported yet
6974
rm tests/ui/linking/no-gc-encapsulation-symbols.rs # same
7075
rm tests/ui/attributes/fn-align-dyn.rs # per-function alignment not supported
7176
rm -r tests/ui/explicit-tail-calls # tail calls
7277
rm -r tests/run-make/pointer-auth-link-with-c # pointer auth
78+
rm -r tests/ui/eii # EII not yet implemented
79+
rm -r tests/run-make/forced-unwind-terminate-pof # forced unwinding doesn't take precedence
7380

7481
# requires LTO
7582
rm -r tests/run-make/cdylib
@@ -78,6 +85,7 @@ rm -r tests/run-make/lto-*
7885
rm -r tests/run-make/reproducible-build-2
7986
rm -r tests/run-make/no-builtins-lto
8087
rm -r tests/run-make/reachable-extern-fn-available-lto
88+
rm -r tests/run-make/no-builtins-linker-plugin-lto
8189

8290
# coverage instrumentation
8391
rm tests/ui/consts/precise-drop-with-coverage.rs
@@ -87,6 +95,7 @@ rm -r tests/ui/instrument-coverage/
8795
# ==================
8896
rm tests/ui/codegen/issue-28950.rs # depends on stack size optimizations
8997
rm tests/ui/codegen/init-large-type.rs # same
98+
rm tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs # same
9099
rm tests/ui/statics/const_generics.rs # tests an optimization
91100
rm tests/ui/linking/executable-no-mangle-strip.rs # requires --gc-sections to work for statics
92101

@@ -143,6 +152,15 @@ rm tests/ui/errors/remap-path-prefix-sysroot.rs # different sysroot source path
143152
rm -r tests/run-make/export/extern-opt # something about rustc version mismatches
144153
rm -r tests/run-make/export # same
145154
rm -r tests/ui/compiletest-self-test/compile-flags-incremental.rs # needs compiletest compiled with panic=unwind
155+
rm tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs # something going wrong with stdlib source remapping
156+
rm tests/ui/consts/miri_unleashed/drop.rs # same
157+
rm tests/ui/error-emitter/multiline-removal-suggestion.rs # same
158+
rm tests/ui/lint/lint-const-item-mutation.rs # same
159+
rm tests/ui/lint/use-redundant/use-redundant-issue-71450.rs # same
160+
rm tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.rs # same
161+
rm tests/ui/specialization/const_trait_impl.rs # same
162+
rm tests/ui/thir-print/offset_of.rs # same
163+
rm tests/ui/traits/const-traits/const_closure-const_trait_impl-ice-113381.rs # same
146164

147165
# genuine bugs
148166
# ============
@@ -157,6 +175,7 @@ rm tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs # same
157175
rm tests/ui/async-await/async-drop/async-drop-initial.rs # same (rust-lang/rust#140493)
158176
rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables
159177
rm -r tests/run-make-cargo/rustdoc-scrape-examples-paths # FIXME(rust-lang/rust#145580) incr comp bug
178+
rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away
160179

161180
rm tests/ui/intrinsics/panic-uninitialized-zeroed.rs # really slow with unoptimized libstd
162181
rm tests/ui/process/process-panic-after-fork.rs # same

compiler/rustc_codegen_cranelift/src/driver/jit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn dep_symbol_lookup_fn(
190190
diag.emit();
191191
}
192192
Linkage::Dynamic => {
193-
dylib_paths.push(src.dylib.as_ref().unwrap().0.clone());
193+
dylib_paths.push(src.dylib.as_ref().unwrap().clone());
194194
}
195195
}
196196
}

compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,35 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>(
13131313
ret.write_cvalue_transmute(fx, res);
13141314
}
13151315

1316+
"llvm.x86.vcvtps2ph.128" => {
1317+
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_ph
1318+
intrinsic_args!(fx, args => (a, _imm8); intrinsic);
1319+
let a = a.load_scalar(fx);
1320+
1321+
let imm8 =
1322+
if let Some(imm8) = crate::constant::mir_operand_get_const_val(fx, &args[1].node) {
1323+
imm8
1324+
} else {
1325+
fx.tcx
1326+
.dcx()
1327+
.span_fatal(span, "Index argument for `_mm_cvtps_ph` is not a constant");
1328+
};
1329+
1330+
let imm8 = imm8.to_u32();
1331+
1332+
codegen_inline_asm_inner(
1333+
fx,
1334+
&[InlineAsmTemplatePiece::String(format!("vcvtps2ph xmm0, xmm0, {imm8}").into())],
1335+
&[CInlineAsmOperand::InOut {
1336+
reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm0)),
1337+
_late: true,
1338+
in_value: a,
1339+
out_place: Some(ret),
1340+
}],
1341+
InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
1342+
);
1343+
}
1344+
13161345
_ => {
13171346
fx.tcx
13181347
.dcx()

compiler/rustc_codegen_cranelift/triagebot.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@
22

33
# Prevents un-canonicalized issue links (to avoid wrong issues being linked in r-l/rust)
44
[issue-links]
5-
6-
# Prevents mentions in commits to avoid users being spammed
7-
[no-mentions]

0 commit comments

Comments
 (0)