Skip to content

Commit

Permalink
Add support for non-decomposed complex operations
Browse files Browse the repository at this point in the history
Added xbit 201 0x4000000 in order to control alignment
assumption for complex arrays. When enabled, it is
assumed that single complex arrays are 8-byte aligned
and that double complex arrays are 16-byte aligned.
  • Loading branch information
gklimowicz committed Sep 3, 2019
1 parent 5625686 commit 7a7aae1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tools/flang2/docs/xflag.n
Expand Up @@ -5282,6 +5282,8 @@ but the innermost loop ones.
.XB 0x1000000:
Only find ACIV induction variables for innermost loops.
reserved
.XB 0x2000000:
Assume that complex arrays on GPU are aligned as follows: complex:8-byte dcmplx:16-byte

.XF "202:"
Set number of bigbuffers for multi-buffer memory management for AMD GPU.
Expand Down
3 changes: 2 additions & 1 deletion tools/flang2/flang2exe/ll_structure.h
Expand Up @@ -40,7 +40,8 @@ typedef enum LL_Op {
LL_ICMP, LL_FCMP, LL_BR, LL_UBR, LL_SELECT,
LL_GEP, LL_BITCAST, LL_INTTOPTR, LL_PTRTOINT, LL_ALLOCA,
LL_TEXTCALL, LL_UNREACHABLE, LL_SWITCH, LL_EXTRACTVALUE, LL_INSERTVALUE,
LL_ATOMICRMW, LL_CMPXCHG, LL_ASM, LL_NONE
LL_ATOMICRMW, LL_CMPXCHG, LL_ASM, LL_EXTRACTELEM, LL_INSERTELEM,
LL_FNEG, LL_NONE
} LL_Op;

/* clang-format on */
Expand Down
30 changes: 30 additions & 0 deletions tools/flang2/flang2exe/ll_write.cpp
Expand Up @@ -185,6 +185,14 @@ get_op_name(enum LL_Op op)
return "cmpxchg";
case LL_EXTRACTVALUE:
return "extractvalue";
case LL_INSERTVALUE:
return "insertvalue";
case LL_EXTRACTELEM:
return "extractelement";
case LL_INSERTELEM:
return "insertelement";
case LL_FNEG:
return "fneg";
default:
return "thisisnotacceptable";
}
Expand Down Expand Up @@ -450,6 +458,23 @@ ll_write_instruction(FILE *out, LL_Instruction *inst, LL_Module *module, int no_
inst->operands[1]->type_struct->str, inst->operands[1]->data,
inst->operands[2]->data);
} break;
case LL_INSERTVALUE: {
fprintf(out, "%s%s = %s %s %s, %s %s, %s", SPACES, inst->operands[0]->data, opname,
inst->operands[1]->type_struct->str, inst->operands[1]->data,
inst->operands[2]->type_struct->str, inst->operands[2]->data,
inst->operands[3]->data);
} break;
case LL_EXTRACTELEM: {
fprintf(out, "%s%s = %s %s %s, %s %s", SPACES, inst->operands[0]->data, opname,
inst->operands[1]->type_struct->str, inst->operands[1]->data,
inst->operands[2]->type_struct->str, inst->operands[2]->data);
} break;
case LL_INSERTELEM: {
fprintf(out, "%s%s = %s %s %s, %s %s, %s %s", SPACES, inst->operands[0]->data, opname,
inst->operands[1]->type_struct->str, inst->operands[1]->data,
inst->operands[2]->type_struct->str, inst->operands[2]->data,
inst->operands[3]->type_struct->str, inst->operands[3]->data);
} break;
case LL_ADD:
case LL_FADD:
case LL_SUB:
Expand All @@ -472,6 +497,11 @@ ll_write_instruction(FILE *out, LL_Instruction *inst, LL_Module *module, int no_
inst->operands[1]->type_struct->str, inst->operands[1]->data,
inst->operands[2]->data);
break;
case LL_FNEG:
/* unary ops */
fprintf(out, "%s%s = %s %s %s", SPACES, inst->operands[0]->data, opname,
inst->operands[1]->type_struct->str, inst->operands[1]->data);
break;
case LL_STORE:
render_store(out, inst);
break;
Expand Down

0 comments on commit 7a7aae1

Please sign in to comment.