<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63942>63942</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM fails to use 8-bit high register for store when there are multiple users
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MatzeB
</td>
</tr>
</table>
<pre>
Reproducer:
```
struct data {
char a;
char b;
};
void store_high_8_one(char *dst0, char *dst1, struct data d) {
// Uses %dh as expected...
*dst0 = d.b;
}
void store_high_8_two(char *dst0, char *dst1, struct data d) {
// Uses separate shift instead of %dh...
*dst0 = d.b;
*dst1 = d.b;
}
```
Results in:
```
store_high_8_one: # @store_high_8_one
movb %dh, (%rdi)
retq
store_high_8_two: # @store_high_8_two
shrl $8, %edx
movb %dl, (%rdi)
movb %dl, (%rsi)
retq
```
Where the 2nd function could simply use %dh for both stores instead of the separate "shrl" instruction.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE2PszgM_jXmYg0CU74OHDpb9fTOZaT9uI0CcZvspqSbhPnYX78KVO1Mp9VqpTdCQMxj-_FjE-G93o_MHZSPUG4SMQVlXfckwj_8mPRWfnTPfHRWTgM7KNaQbSBbQ5Wdrnnrg5uGgFIEgVA_LkZExEEJhwKKa1N_NkG9Ob-_Wi3RB-v4Rem9emle7MhAzewCtJY-ZEC_4Kd9Hvef00ug9isHoC3QFn_17BGolAqFR34_8hBYpml6Qp7iIxQblOlXgnfYhTf7U9l5PgonAqNXehdQjz6wkGh3C-8L19nvNt3Lt_x-KVftW-7P7CcTPOrx0ubbzb5qUDEnvbGACoRV9s3hTDSug33tF3ApVdQLqAEqndRA7QnqOPx9I3nU_38ljw5LRK-cWVCrZklasny_z8zcYfYfUP8deqnlStffFTvGoBhplLibxiFoO-JgJyPR68PRfODk-TTDO-uwt0EtE-k_D0sMcR4lIIq1AtEMiaOo7ZgmsitkW7Qi4S6vmramsiFKVNc2AzdVz7Ws86GkoW65JSmoJLFqsooT3VFGRVbnbZbldUYp5VzSrqqkGGiXtyWsMj4IbVJjXg-pdftEez9xVxXtihIjejZ-Pm2IejH8xaOEYv1HUwFRPIBcF_0e-mnvYZUZ7YO_RAo6GO5-_PjtCXdCG4_Bzpo0D70OGLuMjvfaB3azQrM4-KZ4jKo4RuEYD5MJ-mg4ejqfTM50KoSjj2M__417HdTUp4M9AG1j7tPj4ejsnzwEoO1ckgfazlX9GwAA__8Bp4H7">