| 1 |
/* PR target/102252. */ |
| 2 |
/* { dg-do assemble { target aarch64_asm_sve_ok } } */ |
| 3 |
/* { dg-options "-march=armv8.2-a+sve -msve-vector-bits=512" } */ |
| 4 |
|
| 5 |
/* We used to generate invalid assembly for SVE predicate loads. */ |
| 6 |
|
| 7 |
#include <arm_sve.h> |
| 8 |
|
| 9 |
class SimdBool |
| 10 |
{ |
| 11 |
private: |
| 12 |
typedef svbool_t simdInternalType_ __attribute__((arm_sve_vector_bits(512))); |
| 13 |
|
| 14 |
public: |
| 15 |
SimdBool() {} |
| 16 |
|
| 17 |
simdInternalType_ simdInternal_; |
| 18 |
|
| 19 |
}; |
| 20 |
|
| 21 |
static svfloat32_t selectByMask(svfloat32_t a, SimdBool m) { |
| 22 |
return svsel_f32(m.simdInternal_, a, svdup_f32(0.0)); |
| 23 |
} |
| 24 |
|
| 25 |
struct s { |
| 26 |
SimdBool array[1]; |
| 27 |
}; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
void foo(struct s* const work, int offset) |
| 32 |
{ |
| 33 |
svfloat32_t tz_S0; |
| 34 |
|
| 35 |
tz_S0 = selectByMask(tz_S0, work->array[offset]); |
| 36 |
} |
| 37 |
|