Skip to content

Commit 7a7aae1

Browse files
committed
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.
1 parent 5625686 commit 7a7aae1

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

tools/flang2/docs/xflag.n

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,6 +5282,8 @@ but the innermost loop ones.
52825282
.XB 0x1000000:
52835283
Only find ACIV induction variables for innermost loops.
52845284
reserved
5285+
.XB 0x2000000:
5286+
Assume that complex arrays on GPU are aligned as follows: complex:8-byte dcmplx:16-byte
52855287

52865288
.XF "202:"
52875289
Set number of bigbuffers for multi-buffer memory management for AMD GPU.

tools/flang2/flang2exe/ll_structure.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ typedef enum LL_Op {
4040
LL_ICMP, LL_FCMP, LL_BR, LL_UBR, LL_SELECT,
4141
LL_GEP, LL_BITCAST, LL_INTTOPTR, LL_PTRTOINT, LL_ALLOCA,
4242
LL_TEXTCALL, LL_UNREACHABLE, LL_SWITCH, LL_EXTRACTVALUE, LL_INSERTVALUE,
43-
LL_ATOMICRMW, LL_CMPXCHG, LL_ASM, LL_NONE
43+
LL_ATOMICRMW, LL_CMPXCHG, LL_ASM, LL_EXTRACTELEM, LL_INSERTELEM,
44+
LL_FNEG, LL_NONE
4445
} LL_Op;
4546

4647
/* clang-format on */

tools/flang2/flang2exe/ll_write.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ get_op_name(enum LL_Op op)
185185
return "cmpxchg";
186186
case LL_EXTRACTVALUE:
187187
return "extractvalue";
188+
case LL_INSERTVALUE:
189+
return "insertvalue";
190+
case LL_EXTRACTELEM:
191+
return "extractelement";
192+
case LL_INSERTELEM:
193+
return "insertelement";
194+
case LL_FNEG:
195+
return "fneg";
188196
default:
189197
return "thisisnotacceptable";
190198
}
@@ -450,6 +458,23 @@ ll_write_instruction(FILE *out, LL_Instruction *inst, LL_Module *module, int no_
450458
inst->operands[1]->type_struct->str, inst->operands[1]->data,
451459
inst->operands[2]->data);
452460
} break;
461+
case LL_INSERTVALUE: {
462+
fprintf(out, "%s%s = %s %s %s, %s %s, %s", SPACES, inst->operands[0]->data, opname,
463+
inst->operands[1]->type_struct->str, inst->operands[1]->data,
464+
inst->operands[2]->type_struct->str, inst->operands[2]->data,
465+
inst->operands[3]->data);
466+
} break;
467+
case LL_EXTRACTELEM: {
468+
fprintf(out, "%s%s = %s %s %s, %s %s", SPACES, inst->operands[0]->data, opname,
469+
inst->operands[1]->type_struct->str, inst->operands[1]->data,
470+
inst->operands[2]->type_struct->str, inst->operands[2]->data);
471+
} break;
472+
case LL_INSERTELEM: {
473+
fprintf(out, "%s%s = %s %s %s, %s %s, %s %s", SPACES, inst->operands[0]->data, opname,
474+
inst->operands[1]->type_struct->str, inst->operands[1]->data,
475+
inst->operands[2]->type_struct->str, inst->operands[2]->data,
476+
inst->operands[3]->type_struct->str, inst->operands[3]->data);
477+
} break;
453478
case LL_ADD:
454479
case LL_FADD:
455480
case LL_SUB:
@@ -472,6 +497,11 @@ ll_write_instruction(FILE *out, LL_Instruction *inst, LL_Module *module, int no_
472497
inst->operands[1]->type_struct->str, inst->operands[1]->data,
473498
inst->operands[2]->data);
474499
break;
500+
case LL_FNEG:
501+
/* unary ops */
502+
fprintf(out, "%s%s = %s %s %s", SPACES, inst->operands[0]->data, opname,
503+
inst->operands[1]->type_struct->str, inst->operands[1]->data);
504+
break;
475505
case LL_STORE:
476506
render_store(out, inst);
477507
break;

0 commit comments

Comments
 (0)