| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mabi=lp64d" } */ |
| 3 |
/* { dg-final { scan-assembler-times "bytepick.w\t\\\$r4,\\\$r5,\\\$r4" 3 } } */ |
| 4 |
/* { dg-final { scan-assembler-times "bytepick.d\t\\\$r4,\\\$r5,\\\$r4" 7 } } */ |
| 5 |
/* { dg-final { scan-assembler-not "slli.w" } } */ |
| 6 |
|
| 7 |
template <class T, int offs> |
| 8 |
T |
| 9 |
merge (T a, T b) |
| 10 |
{ |
| 11 |
return a << offs | b >> (8 * sizeof (T) - offs); |
| 12 |
} |
| 13 |
|
| 14 |
using u32 = __UINT32_TYPE__; |
| 15 |
using u64 = __UINT64_TYPE__; |
| 16 |
using i64 = __INT64_TYPE__; |
| 17 |
|
| 18 |
template u32 merge<u32, 8> (u32, u32); |
| 19 |
template u32 merge<u32, 16> (u32, u32); |
| 20 |
template u32 merge<u32, 24> (u32, u32); |
| 21 |
|
| 22 |
template u64 merge<u64, 8> (u64, u64); |
| 23 |
template u64 merge<u64, 16> (u64, u64); |
| 24 |
template u64 merge<u64, 24> (u64, u64); |
| 25 |
template u64 merge<u64, 32> (u64, u64); |
| 26 |
template u64 merge<u64, 40> (u64, u64); |
| 27 |
template u64 merge<u64, 48> (u64, u64); |
| 28 |
template u64 merge<u64, 56> (u64, u64); |
| 29 |
|
| 30 |
/* we cannot use bytepick for the following cases */ |
| 31 |
template i64 merge<i64, 8> (i64, i64); |
| 32 |
template u64 merge<u64, 42> (u64, u64); |