File: aarch64-streaming-sve-vector-conversions.cpp

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (69 lines) | stat: -rw-r--r-- 3,024 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme -mvscale-min=1 -mvscale-max=1 -mvscale-streaming-min=2 -mvscale-streaming-max=2 -flax-vector-conversions=integer -ffreestanding -fsyntax-only -verify %s
// REQUIRES: aarch64-registered-target

#include <arm_sve.h>

#define SVE_BITS 128
#define SVE_FIXED_ATTR __attribute__((arm_sve_vector_bits(SVE_BITS)))
#define GNU_FIXED_ATTR __attribute__((vector_size(SVE_BITS / 8)))
#define GNU_BOOL_FIXED_ATTR __attribute__((vector_size(SVE_BITS / 64)))
#define STREAMING_BITS 256
#define GNU_FIXED_STREAMING_ATTR __attribute__((vector_size(STREAMING_BITS / 8)))
#define GNU_BOOL_FIXED_STREAMING_ATTR __attribute__((vector_size(STREAMING_BITS / 64)))

typedef svfloat32_t sve_fixed_float32_t SVE_FIXED_ATTR;
typedef svint32_t sve_fixed_int32_t SVE_FIXED_ATTR;
typedef svbool_t sve_fixed_bool_t SVE_FIXED_ATTR;
typedef float gnu_fixed_float32_t GNU_FIXED_ATTR;
typedef int gnu_fixed_int32_t GNU_FIXED_ATTR;
typedef int8_t gnu_fixed_bool_t GNU_BOOL_FIXED_ATTR;

typedef float gnu_fixed_float32_t_streaming GNU_FIXED_STREAMING_ATTR;
typedef int gnu_fixed_int32_t_streaming GNU_FIXED_STREAMING_ATTR;
typedef int8_t gnu_fixed_bool_t_streaming GNU_BOOL_FIXED_STREAMING_ATTR;

void sve_fixed() {
  gnu_fixed_int32_t fi;
  gnu_fixed_float32_t_streaming fi_wrong;
  gnu_fixed_float32_t ff;
  gnu_fixed_float32_t_streaming ff_wrong;
  gnu_fixed_bool_t fb;
  gnu_fixed_bool_t_streaming fb_wrong;
  *(volatile svint32_t*)0 = fi;
  *(volatile svint32_t*)0 = fi_wrong; // expected-error {{incompatible}}
  *(volatile svfloat32_t*)0 = ff;
  *(volatile svfloat32_t*)0 = ff_wrong; // expected-error {{incompatible}}
  *(volatile svbool_t*)0 = fb;
  *(volatile svbool_t*)0 = fb_wrong; // expected-error {{incompatible}}
}

__arm_locally_streaming void streaming_fixed() {
  gnu_fixed_int32_t_streaming fi;
  gnu_fixed_float32_t fi_wrong;
  gnu_fixed_float32_t_streaming ff;
  gnu_fixed_float32_t ff_wrong;
  gnu_fixed_bool_t_streaming fb;
  gnu_fixed_bool_t fb_wrong;
  *(volatile svint32_t*)0 = fi;
  *(volatile svint32_t*)0 = fi_wrong; // expected-error {{incompatible}}
  *(volatile svfloat32_t*)0 = ff;
  *(volatile svfloat32_t*)0 = ff_wrong; // expected-error {{incompatible}}
  *(volatile svbool_t*)0 = fb;
  *(volatile svbool_t*)0 = fb_wrong; // expected-error {{incompatible}}
}

void streaming_compatible() __arm_streaming_compatible {
  gnu_fixed_int32_t fi_ns;
  gnu_fixed_float32_t_streaming fi_s;
  gnu_fixed_float32_t ff_ns;
  gnu_fixed_float32_t_streaming ff_s;
  gnu_fixed_bool_t fb_ns;
  gnu_fixed_bool_t_streaming fb_s;
  *(volatile svint32_t*)0 = fi_ns; // expected-error {{incompatible}}
  *(volatile svint32_t*)0 = fi_s; // expected-error {{incompatible}}
  *(volatile svfloat32_t*)0 = ff_ns; // expected-error {{incompatible}}
  *(volatile svfloat32_t*)0 = ff_s; // expected-error {{incompatible}}
  *(volatile svbool_t*)0 = fb_ns; // expected-error {{incompatible}}
  *(volatile svbool_t*)0 = fb_s; // expected-error {{incompatible}}
}