Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cranelift: aarch64: fix undefined dest reg in f32x4.splat case. #5987

Merged
merged 1 commit into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 15 additions & 7 deletions cranelift/codegen/src/isa/aarch64/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,22 +416,30 @@ impl Inst {
size
}]
} else if let Some(imm) = widen_32_bit_pattern(pattern, lane_size) {
let tmp = alloc_tmp(types::I64X2);
let mut insts = smallvec![Inst::VecDupImm {
rd: tmp,
imm,
invert: false,
size: VectorSize::Size64x2,
}];
let mut insts = smallvec![];

// TODO: Implement support for 64-bit scalar MOVI; we zero-extend the
// lower 64 bits instead.
if !size.is_128bits() {
let tmp = alloc_tmp(types::I64X2);
insts.push(Inst::VecDupImm {
rd: tmp,
imm,
invert: false,
size: VectorSize::Size64x2,
});
insts.push(Inst::FpuExtend {
rd,
rn: tmp.to_reg(),
size: ScalarSize::Size64,
});
} else {
insts.push(Inst::VecDupImm {
rd,
imm,
invert: false,
size: VectorSize::Size64x2,
});
}

insts
Expand Down
20 changes: 20 additions & 0 deletions cranelift/filetests/filetests/isa/aarch64/issue-5985.clif
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
test compile precise-output
target aarch64

function %a() -> f32x4 system_v {
block0:
v16 = f32const 0x1.fffe00p-126
v25 = splat.f32x4 v16
return v25
}

; VCode:
; block0:
; movi v0.2d, #72056494543077120
; ret
;
; Disassembled:
; block0: ; offset 0x0
; movi v0.2d, #0xffff0000ffff00
; ret