Commit c035382e authored by Tobias Rapp's avatar Tobias Rapp
Browse files

amd64: Sbb operation includes dependency to eflags

parent 6ba19c65
......@@ -282,12 +282,11 @@ Sub => {
},
Sbb => {
#TODO: Should consume flags
state => "exc_pinned",
reg_req => { in => [ "gp", "gp" ],
reg_req => { in => [ "gp", "gp", "flags" ],
out => [ "gp", "flags", "none" ] },
outs => [ "res", "flags", "M" ],
ins => [ "minuend", "subtrahend" ],
ins => [ "minuend", "subtrahend", "eflags" ],
attr_type => "amd64_binop_addr_attr_t",
attr => "const amd64_binop_addr_attr_t *attr_init",
emit => "sbb%M %S1, %D0",
......
......@@ -59,6 +59,24 @@ static const arch_register_req_t amd64_requirement_gp = {
NULL,
0,
0,
0
};
static const arch_register_req_t amd64_requirement_flags = {
arch_register_req_type_normal,
&amd64_reg_classes[CLASS_amd64_flags],
NULL,
0,
0,
1
};
static const arch_register_req_t amd64_requirement_xmm = {
arch_register_req_type_normal,
&amd64_reg_classes[CLASS_amd64_xmm],
NULL,
0,
0,
1
};
......@@ -135,6 +153,12 @@ static const arch_register_req_t *reg_reg_reg_mem_reqs[] = {
&arch_no_requirement,
};
static const arch_register_req_t *reg_reg_flags_reqs[] = {
&amd64_requirement_gp,
&amd64_requirement_gp,
&amd64_requirement_flags,
};
static const arch_register_req_t *reg_reg_reqs[] = {
&amd64_requirement_gp,
&amd64_requirement_gp,
......@@ -2026,18 +2050,17 @@ static ir_node *gen_saturating_increment(ir_node *node)
set_irn_mode(inc, mode_T);
ir_node *value = new_rd_Proj(dbgi, inc, mode_gp, pn_amd64_Add_res);
ir_node *const zero = new_bd_amd64_Xor0(dbgi, new_block);
ir_node *eflags = new_rd_Proj(dbgi, inc, mode_flags, pn_amd64_Add_flags);
ir_node *zero = new_bd_amd64_Xor0(dbgi, new_block);
amd64_binop_addr_attr_t sbb_attr;
memset(&sbb_attr, 0, sizeof(sbb_attr));
sbb_attr.base.base.op_mode = AMD64_OP_REG_REG;
//TODO: Sbb should consume flags, but can't currently
ir_node *sbb = new_bd_amd64_Sbb(dbgi, new_block, value, zero,
ir_node *sbb = new_bd_amd64_Sbb(dbgi, new_block, value, zero, eflags,
&sbb_attr);
arch_set_irn_register_reqs_in(sbb, reg_reg_reqs);
arch_set_irn_register_reqs_in(sbb, reg_reg_flags_reqs);
return sbb;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment