Commit 543a4b68 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64: Simplify input requirement selection in gen_compare_swap().

parent 0791264b
......@@ -2950,26 +2950,20 @@ static ir_node *gen_compare_swap(ir_node *const node)
int arity = 0;
amd64_addr_t addr;
perform_address_matching(ptr, &arity, in, &addr);
static arch_register_req_t const **const am_rax_reg_mem_reqs[] = {
rax_reg_mem_reqs,
reg_rax_reg_mem_reqs,
reg_reg_rax_reg_mem_reqs,
};
assert((size_t)arity < ARRAY_SIZE(am_rax_reg_mem_reqs));
arch_register_req_t const **const reqs = am_rax_reg_mem_reqs[arity];
in[arity++] = new_old;
int new_input = arity;
in[arity++] = new_new;
in[arity++] = new_mem;
arch_register_req_t const **reqs;
switch (arity) {
case 3:
reqs = rax_reg_mem_reqs;
break;
case 4:
reqs = reg_rax_reg_mem_reqs;
break;
case 5:
reqs = reg_reg_rax_reg_mem_reqs;
break;
default:
panic("gen_compare_swap: Unexpected arity %d", arity);
}
amd64_binop_addr_attr_t const attr = {
.base = {
.base = {
......
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