Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8959aa4
Support implementing ExtraBackendMethods and WriteBackendMethods inde…
bjorn3 May 28, 2026
a291dd0
Stop needing an alloca for `catch_unwind`
scottmcm May 23, 2026
09e03d4
Rollup merge of #156867 - scottmcm:WIP-no-alloca-for-catch-unwind, r=…
JonathanBrouwer May 29, 2026
1fcc636
Rollup merge of #157050 - bjorn3:lto_refactors19, r=lqd
JonathanBrouwer May 29, 2026
418adda
resolve: Partially convert `ambiguous_glob_imports` lint into a hard …
petrochenkov Nov 21, 2025
c3101c0
Use a `ArrayVec` in `CastTarget`
alexcrichton May 29, 2026
9f9e508
Rollup merge of #157130 - alexcrichton:refactor-cast-target-internals…
JonathanBrouwer Jun 2, 2026
d5db9be
add `extern "tail"` calling convention
folkertdev May 27, 2026
774e911
Use WorkProductMap instead of FxIndexMap
bjorn3 Jun 3, 2026
5fb3b38
asm! support for the Xtensa architecture
MabezDev Oct 3, 2025
a20ecda
Rollup merge of #147302 - esp-rs:xtensa-asm, r=Amanieu
JonathanBrouwer Jun 8, 2026
9202952
Add inline asm support for amdgpu
Flakebi Jun 3, 2026
ef638de
Move create_scope_map to rustc_codegen_ssa.
cjgillot Jun 10, 2026
ab8c5d5
Rollup merge of #157722 - cjgillot:ssa-create-scope-map, r=oli-obk
jhpratt Jun 12, 2026
9b4d320
remove LLVM `va_end` calls
folkertdev Jun 8, 2026
f516eb4
Rollup merge of #157627 - folkertdev:remove-llvm-va_end, r=RalfJung
jhpratt Jun 15, 2026
9ff44af
codegen_ssa: multiply scalable vec size by `vscale`
davidtwco Jun 22, 2026
515a89c
cg_LLVM: Stop needing an alloca for volatile loads
scottmcm May 23, 2026
3d3ea2f
cg_gcc: Fix Clippy lint fallout
flip1995 Jun 25, 2026
a292cee
Auto merge of #158403 - flip1995:clippy-subtree-update, r=Manishearth
bors Jun 26, 2026
7532add
Rollup merge of #157127 - scottmcm:tweak-layout-of-alternative, r=nikic
JonathanBrouwer Jun 26, 2026
0e3928a
Merge branch 'master' into sync_from_rust_2026_06_27
antoyo Jun 27, 2026
cf22ea9
Update to nightly-2026-06-28
antoyo Jun 28, 2026
3120a7a
Remove useless stdarch patch
antoyo Jun 28, 2026
e44da23
Fix the debug_assert in bytes_in_context
antoyo Jun 28, 2026
2c9b73d
Add failing UI tests
antoyo Jun 28, 2026
34418c3
Add spelling exclusion
antoyo Jun 28, 2026
2d86197
Add dummy implementation of more tile intrinsics
antoyo Jun 28, 2026
cf90818
Ignore more tile intrinsic tests
antoyo Jun 28, 2026
adc4484
Add dummy implementation of f16 for m68k CI
antoyo Jun 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ jobs:
if: ${{ matrix.cargo_runner }}
run: |
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
# FIXME: remove --skip test_tile_ when it's implemented.
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile

# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
Expand Down
2 changes: 0 additions & 2 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,6 @@ fn valid_ui_error_pattern_test(file: &str) -> bool {
"type-alias-impl-trait/auxiliary/cross_crate_ice.rs",
"type-alias-impl-trait/auxiliary/cross_crate_ice2.rs",
"macros/rfc-2011-nicer-assert-messages/auxiliary/common.rs",
"imports/ambiguous-1.rs",
"imports/ambiguous-4-extern.rs",
"entry-point/auxiliary/bad_main_functions.rs",
]
.iter()
Expand Down
39 changes: 0 additions & 39 deletions patches/0001-Add-stdarch-Cargo.toml-for-testing.patch

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2026-05-28"
channel = "nightly-2026-06-28"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
33 changes: 22 additions & 11 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_middle::bug;
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::LayoutOf;
#[cfg(feature = "master")]
use rustc_session::config;
use rustc_session::{Session, config};
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
#[cfg(feature = "master")]
use rustc_target::spec::Arch;
Expand Down Expand Up @@ -46,7 +46,7 @@ impl GccType for CastTarget {
)
};

