(item1, item2)
| 5050 | # `arith::CmpIPredicate` and `arith::CmpFPredicate`. |
| 5051 | |
| 5052 | def compare_equality(item1, item2): |
| 5053 | |
| 5054 | # TODO: the In/NotIn case should be recursive such that we can |
| 5055 | # search for a list in a list of lists. |
| 5056 | # `mz(q1) == mz(q2)` (or with one side being a handle and the |
| 5057 | # other a `bool`): discriminate each handle to `i1` first and let |
| 5058 | # `convert_arithmetic_types` finish the integer comparison. |
| 5059 | item1 = self.__discriminateIfMeasureHandle(item1, node) |
| 5060 | item2 = self.__discriminateIfMeasureHandle(item2, node) |
| 5061 | item1, item2 = convert_arithmetic_types(item1, item2) |
| 5062 | iCondPred = self.getIntegerAttr(iTy, 0) |
| 5063 | fCondPred = self.getIntegerAttr(iTy, 1) |
| 5064 | |
| 5065 | if ComplexType.isinstance(item1.type): |
| 5066 | reComp = arith.CmpFOp(fCondPred, |
| 5067 | complex.ReOp(item1).result, |
| 5068 | complex.ReOp(item2).result).result |
| 5069 | imComp = arith.CmpFOp(fCondPred, |
| 5070 | complex.ImOp(item1).result, |
| 5071 | complex.ImOp(item2).result).result |
| 5072 | return arith.AndIOp(reComp, imComp).result |
| 5073 | elif IntegerType.isinstance(item1.type): |
| 5074 | return arith.CmpIOp(iCondPred, item1, item2).result |
| 5075 | else: |
| 5076 | return arith.CmpFOp(fCondPred, item1, item2).result |
| 5077 | |
| 5078 | if isinstance(op, ast.Gt): |
| 5079 | left, right = convert_arithmetic_types(left, right) |
nothing calls this directly
no test coverage detected