<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97782>97782</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ARM][BUG] Run bad result for vect_type in arm32be
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hstk30-hw
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/vYKsfos5o
```
typedef short int SV __attribute__((vector_size(16)));
extern void abort(void);
__attribute__((noinline)) void vec_div(SV *x, SV *y)
{
*x = *y / ((SV){1, 4, 2, 8, 16, 64, 32, 128});
}
SV s[] = {
((SV){73, -9123, 32761, 8191, 16371, 1201, 12701, 9999}),
((SV){9903, -1, -7323, 0, -7, -323, 9124, -9199})
};
int main()
{
SV sr, sr2;
int i;
for (i = 0; i < sizeof(s) / sizeof(s[0]); i++) {
vec_div(&sr, s + i);
if (sr[0] != s[i][0] / 1 || sr[3] != s[i][3] / 8)
abort();
asm volatile("" : : "r"(&sr) : "memory");
}
return 0;
}
```
The expected `sr` is ```[73, -2280, 16380, 1023, 1023, 18, 396, 78]```
the result is ```[-2280, 73, 1023, 16380, 18, 1023, 78, 396]```
I guess `rev` instruction is misused.
(The vectorize for big endian mode in llvm use `rev` to handle byte ordering, and introduces many `rev` instrution, also some bugs.
https://llvm.org/docs/BigEndianNEON.html)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVU1v4zYT_jX0ZRCDGtmmdPAhjtcvXhTdAps2QE-GJE4stpIYkJR3vb--GFJ2rGwMeUQNh88880Gy8t6cBqKtWO_Eer-oxtBat219-DeXD-33RW31ZduG8OZF_ijwIPBwsrq2XVhadxJ4-CnwcP77N_9q_doKuRfycZIbOT3xM1zeSNMr-Na6AGYI8PwCx2MVgjP1GOh4FFgILM7UBOuO3vwkgUW2EVhOT75LSPQjkBvgbI2GqrYu8Cpr9L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