Compare ISel

Good day LLVM-Dev,

I hope all are in good health.

We are currently implementing the compare operation for i64 type in our target.

The main difference of the i64 type compare to lower integer types is that it performs a library call instead of generating a compare instruction.

All is good until before ISelDAGToDAG class. We have observed that the difference in a compare operation for i32 and i64 types is that, the 4th DAG node of the BRCOND node is glued for the i32 type and not glued in the i64 type. Please refer to the boxed nodes in the attached DAGs for a better visualization.

Also, upon entering the ISelDAGToDAG class, the i64 type compare library call operation disappeared. I suspect that some optimization between Legalization and ISelDAGToDAG is removing the library call.

The compare operation does not have an ISD opcode, only a target specific ISD opcode, which makes it hard to identify where it is being changed in the target independent source code.

Does anybody know which class between Legalization and ISelDAGToDAG we should look into for this problem? Any kind of information may help.

Also, are there other targets which does a library call for compare operations? This would greatly help us in our study.

Thank you very much in advance! Stay healthy, stay [COVID-19] negative.

Sincerely,

Miguel Inigo J. Manalac

i32_compare_before_isel.pdf (46.9 KB)

i64_compare_before_isel.pdf (55.1 KB)

Good day LLVM-Dev,

I hope all are in good health.

We are currently implementing the compare operation for i64 type in our target.

The main difference of the i64 type compare to lower integer types is that it performs a library call instead of generating a compare instruction.

All is good until before ISelDAGToDAG class. We have observed that the difference in a compare operation for i32 and i64 types is that, the 4th DAG node of the BRCOND node is glued for the i32 type and not glued in the i64 type. Please refer to the DAG nodes in the attached files for a better visualization (Sorry cant attach the whole DAG due to 100kb mailing limit).

Also, upon entering the ISelDAGToDAG class, the i64 type compare library call operation disappeared. I suspect that some optimization between Legalization and ISelDAGToDAG is removing the library call.

The compare operation does not have an ISD opcode, only a target specific ISD opcode, which makes it hard to identify where it is being changed in the target independent source code.

Does anybody know which class between Legalization and ISelDAGToDAG we should look into for this problem? Any kind of information may help.

Also, are there other targets which does a library call for compare operations? This would greatly help us in our study.

Thank you very much in advance! Stay healthy, stay [COVID-19] negative.

Sincerely,

Miguel Inigo J. Manalac

i32_cmp_before_isel.JPG

i64_cmp_before_isel.JPG