Skip to content

Commit ed8bd76

Browse files
committed
[cc] aarch64 fixes, CI buff
1 parent 2794c2d commit ed8bd76

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed

.github/workflows/TestingCI.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,24 @@ on:
66

77
env:
88
CARGO_TERM_COLOR: always
9+
RUST_BACKTRACE: 1
910

1011
jobs:
1112
linux-ubuntu:
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v4
16+
- name: System info
17+
run: |
18+
echo "=== Architecture ==="
19+
uname -a
20+
echo "=== CPU ==="
21+
lscpu | head -20
22+
echo "=== Toolchain ==="
23+
rustc --version
24+
cargo --version
25+
cc --version || true
26+
as --version || true
1527
- name: Fetch
1628
run: cargo fetch
1729
- name: Build
@@ -39,9 +51,26 @@ jobs:
3951
with:
4052
path: ~/.cargo/registry/cache
4153
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
54+
- name: System info
55+
run: |
56+
echo "=== Architecture ==="
57+
uname -a
58+
arch
59+
echo "=== Toolchain ==="
60+
rustc --version
61+
cargo --version
62+
cc --version || true
63+
as -version || true
64+
echo "=== Xcode ==="
65+
xcodebuild -version || true
4266
- name: Fetch
4367
run: cargo fetch
4468
- name: Build
4569
run: cargo build --release --verbose
4670
- name: Run tests
4771
run: cargo test --release --verbose
72+
- name: Run cc tests (detailed)
73+
if: failure()
74+
run: |
75+
echo "=== Re-running cc tests with more detail ==="
76+
cargo test --release -p posixutils-cc --verbose -- --nocapture --test-threads=1 2>&1 | head -500

cc/arch/aarch64/codegen.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,14 +3457,25 @@ impl Aarch64CodeGen {
34573457
// Load source to FP register
34583458
self.emit_fp_move(src, VReg::V17, src_size, frame_size);
34593459

3460-
// Convert between float sizes
3460+
// Convert between float sizes if they differ
34613461
// fcvt: convert between single and double precision
3462-
self.push_lir(Aarch64Inst::Fcvt {
3463-
src_size: src_fp_size,
3464-
dst_size: dst_fp_size,
3465-
src: VReg::V17,
3466-
dst: dst_vreg,
3467-
});
3462+
// Note: On Apple Silicon, long double == double (both 64-bit),
3463+
// so skip fcvt when sizes are equal to avoid invalid "fcvt d, d"
3464+
if src_fp_size != dst_fp_size {
3465+
self.push_lir(Aarch64Inst::Fcvt {
3466+
src_size: src_fp_size,
3467+
dst_size: dst_fp_size,
3468+
src: VReg::V17,
3469+
dst: dst_vreg,
3470+
});
3471+
} else if dst_vreg != VReg::V17 {
3472+
// Same size, just move if needed
3473+
self.push_lir(Aarch64Inst::FmovReg {
3474+
size: dst_fp_size,
3475+
src: VReg::V17,
3476+
dst: dst_vreg,
3477+
});
3478+
}
34683479

34693480
if !matches!(&dst_loc, Loc::VReg(v) if *v == dst_vreg) {
34703481
self.emit_fp_move_to_loc(dst_vreg, &dst_loc, dst_size, frame_size);

0 commit comments

Comments
 (0)