if self.prefix.iter().all(|x| x.is_none()) {
if self.prefix.is_empty() {
// Simplify to a single unit when there is no prefix and size <= unit size
if self.rest.total <= self.rest.unit.size {
return rest_gcc_unit;
Expand All @@ -62,7 +62,7 @@ impl GccType for CastTarget {
let mut args: Vec<_> = self
.prefix
.iter()
.flat_map(|option_reg| option_reg.map(|reg| reg.gcc_type(cx)))
.map(|reg| reg.gcc_type(cx))
.chain((0..rest_count).map(|_| rest_gcc_unit))
.collect();

Expand Down Expand Up @@ -230,32 +230,43 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {

#[cfg(feature = "master")]
fn gcc_cconv(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Option<FnAttribute<'gcc>> {
conv_to_fn_attribute(self.conv, &cx.tcx.sess.target.arch)
conv_to_fn_attribute(cx.sess(), self.conv)
}
}

#[cfg(feature = "master")]
pub fn conv_to_fn_attribute<'gcc>(conv: CanonAbi, arch: &Arch) -> Option<FnAttribute<'gcc>> {
pub fn conv_to_fn_attribute<'gcc>(sess: &Session, conv: CanonAbi) -> Option<FnAttribute<'gcc>> {
let attribute = match conv {
CanonAbi::C | CanonAbi::Rust => return None,
// gcc/gccjit does not have anything for this.
CanonAbi::RustPreserveNone => return None,
CanonAbi::RustPreserveNone => {
// This calling convention is LLVM-specific and unspecified.
sess.dcx()
.fatal("gcc/gccjit backend does not support RustPreserveNone calling convention")
}
CanonAbi::RustTail => {
// This calling convention is LLVM-specific and unspecified.
sess.dcx().fatal("gcc/gccjit backend does not support RustTail calling convention")
}
CanonAbi::RustCold => FnAttribute::Cold,
// Functions with this calling convention can only be called from assembly, but it is
// possible to declare an `extern "custom"` block, so the backend still needs a calling
// convention for declaring foreign functions.
CanonAbi::Custom => return None,
// gcc/gccjit does not have anything for Swift's calling convention.
CanonAbi::Swift => panic!("gcc/gccjit backend does not support Swift calling convention"),
CanonAbi::Swift => {
// gcc/gccjit does not have anything for Swift's calling convention.
sess.dcx().fatal("gcc/gccjit backend does not support Swift calling convention")
}
CanonAbi::Arm(arm_call) => match arm_call {
ArmCall::CCmseNonSecureCall => FnAttribute::ArmCmseNonsecureCall,
ArmCall::CCmseNonSecureEntry => FnAttribute::ArmCmseNonsecureEntry,
ArmCall::Aapcs => FnAttribute::ArmPcs("aapcs"),
},
CanonAbi::GpuKernel => match arch {
CanonAbi::GpuKernel => match &sess.target.arch {
&Arch::AmdGpu => FnAttribute::GcnAmdGpuHsaKernel,
&Arch::Nvptx64 => FnAttribute::NvptxKernel,
arch => panic!("Arch {arch} does not support GpuKernel calling convention"),
arch => sess
.dcx()
.fatal(format!("Arch {arch} does not support GpuKernel calling convention")),
},
// FIXME(antoyo): check if those AVR attributes are mapped correctly.
CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind {
Expand Down
15 changes: 15 additions & 0 deletions src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
unreachable!("clobber-only")
}
InlineAsmRegClass::Amdgpu(AmdgpuInlineAsmRegClass::Sgpr(_)) => "Sg",
InlineAsmRegClass::Amdgpu(AmdgpuInlineAsmRegClass::Vgpr(_)) => "v",
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::reg) => "r",
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::sreg)
| InlineAsmRegClass::Arm(ArmInlineAsmRegClass::dreg_low16)
Expand Down Expand Up @@ -764,6 +766,11 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
| X86InlineAsmRegClass::mmx_reg
| X86InlineAsmRegClass::tmm_reg,
) => unreachable!("clobber-only"),
InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::reg) => "r",
InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::freg) => "f",
InlineAsmRegClass::Xtensa(
XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg,
) => unreachable!("clobber-only"),
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
bug!("GCC backend does not support SPIR-V")
}
Expand Down Expand Up @@ -793,6 +800,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
unreachable!("clobber-only")
}
InlineAsmRegClass::Amdgpu(_) => cx.type_i32(),
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::sreg)
| InlineAsmRegClass::Arm(ArmInlineAsmRegClass::sreg_low16) => cx.type_f32(),
Expand Down Expand Up @@ -885,6 +893,11 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
bug!("GCC backend does not support SPIR-V")
}
InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::freg) => cx.type_f32(),
InlineAsmRegClass::Xtensa(
XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg,
) => unreachable!("clobber-only"),
InlineAsmRegClass::Err => unreachable!(),
}
}
Expand Down Expand Up @@ -996,6 +1009,7 @@ fn modifier_to_gcc(
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
unreachable!("clobber-only")
}
InlineAsmRegClass::Amdgpu(_) => None,
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::reg) => None,
InlineAsmRegClass::Arm(ArmInlineAsmRegClass::sreg)
| InlineAsmRegClass::Arm(ArmInlineAsmRegClass::sreg_low16) => None,
Expand Down Expand Up @@ -1083,6 +1097,7 @@ fn modifier_to_gcc(
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
bug!("LLVM backend does not support SPIR-V")
}
InlineAsmRegClass::Xtensa(_) => None,
InlineAsmRegClass::Err => unreachable!(),
}
}
7 changes: 6 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
loaded_value.to_rvalue()
}

