<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/162360>162360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CIR] Upstream pointer subtraction handling
</td>
</tr>
<tr>
<th>Labels</th>
<td>
ClangIR
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andykaylor
</td>
</tr>
</table>
<pre>
### Overview
Upstream support for subtracting pointer values using the `cir.ptr_diff` operation. This will also require upstreaming the code to lower `cir.ptr_diff` to LLVM IR.
### Suggested minimal test case
```
unsigned long long test_ptr_diff(int *a, int* b) {
return a - b;
}
```
### Existing incubator tests
clang/test/CIR/CodeGen/ptrdiff.c
clang/test/CIR/CodeGen/ptrdiff.cpp
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUUk1r3DAQ_TXyZYiRx1_rgw9OUpdASiH9uAbZmrXVaiVXH5vuvy_abLa09FIYxngYvffm8YT3ajFEPatvWX2fiRhW63ph5Om7OGnrssnKU8-wfC34eCR3VPTC-PBl88GROICP22ZdgL114OMUnJiDMgtsVplADo5CR_IQfRqGlYA1fFYu34J7lmq_Zw0Hu5ETQVmTw-dVeXhRWoPQ3oKjH1E5gnihewOZrSQIFrR9IfcvyGDh8fHrB3h4yhkfUl2v-BSXhXwgCQdl1EFoCOQDzMJT2mv4pfgQzdkgCdqa5bWl1ecrEe6UCcBwEAzvQJnAcICJYQesvWV8AHAUojMg4AYmVqYZa-__ovlD3bufyp8NVGaOkwjWnTk948OshVkYjumf4Xj38JS6lfSeDMNxCy6Jyuf_WN22TPal7MpOZNQXbd3tmrZqumztJW-6WuC-qHYVIu1bLoup6pq2lLLb10WmeuRYF5y3yHmFXY4zdk3RSKIdb1tesYrTQSida3085NYtmfI-Ul80WDY802Ii7c_hQ7xLgpNKTEl0fXpyM8XFs4pr5YP_DRJU0OfMpqvqe7hG8S1y1xhaA6swUiuzZNHpfg1h86wcGI4Mx0WFNU75bA8Mx4R--dxszn6jOfl21usZjhfJxx5_BQAA__8TYAWE">