brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · bc731f9 Raw
99 lines · c
1// RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=8 -mvscale-max=8 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify=lax-vector-none %s2// RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=8 -mvscale-max=8 -flax-vector-conversions=integer -ffreestanding -fsyntax-only -verify=lax-vector-integer %s3// RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=8 -mvscale-max=8 -flax-vector-conversions=all -ffreestanding -fsyntax-only -verify=lax-vector-all %s4 5// REQUIRES: riscv-registered-target6 7#define RVV_FIXED_ATTR __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)))8#define GNU_FIXED_ATTR __attribute__((vector_size(__riscv_v_fixed_vlen / 8)))9 10typedef __rvv_int8m1_t vint8m1_t;11typedef __rvv_uint8m1_t vuint8m1_t;12typedef __rvv_int16m1_t vint16m1_t;13typedef __rvv_uint16m1_t vuint16m1_t;14typedef __rvv_int32m1_t vint32m1_t;15typedef __rvv_uint32m1_t vuint32m1_t;16typedef __rvv_int64m1_t vint64m1_t;17typedef __rvv_uint64m1_t vuint64m1_t;18typedef __rvv_float32m1_t vfloat32m1_t;19typedef __rvv_float64m1_t vfloat64m1_t;20 21typedef __rvv_int64m2_t vint64m2_t;22 23typedef vfloat32m1_t rvv_fixed_float32m1_t RVV_FIXED_ATTR;24typedef vint32m1_t rvv_fixed_int32m1_t RVV_FIXED_ATTR;25typedef float gnu_fixed_float32m1_t GNU_FIXED_ATTR;26typedef int gnu_fixed_int32m1_t GNU_FIXED_ATTR;27 28void rvv_allowed_with_integer_lax_conversions() {29  rvv_fixed_int32m1_t fi32;30  vint64m1_t si64;31 32  // The implicit cast here should fail if -flax-vector-conversions=none, but pass if33  // -flax-vector-conversions={integer,all}.34  fi32 = si64;35  // lax-vector-none-error@-1 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}36  // lax-vector-integer-error@-2 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}37  // lax-vector-all-error@-3 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}38  si64 = fi32;39  // lax-vector-none-error@-1 {{assigning to 'vint64m1_t' (aka '__rvv_int64m1_t') from incompatible type}}40  // lax-vector-integer-error@-2 {{assigning to 'vint64m1_t' (aka '__rvv_int64m1_t') from incompatible type}}41  // lax-vector-all-error@-3 {{assigning to 'vint64m1_t' (aka '__rvv_int64m1_t') from incompatible type}}42}43 44void rvv_allowed_with_all_lax_conversions() {45  rvv_fixed_float32m1_t ff32;46  vfloat64m1_t sf64;47 48  // The implicit cast here should fail if -flax-vector-conversions={none,integer}, but pass if49  // -flax-vector-conversions=all.50  ff32 = sf64;51  // lax-vector-none-error@-1 {{assigning to 'rvv_fixed_float32m1_t' (vector of 16 'float' values) from incompatible type}}52  // lax-vector-integer-error@-2 {{assigning to 'rvv_fixed_float32m1_t' (vector of 16 'float' values) from incompatible type}}53  // lax-vector-all-error@-3 {{assigning to 'rvv_fixed_float32m1_t' (vector of 16 'float' values) from incompatible type}}54  sf64 = ff32;55  // lax-vector-none-error@-1 {{assigning to 'vfloat64m1_t' (aka '__rvv_float64m1_t') from incompatible type}}56  // lax-vector-integer-error@-2 {{assigning to 'vfloat64m1_t' (aka '__rvv_float64m1_t') from incompatible type}}57  // lax-vector-all-error@-3 {{assigning to 'vfloat64m1_t' (aka '__rvv_float64m1_t') from incompatible type}}58}59 60void gnu_allowed_with_integer_lax_conversions() {61  gnu_fixed_int32m1_t fi32;62  vint64m1_t si64;63 64  // The implicit cast here should fail if -flax-vector-conversions=none, but pass if65  // -flax-vector-conversions={integer,all}.66  fi32 = si64;67  // lax-vector-none-error@-1 {{assigning to 'gnu_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}68  si64 = fi32;69  // lax-vector-none-error@-1 {{assigning to 'vint64m1_t' (aka '__rvv_int64m1_t') from incompatible type}}70}71 72void gnu_allowed_with_all_lax_conversions() {73  gnu_fixed_float32m1_t ff32;74  vfloat64m1_t sf64;75 76  // The implicit cast here should fail if -flax-vector-conversions={none,integer}, but pass if77  // -flax-vector-conversions=all.78  ff32 = sf64;79  // lax-vector-none-error@-1 {{assigning to 'gnu_fixed_float32m1_t' (vector of 16 'float' values) from incompatible type}}80  // lax-vector-integer-error@-2 {{assigning to 'gnu_fixed_float32m1_t' (vector of 16 'float' values) from incompatible type}}81  sf64 = ff32;82  // lax-vector-none-error@-1 {{assigning to 'vfloat64m1_t' (aka '__rvv_float64m1_t') from incompatible type}}83  // lax-vector-integer-error@-2 {{assigning to 'vfloat64m1_t' (aka '__rvv_float64m1_t') from incompatible type}}84}85 86void not_allowed() {87  rvv_fixed_int32m1_t fi32m1;88  vint64m2_t si64m2;89 90  fi32m1 = si64m2;91  // lax-vector-none-error@-1 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}92  // lax-vector-integer-error@-2 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}93  // lax-vector-all-error@-3 {{assigning to 'rvv_fixed_int32m1_t' (vector of 16 'int' values) from incompatible type}}94  si64m2 = fi32m1;95  // lax-vector-none-error@-1 {{assigning to 'vint64m2_t' (aka '__rvv_int64m2_t') from incompatible type}}96  // lax-vector-integer-error@-2 {{assigning to 'vint64m2_t' (aka '__rvv_int64m2_t') from incompatible type}}97  // lax-vector-all-error@-3 {{assigning to 'vint64m2_t' (aka '__rvv_int64m2_t') from incompatible type}}98}99