File: x86-inline-asm-min-vector-width.c

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-16
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,368 kB
  • sloc: cpp: 5,593,980; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (45 lines) | stat: -rw-r--r-- 1,683 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
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-feature +avx512f -o - | FileCheck %s

typedef long long __m128i __attribute__ ((vector_size (16)));
typedef long long __m256i __attribute__ ((vector_size (32)));
typedef long long __m512i __attribute__ ((vector_size (64)));

// CHECK: define{{.*}} <2 x i64> @testXMMout(<2 x i64>* noundef %p) #0
__m128i testXMMout(__m128i *p) {
  __m128i xmm0;
  __asm__("vmovdqu %1, %0" :"=v"(xmm0) : "m"(*(__m128i*)p));
  return xmm0;
}

// CHECK: define{{.*}} <4 x i64> @testYMMout(<4 x i64>* noundef %p) #1
__m256i testYMMout(__m256i *p) {
  __m256i ymm0;
  __asm__("vmovdqu %1, %0" :"=v"(ymm0) : "m"(*(__m256i*)p));
  return ymm0;
}

// CHECK: define{{.*}} <8 x i64> @testZMMout(<8 x i64>* noundef %p) #2
__m512i testZMMout(__m512i *p) {
  __m512i zmm0;
  __asm__("vmovdqu64 %1, %0" :"=v"(zmm0) : "m"(*(__m512i*)p));
  return zmm0;
}

// CHECK: define{{.*}} void @testXMMin(<2 x i64> noundef %xmm0, <2 x i64>* noundef %p) #0
void testXMMin(__m128i xmm0, __m128i *p) {
  __asm__("vmovdqu %0, %1" : : "v"(xmm0), "m"(*(__m128i*)p));
}

// CHECK: define{{.*}} void @testYMMin(<4 x i64> noundef %ymm0, <4 x i64>* noundef %p) #1
void testYMMin(__m256i ymm0, __m256i *p) {
  __asm__("vmovdqu %0, %1" : : "v"(ymm0), "m"(*(__m256i*)p));
}

// CHECK: define{{.*}} void @testZMMin(<8 x i64> noundef %zmm0, <8 x i64>* noundef %p) #2
void testZMMin(__m512i zmm0, __m512i *p) {
  __asm__("vmovdqu64 %0, %1" : : "v"(zmm0), "m"(*(__m512i*)p));
}

// CHECK: attributes #0 = {{.*}}"min-legal-vector-width"="128"
// CHECK: attributes #1 = {{.*}}"min-legal-vector-width"="256"
// CHECK: attributes #2 = {{.*}}"min-legal-vector-width"="512"