Parse select instructions.
This commit is contained in:
@@ -791,6 +791,18 @@ impl<'a> Parser<'a> {
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
InstructionFormat::Select => {
|
||||
let ctrl_arg = try!(self.match_value("expected SSA value control operand"));
|
||||
try!(self.match_token(Token::Comma, "expected ',' between operands"));
|
||||
let true_arg = try!(self.match_value("expected SSA value true operand"));
|
||||
try!(self.match_token(Token::Comma, "expected ',' between operands"));
|
||||
let false_arg = try!(self.match_value("expected SSA value false operand"));
|
||||
InstructionData::Select {
|
||||
opcode: opcode,
|
||||
ty: VOID,
|
||||
args: [ctrl_arg, true_arg, false_arg],
|
||||
}
|
||||
}
|
||||
InstructionFormat::Jump => {
|
||||
// Parse the destination EBB number. Don't translate source to local numbers yet.
|
||||
let ebb_num = try!(self.match_ebb("expected jump destination EBB"));
|
||||
@@ -819,7 +831,6 @@ impl<'a> Parser<'a> {
|
||||
}),
|
||||
}
|
||||
}
|
||||
InstructionFormat::Select |
|
||||
InstructionFormat::InsertLane |
|
||||
InstructionFormat::ExtractLane |
|
||||
InstructionFormat::BranchTable |
|
||||
|
||||
@@ -12,3 +12,9 @@ ebb0:
|
||||
v1 = iconst.i8 6
|
||||
v2 = ishl v0, v1
|
||||
}
|
||||
|
||||
; Polymorphic istruction controlled by second operand.
|
||||
function select() {
|
||||
ebb0(vx0: i32, vx1:i32, vx2: b1):
|
||||
v0 = select vx2, vx0, vx1
|
||||
}
|
||||
|
||||
@@ -9,3 +9,8 @@ ebb0:
|
||||
v1 = iconst.i8 6
|
||||
v2 = ishl v0, v1
|
||||
}
|
||||
|
||||
function select() {
|
||||
ebb0(vx0: i32, vx1: i32, vx2: b1):
|
||||
v0 = select vx2, vx0, vx1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user