fn volatile_load(&mut self, ty: Type<'gcc>, ptr: RValue<'gcc>) -> RValue<'gcc> {
fn volatile_load(&mut self, ty: Type<'gcc>, ptr: RValue<'gcc>, _: Align) -> RValue<'gcc> {
// FIXME(antoyo): set alignment.
let ptr = self.context.new_cast(self.location, ptr, ty.make_volatile().make_pointer());
// (FractalFir): We insert a local here, to ensure this volatile load can't move across
// blocks.
Expand Down Expand Up @@ -1479,6 +1480,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
);
}

fn vscale(&mut self, _: Self::Type) -> Self::Value {
unimplemented!("`rustc_codegen_gcc` doesn't support scalable vectors yet")
}

fn select(
&mut self,
cond: RValue<'gcc>,
Expand Down
18 changes: 10 additions & 8 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) ->
let context = &cx.context;
let byte_type = context.new_type::<u64>();
let typ = new_array_type(context, None, byte_type, bytes.len() as u64 / 8);
let elements: Vec<_> = bytes
.chunks_exact(8)
.map(|arr| {
let arr: [u8; 8] = arr.try_into().unwrap();
let (arrays, remainder) = bytes.as_chunks::<8>();
debug_assert!(remainder.is_empty());
let elements: Vec<_> = arrays
.iter()
.map(|&arr| {
context.new_rvalue_from_long(
byte_type,
// Since we are representing arbitrary byte runs as integers, we need to follow the target
Expand All @@ -82,10 +83,11 @@ pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) ->
let context = &cx.context;
let byte_type = context.new_type::<u32>();
let typ = new_array_type(context, None, byte_type, bytes.len() as u64 / 4);
let elements: Vec<_> = bytes
.chunks_exact(4)
.map(|arr| {
let arr: [u8; 4] = arr.try_into().unwrap();
let (arrays, remainder) = bytes.as_chunks::<4>();
debug_assert!(remainder.is_empty());
let elements: Vec<_> = arrays
.iter()
.map(|&arr| {
context.new_rvalue_from_int(
byte_type,
match cx.sess().target.options.endian {
Expand Down
8 changes: 4 additions & 4 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ impl<'gcc, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
let entry_name = self.sess().target.entry_name.as_ref();
if !self.functions.borrow().contains_key(entry_name) {
#[cfg(feature = "master")]
let conv = conv_to_fn_attribute(self.sess().target.entry_abi, &self.sess().target.arch);
#[cfg(not(feature = "master"))]
let conv = None;
let conv = cfg_select! {
feature = "master" => conv_to_fn_attribute(self.sess(), self.sess().target.entry_abi),
_ => None,
};
Some(self.declare_entry_fn(entry_name, fn_type, conv))
} else {
// If the symbol already exists, it is an error: for example, the user wrote
Expand Down
Loading
Loading