Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit d76def2

Browse files
committed
[WIP]
1 parent 63546a9 commit d76def2

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

cranelift-codegen/meta-python/base/instructions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@
20122012

20132013
WideInt = TypeVar(
20142014
'WideInt', 'An integer type with lanes from `i16` upwards',
2015-
ints=(16, 64), simd=True)
2015+
ints=(16, 128), simd=True)
20162016
x = Operand('x', WideInt)
20172017
lo = Operand(
20182018
'lo', WideInt.half_width(), 'The low bits of `x`')
@@ -2033,8 +2033,8 @@
20332033

20342034

20352035
NarrowInt = TypeVar(
2036-
'NarrowInt', 'An integer type with lanes type to `i32`',
2037-
ints=(8, 32), simd=True)
2036+
'NarrowInt', 'An integer type with lanes type to `i64`',
2037+
ints=(8, 64), simd=True)
20382038
lo = Operand('lo', NarrowInt)
20392039
hi = Operand('hi', NarrowInt)
20402040
a = Operand(

cranelift-codegen/src/ir/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use target_lexicon::{PointerWidth, Triple};
1010
/// field is present put no type is needed, such as the controlling type variable for a
1111
/// non-polymorphic instruction.
1212
///
13-
/// Basic integer types: `I8`, `I16`, `I32`, and `I64`. These types are sign-agnostic.
13+
/// Basic integer types: `I8`, `I16`, `I32`, `I64`, and `I128`. These types are sign-agnostic.
1414
///
1515
/// Basic floating point types: `F32` and `F64`. IEEE single and double precision.
1616
///

cranelift-codegen/src/legalizer/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ fn legalize_inst(
5656
}
5757
} else if opcode.is_branch() {
5858
split::simplify_branch_arguments(&mut pos.func.dfg, inst);
59+
} else if opcode == ir::Opcode::Isplit {
60+
dbg!(());
61+
pos.use_srcloc(inst);
62+
63+
let arg = match pos.func.dfg[inst] {
64+
ir::InstructionData::Unary {
65+
arg,
66+
..
67+
} => pos.func.dfg.resolve_aliases(arg),
68+
_ => panic!("Expected isplit: {}", pos.func.dfg.display_inst(inst, None)),
69+
};
70+
71+
let res = pos.func.dfg.inst_results(inst).to_vec();
72+
assert_eq!(res.len(), 2);
73+
let (resl, resh) = (res[0], res[1]); // Prevent borrowck error
74+
75+
let curpos = pos.position();
76+
let srcloc = pos.srcloc();
77+
let (xl, xh) = split::isplit(pos.func, cfg, curpos, srcloc, arg);
78+
79+
println!("{}", pos.func);
80+
dbg!((xl, xh, resl, resh));
81+
82+
pos.func.dfg.clear_results(inst);
83+
pos.remove_inst();
84+
pos.func.dfg.change_to_alias(resl, xl);
85+
pos.func.dfg.change_to_alias(resh, xh);
86+
println!("{}", pos.func);
87+
return true;
5988
}
6089

6190
match pos.func.update_encoding(inst, isa) {

filetests/isa/x86/i128.clif

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
test compile
22
target x86_64
33

4-
function u0:0(i128) -> i128 fast {
5-
ebb0(v0: i128):
6-
v1 = iconst.i64 0
4+
function u0:0(i64, i64) -> i128, i64, i64 fast {
5+
ebb0(v0: i64, v1: i64):
76
v2 = iconst.i64 42
8-
v3 = iconcat.i64 v2, v1
9-
return v3
7+
v3 = iconst.i64 0
8+
v4 = iconcat.i64 v2, v3
9+
return v4, v0, v1
1010
; check: v1 = iconst.i64 0
1111
; check: v2 = iconst.i64 42
1212
; check: return v2, v1, v7

0 commit comments

Comments
 (0)