Skip to content
Permalink
Browse files

Add support for non-decomposed complex operations

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 7a7aae1ad0e2aa0501ddea11d8b2def8eb924bdd
Showing with 34 additions and 1 deletion.
  1. +2 −0 tools/flang2/docs/xflag.n
  2. +2 −1 tools/flang2/flang2exe/ll_structure.h
  3. +30 −0 tools/flang2/flang2exe/ll_write.cpp
@@ -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.
@@ -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 */
@@ -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";
}
@@ -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:
@@ -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;

0 comments on commit 7a7aae1

Please sign in to comment.
You can’t perform that action at this time.